summaryrefslogtreecommitdiffstats
path: root/bsd-user/elfload.c
Commit message (Collapse)AuthorAgeFilesLines
* bsd-user: Clean up includesPeter Maydell2019-11-291-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
* translate-all: ensure host page mask is always extended with 1'sPaolo Bonzini2015-12-021-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>
* maint: avoid useless "if (foo) free(foo)" patternDaniel P. Berrange2015-09-111-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>
* linux-user: remove --enable-guest-base/--disable-guest-baseLaurent Vivier2015-08-241-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>
* bsd-user/elfload.c: Don't use ldl() or ldq_raw()Peter Maydell2015-01-201-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
* Revert "bsd-user: replace fprintf(stderr, ...) with error_report()"Peter Maydell2014-06-021-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>
* bsd-user: replace fprintf(stderr, ...) with error_report()Le Tan2014-05-261-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>
* bsd-user: Change thread_env to CPUStateAndreas Färber2013-07-091-2/+4
| | | | Signed-off-by: Andreas Färber <afaerber@suse.de>
* target-i386: Replace cpuid_*features fields with a feature word arrayEduardo Habkost2013-05-021-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>
* build: kill libdis, move disassemblers to disas/Paolo Bonzini2012-12-191-1/+1
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* elf: Improve symbol lookup (optimize, fix for bsd-user)Stefan Weil2012-01-101-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>
* bsd_user: Fix potential null pointer dereferenceStefan Weil2011-12-101-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>
* bsd-user: Fix possible memory leaks and wrong realloc callStefan Weil2011-01-171-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>
* bsd-user: FreeBSD updateJuergen Lock2009-10-181-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>
* bsd-user: fix "#if 0"'d printf()Paul Bolle2009-10-041-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>
* elfload: fix coding style nitMichael S. Tsirkin2009-09-301-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>
* BSD user: suppress a warningBlue Swirl2009-09-271-2/+2
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* BSD user: implement GUEST_BASEBlue Swirl2009-09-271-0/+23
| | | | | | Based on 379f6698d73f476de38682b3ff96ecb226728c43. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix Sparse warning about missing prototypeBlue Swirl2009-08-011-2/+0
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* More NULL pointer fixesBlue Swirl2009-08-011-1/+1
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* fix build warningsChristoph Egger2009-07-171-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
* Convert references to logfile/loglevel to use qemu_log*() macrosaliguori2009-01-151-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
* Remove all traces of __powerpc__malc2009-01-141-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
* Preliminary BSD user emulator supportblueswir12008-10-261-0/+1523
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5544 c046a42c-6fe2-441c-8c8c-71466251a162
OpenPOWER on IntegriCloud