summaryrefslogtreecommitdiff
path: root/bsd-user/elfload.c
AgeCommit message (Collapse)AuthorFilesLines
2017-07-21bsd-user/elfload.c: Fix set-but-not-used warningsPeter Maydell1-6/+4
Fix various warnings about set-but-not-used variables on OpenBSD: bsd-user/elfload.c:1158:15: warning: variable 'mapped_addr' set but not used [-Wunused-but-set-variable] bsd-user/elfload.c:1165:9: warning: variable 'status' set but not used [-Wunused-but-set-variable] bsd-user/elfload.c:1168:15: warning: variable 'elf_stack' set but not used [-Wunused-but-set-variable] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 1500395194-21455-3-git-send-email-peter.maydell@linaro.org
2016-06-16os-posix: include sys/mman.hPaolo Bonzini1-1/+0
qemu/osdep.h checks whether MAP_ANONYMOUS is defined, but this check is bogus without a previous inclusion of sys/mman.h. Include it in sysemu/os-posix.h and remove it from everywhere else. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-22util: move declarations out of qemu-common.hVeronia Bahaa1-0/+1
Move declarations out of qemu-common.h for functions declared in utils/ files: e.g. include/qemu/path.h for utils/path.c. Move inline functions out of qemu-common.h and into new files (e.g. include/qemu/bcd.h) Signed-off-by: Veronia Bahaa <veroniabahaa@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-02-04bsd-user: Clean up includesPeter Maydell1-7/+1
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1454089805-5470-4-git-send-email-peter.maydell@linaro.org
2015-12-02translate-all: ensure host page mask is always extended with 1'sPaolo Bonzini1-2/+1
Anthony reported that >4GB guests on Xen with 32bit QEMU broke after commit 4ed023c ("Round up RAMBlock sizes to host page sizes", 2015-11-05). In that patch sizes are masked against qemu_host_page_size/mask which are uintptr_t, and thus 32bit on a 32bit QEMU, even though the ram space might be bigger than 4GB on Xen. Since ram_addr_t is not available on user-mode emulation targets, ensure that we get a sign extension when masking away the low bits of the address. Remove the ~10 year old scary comment that the type of these variables is probably wrong, with another equally scary comment. The new comment however does not have "???" in it, which is arguably an improvement. For completeness use the alignment macros in linux-user and bsd-user instead of manually doing an &. linux-user and bsd-user are not affected by the Xen issue, however. Reviewed-by: Juan Quintela <quintela@redhat.com> Reported-by: Anthony PERARD <anthony.perard@citrix.com> Fixes: 4ed023ce2a39ab5812d33cf4d819def168965a7f Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-09-11maint: avoid useless "if (foo) free(foo)" patternDaniel P. Berrange1-3/+1
The free() and g_free() functions both happily accept NULL on any platform QEMU builds on. As such putting a conditional 'if (foo)' check before calls to 'free(foo)' merely serves to bloat the lines of code. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-08-24linux-user: remove --enable-guest-base/--disable-guest-baseLaurent Vivier1-2/+0
All tcg host architectures now support the guest base and as there is no real performance lost, it can be always enabled. Anyway, guest base use can be disabled lively by setting guest base to 0. CONFIG_USE_GUEST_BASE is defined as (USE_GUEST_BASE && USER_ONLY), it should have to be replaced by CONFIG_USER_ONLY in non CONFIG_USER_ONLY parts, but as some other parts are using !CONFIG_SOFTMMU I have chosen to use !CONFIG_SOFTMMU instead. Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <1440373328-9788-2-git-send-email-laurent@vivier.eu> Signed-off-by: Richard Henderson <rth@twiddle.net>
2015-01-20bsd-user/elfload.c: Don't use ldl() or ldq_raw()Peter Maydell1-4/+7
Use get_user_u64() and get_user_ual() instead of the ldl() and ldq_raw() functions. [Note that this change is not compile tested as it is actually in dead code -- none of the bsd-user configurations are PPC.] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1421334118-3287-6-git-send-email-peter.maydell@linaro.org
2014-06-02Revert "bsd-user: replace fprintf(stderr, ...) with error_report()"Peter Maydell1-1/+1
This reverts commit 1fba509527beb74bdcf50bc07ad3cd8244ad9c61. That commit converted various fprintf(stderr, ...) calls to use error_report(); however none of these bsd-user files include a header which gives a prototype for error_report, so this causes compiler warnings. Since these are just straightforward reporting of command line errors, we should handle these in the obvious way by printing to stderr, as we do for linux-user. There's no need to drag in the error-handling framework for this, especially since user-mode doesn't have the "maybe we need to send this to the monitor" issues system emulation does. Acked-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-05-26bsd-user: replace fprintf(stderr, ...) with error_report()Le Tan1-1/+1
Replace fprintf(stderr,...) with error_report() in files bsd-user/*. The trailing "\n"s of the @fmt argument have been removed because @fmt of error_report() should not contain newline. Signed-off-by: Le Tan <tamlokveer@gmail.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-07-09bsd-user: Change thread_env to CPUStateAndreas Färber1-2/+4
Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-05-02target-i386: Replace cpuid_*features fields with a feature word arrayEduardo Habkost1-1/+1
This replaces the feature-bit fields on both X86CPU and x86_def_t structs with an array. With this, we will be able to simplify code that simply does the same operation on all feature words (e.g. kvm_check_features_against_host(), filter_features_for_kvm(), add_flagname_to_bitmaps(), CPU feature-bit property lookup/registration, and the proposed "feature-words" property) The following field replacements were made on X86CPU and x86_def_t: (cpuid_)features -> features[FEAT_1_EDX] (cpuid_)ext_features -> features[FEAT_1_ECX] (cpuid_)ext2_features -> features[FEAT_8000_0001_EDX] (cpuid_)ext3_features -> features[FEAT_8000_0001_ECX] (cpuid_)ext4_features -> features[FEAT_C000_0001_EDX] (cpuid_)kvm_features -> features[FEAT_KVM] (cpuid_)svm_features -> features[FEAT_SVM] (cpuid_)7_0_ebx_features -> features[FEAT_7_0_EBX] Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-12-19build: kill libdis, move disassemblers to disas/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-01-10elf: Improve symbol lookup (optimize, fix for bsd-user)Stefan Weil1-7/+4
Coverity complained about local variable key which was only partially initiated. Only key.st_value was set. As this was also the only part of key which was used in function symfind, the code could be optimized by directly passing a pointer to orig_addr. In bsd-user/elfload.c, fix ec822001a2f26eef8701194714f6482b6d852de2 was missing. This was a simple replacement of > by >= in symfind, so I fixed it here without creating an additional patch. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-12-10bsd_user: Fix potential null pointer dereferenceStefan Weil1-3/+2
This bug was spotted by cppcheck. Using g_try_malloc0 (as does the linux-user code) fixes this. v2: Use g_free in bsdload.c, too. Thanks to Peter Maydell for this hint. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-17bsd-user: Fix possible memory leaks and wrong realloc callStefan Weil1-6/+31
These errors were reported by cppcheck: [bsd-user/elfload.c:1108]: (error) Common realloc mistake: "syms" nulled but not freed upon failure [bsd-user/elfload.c:1076]: (error) Memory leak: s [bsd-user/elfload.c:1079]: (error) Memory leak: syms v2: * The previous fix for memory leaks was incomplete (thanks to Peter Maydell for te hint). * Fix wrong realloc usage, too. Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-18bsd-user: FreeBSD updateJuergen Lock1-1/+9
basic FreeBSD sysarch(2) handling fixed syscall errno return Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-10-04bsd-user: fix "#if 0"'d printf()Paul Bolle1-1/+1
Make an "#if 0"'d printf() in load_elf_binary() reflect what the actual code does (see commit 3bc0bdcaadef1100ce2413af818d9c8e2f6319fc). Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-30elfload: fix coding style nitMichael S. Tsirkin1-1/+1
Put space between = and * when dereferencing a pointer, to avoid confusion with old-style "*=" Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-27BSD user: suppress a warningBlue Swirl1-2/+2
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-27BSD user: implement GUEST_BASEBlue Swirl1-0/+23
Based on 379f6698d73f476de38682b3ff96ecb226728c43. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-08-01Fix Sparse warning about missing prototypeBlue Swirl1-2/+0
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-08-01More NULL pointer fixesBlue Swirl1-1/+1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-07-17fix build warningsChristoph Egger1-1/+1
Hi! Attached patch fixes build warnings due to use of different pointer signedness. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> -- ---to satisfy European Law for business letters: Advanced Micro Devices GmbH Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
2009-01-15Convert references to logfile/loglevel to use qemu_log*() macrosaliguori1-1/+1
This is a large patch that changes all occurrences of logfile/loglevel global variables to use the new qemu_log*() macros. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6338 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-14Remove all traces of __powerpc__malc1-1/+1
According to $GCC/gcc/config/rs6000/rs6000-c.c _ARCH_PPC is the ubiquitous define which should be used to test whether gcc targets PowerPC, on 64bit platforms _ARCH_PPC64 will be also defined. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6301 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-26Preliminary BSD user emulator supportblueswir11-0/+1523
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5544 c046a42c-6fe2-441c-8c8c-71466251a162