summaryrefslogtreecommitdiff
path: root/linux-user/flatload.c
AgeCommit message (Collapse)AuthorFilesLines
2016-09-21linux-user: Fix error handling in flatload.c target_pread()Peter Maydell1-0/+6
The flatload.c target_pread() function is supposed to return 0 on success or negative host errnos; however it wasn't checking lock_user() for failure or returning the errno from the pread() call. Fix these problems (the first of which is noted by Coverity). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-12Use #include "..." for our own headers, <...> for othersMarkus Armbruster1-1/+1
Tracked down with an ugly, brittle and probably buggy Perl script. Also move includes converted to <...> up so they get included before ours where that's obviously okay. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Eric Blake <eblake@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
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-10osdep: add wrappers for socket functionsDaniel P. Berrange1-1/+0
The windows socket functions look identical to the normal POSIX sockets functions, but instead of setting errno, the caller needs to call WSAGetLastError(). QEMU has tried to deal with this incompatibility by defining a socket_error() method that callers must use that abstracts the difference between WSAGetLastError() and errno. This approach is somewhat error prone though - many callers of the sockets functions are just using errno directly because it is easy to forget the need use a QEMU specific wrapper. It is not always immediately obvious that a particular function will in fact call into Windows sockets functions, so the dev may not even realize they need to use socket_error(). This introduces an alternative approach to portability inspired by the way GNULIB fixes portability problems. We use a macro to redefine the original socket function names to refer to a QEMU wrapper function. The wrapper function calls the original Win32 sockets method and then sets errno from the WSAGetLastError() value. Thus all code can simply call the normal POSIX sockets APIs are have standard errno reporting on error, even on Windows. This makes the socket_error() method obsolete. We also bring closesocket & ioctlsocket into this approach. Even though they are non-standard Win32 names, we can't wrap the normal close/ioctl methods since there's no reliable way to distinguish between a file descriptor and HANDLE in Win32. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-01-29linux-user: Clean up includesPeter Maydell1-4/+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: 1453832250-766-10-git-send-email-peter.maydell@linaro.org
2015-09-28linux-user: remove MAX_ARG_PAGES limitStefan Brüns1-1/+1
Instead of creating a temporary copy for the whole environment and the arguments, directly copy everything to the target stack. For this to work, we have to change the order of stack creation and copying the arguments. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2014-01-10linux-user: Remove regs parameter of load_elf_binary and load_flt_binaryWill Newton1-2/+1
The regs parameter is not used anywhere, so remove it. Signed-off-by: Will Newton <will.newton@linaro.org> Reviewed-by: Erik de Castro Lopo <erikd@mega-nerd.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2013-11-29flatload: fix non-GOT relocationsCorey J. Boyle1-1/+1
Use target address rather than host address when performing non-GOT relocations Signed-off-by: Corey J. Boyle <corey@kansanian.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-08-14flatload: fix bss clearingMike Frysinger1-1/+1
The current bss clear logic assumes the target mmap address and host address are the same. Use g2h to translate from the target address space to the host so we can call memset on it. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-12-02fix spelling in linux-user sub directoryDong Xu Wang1-1/+1
Cc: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-06-21flatload: memp was a write-only variableJuan Quintela1-3/+0
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21flatload: end_code was only used in a debug messageJuan Quintela1-3/+2
Just unfold its definition in only use. Signed-off-by: Juan Quintela <quintela@redhat.com> [peter.maydell@linaro.org: fixed typo in the debug code, added parentheses to fix precedence issue] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-02-09linux-user/FLAT: allow targets to override FLAT processingMike Frysinger1-16/+11
This brings flatload.c more in line with the current Linux FLAT loader which allows targets to handle various FLAT aspects in their own way. For the common behavior, the new functions get stubbed out. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2011-02-09linux-user/FLAT: fix auto-stack sizingMike Frysinger1-2/+9
The current auto-stack sizing works like it does on a NOMMU system; the problem is that this only works if the envp/argv arrays are fairly slim. On a desktop system, this is rarely the case, and can easily blow past the stack and into data/text regions as the default stack for FLAT progs is a mere 4KiB. So rather than rely on the NOMMU calculation (which is only there because NOMMU can't easily allocate gobs of contiguous mem), calc the full space actually needed and let the MMU host make space. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-09-18linux-user: improve flatload error checkingBlue Swirl1-1/+2
Because of the use of unsigned type, possible errors during load were ignored. Fix by using a signed type. This also avoids a warning with GCC flag -Wtype-limits. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-06-16Usermode exec-stack fixPaul Brook1-0/+1
When loading a shared library that requires an executable stack, glibc uses the mprotext PROT_GROWSDOWN flag to achieve this. We don't support PROT_GROWSDOWN. Add a special case to handle changing the stack permissions in this way. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-05-28linux-user: Fix compilation with DEBUG definedRiccardo Magliocchetti1-1/+1
Signed-off-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-07-16Update to a hopefully more future proof FSF addressBlue Swirl1-3/+1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-05-13Replace gcc variadic macro extension with C99 versionBlue Swirl1-2/+2
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-01-05Fix more FSF addressesblueswir11-1/+2
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6192 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-26Fix undeclared symbol warnings from sparseblueswir11-3/+3
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5539 c046a42c-6fe2-441c-8c8c-71466251a162
2008-07-16Fix a bunch of type mismatch-related warnings (Jan Kiszka).balrog1-3/+3
Fix a typo in my previous comming (spotted by Laurent Desnouges). git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4877 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-16suppressed tgetx and tputx (initial patch by Thayne Harbaugh)bellard1-10/+21
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3653 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-11Linux user memory access API change (initial patch by Thayne Harbaugh)bellard1-1/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3583 c046a42c-6fe2-441c-8c8c-71466251a162
2007-10-14 Support for 32 bit ABI on 64 bit targets (only enabled Sparc64)blueswir11-46/+46
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3396 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-17find -type f | xargs sed -i 's/[\t ]*$//g' # Yes, again. Note the star in ↵ths1-9/+9
the regex. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3177 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-16find -type f | xargs sed -i 's/[\t ]$//g' # on most filesths1-12/+12
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162
2007-04-15bFLT loader alignment fix.pbrook1-8/+11
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2669 c046a42c-6fe2-441c-8c8c-71466251a162
2007-03-15Align stack when loading bFLT binaries.pbrook1-0/+7
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2478 c046a42c-6fe2-441c-8c8c-71466251a162
2006-12-26bFLT loader commandline fix.pbrook1-1/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2279 c046a42c-6fe2-441c-8c8c-71466251a162
2006-06-17Respond to qOffsets gdb packet (for debugging bFLT binaries).pbrook1-0/+3
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1986 c046a42c-6fe2-441c-8c8c-71466251a162
2006-06-11bFLT loader (for uClinux binaries).pbrook1-0/+790
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1951 c046a42c-6fe2-441c-8c8c-71466251a162