summaryrefslogtreecommitdiff
path: root/linux-user
AgeCommit message (Collapse)AuthorFilesLines
2009-05-04Fix compiler warnings in nwfpe code.Paul Brook5-86/+47
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-04-21MIPS signal handling fixes.pbrook3-4/+109
Also fixes a register corruption bug in do_sigreturn. When "returning" from sigreturn we are actually restoring the virtual cpu state from the signal frame. This is actually surprisingly hard to observe in practice. Typically an thread be blocked in a FUTEX_WAIT call when the signal arrives, so the effect is a spurious syscall success and the introduction of a subtle race condition. On x86/arm a syscall modifies a single word sized register, so do_sigreturn can just return that value. On MIPS a syscall clobbers multiple registers, so we need additional smarts. My solution is to invent a magic errno value that means "don't touch CPU state". git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7194 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-21MIPS: Raise SIGSEGV, not SIGILL when an access faults.pbrook1-0/+7
Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7193 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-21Fix target_siginfo ordering for MIPS.pbrook1-0/+6
Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7192 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-19linux-user: Linux kernel's fchmodat and faccessat have three args (no 4th arg)aurel321-9/+8
In Linux kernel, fchmodat() and faccessat() take tree args. 4th value <int flags> is only processed by libc. Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7187 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-18linux-user: fix IPCOP_sem* and implement sem*aurel321-98/+188
Fix and cleanup IPCOP_sem* ipc calls handling and implement sem* syscalls. Riku: 1) Uglify whitespace so that diff gets smaller and easier to review 2) use __get_user in target_to_host_sembuf Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7184 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-17linux-user: fix inotify syscallsaurel321-1/+2
Configure test was broken, so the breakage of the #ifdef'd code was not noticed. Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7134 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-16Translate signal values in exit status.pbrook3-2/+18
Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7131 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-16linux-user: fix getcwd syscallaurel321-1/+1
The patch called "prefer glibc over direct syscalls" (commit 7118) has replaced the getcwd syscall with a call to the glibc. With this change, the syscall is returning -1 in error case and 0 otherwise. This is problematic as the sys_getcwd syscall should return the number of bytes written to the buffer including the '\0'. Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org> Acked-By: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7130 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-15linux-user: fix warnings introduced by r7118aurel321-1/+1
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7120 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-15linux-user: proper exit code for uncaught signalsaurel321-12/+25
The proper exit code for dieing from an uncaught signal is -<signal>. The kernel doesn't allow exit() or _exit() to pass a negative value. To get the proper exit code we need to actually die from an uncaught signal. A default signal handler is installed, we send ourself a signal and we wait for it to arrive. Patch originates from Scratchbox Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7119 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-15linux-user: prefer glibc over direct syscallsaurel321-61/+253
The openat/*at syscalls are incredibly common with modern coreutils, calling them directly via syscalls breaks for example fakeroot. Use glibc stubs whenever directly available and provide old syscall calling for people still using older libc. Patch originally from Mika Westerberg, Adapted to apply to current trunk and cleaned up by Riku Voipio. Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7118 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-15linux-user: removed unnecessary MAX_SOCK_ADDR checks for socket syscallsaurel321-10/+7
- This check is not needed because kernel will check whether given buffer is too small and there is no upper limit for size of the buffer. From: Mika Westerberg <mika.westerberg@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7117 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-15linux-user: unix sockets - fix running dbusaurel321-2/+27
dbus sends too short (according to man 7 unix) addrlen for it's unix socket. I've been told that happens with other applications as well. Linux kernel doesn't appear to mind, so I guess we whould be tolerant as well. Expand sockaddr with +1 to fit the \0 of the pathname passed. (scratchbox1 qemu had a very different workaround for the same issue). Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7116 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-15linux-user: add support for passing contents of argv0aurel321-1/+37
Added switch -0 (zero) which can be used to pass argv[0] to target process. The main use is for a binfmt_misc wrapper when the "P - preserve-argv[0]" setting is used. From: Mika Westerberg Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7115 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-15linux-user: Added posix message queue syscalls except mq_notifyaurel323-6/+126
Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr> Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7114 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-09Enable generic accepts-anything cpu by default for usermode emulation.pbrook1-1/+1
Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7051 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-08linux-user: fix fstatat64()/newfstatat() syscall implementationaurel321-4/+25
There are two different syscall names for the same goal. On systems with sizeof(long) == 64 it calls newfstatat. On systems with sizeof(long) == 32 it calls fstatat64. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7050 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-08linux-user: fix problems with inotify syscallsaurel321-3/+3
The sys_inotify* calls are defined if the target supports them and the host supports the necessary syscalls. But the syscalls are handled if the target supports them. This situation leads to compilation failures when the host doesn't support the necessary syscalls, as the linker will complain about undefined functions. Fix this state of affairs by making the handling conditions the same as the call definition conditions. Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Acked-By: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7038 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-07Add --with-pkgversion.pbrook1-1/+1
Allows distributors to identify their builds without needing to hack the sources. Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7036 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-05Add new command line option -singlestep for tcg single stepping.aurel321-0/+5
This replaces a compile time option for some targets and adds this feature to targets which did not have a compile time option. Add monitor command to enable or disable single step mode. Modify monitor command "info status" to display single step mode. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7004 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-07Use a dedicated function to request exit from execution loopaurel322-2/+2
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6762 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-07The _exit syscall is used for both thread termination in NPTL applications,pbrook4-7/+69
and process termination in legacy applications. Try to guess which we want based on the presence of multiple threads. Also implement locking when modifying the CPU list. Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6735 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-28Flush stdout after printing usage()blueswir11-2/+2
Fixes qemu-arm|grep cpu - with _exit() getting output from qemu --help is a bit random. Since no atexit() handlers are registered for user mode emulation, just use exit() instead. Signed-off-by: Riku Voipio <riku.voipio@iki.fi> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6657 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-09Fix crash caused by missing command line argumentsaurel321-1/+7
Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6580 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-03Partialy fix mmap at EOF for large pagesize targets in user-mode.edgar_igl1-2/+37
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6510 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-03linux-user: Remove incorrect break;aurel321-1/+0
Reported-By: Laurent Desnogues <laurent.desnogues@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6503 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-01Replace noreturn with QEMU_NORETURNmalc1-1/+1
Thanks to Robert Riebisch for analysis [1] [1] http://marc.info/?l=qemu-devel&m=123352293319271&w=2 git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6492 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-30linux-user: fix signal.c warningaurel321-4/+4
This patch fixes: linux-user/signal.c:1403: warning: no previous prototype for 'do_sigreturn_v1' linux-user/signal.c:1473: warning: no previous prototype for 'do_sigreturn_v2' linux-user/signal.c:1511: warning: no previous prototype for 'do_rt_sigreturn_v1' linux-user/signal.c:1552: warning: no previous prototype for 'do_rt_sigreturn_v2' by making the appropriate functions static. Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6486 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-30linux-user: identify running binary in /proc/self/exeaurel323-3/+16
Some applications like to test /proc/self/exe to find out who they are. Fake the result of readlink() for them. Use realpath() to return full path to binary (which the links /proc/self/exe are) Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6485 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-30linux-user: Add generic env variable handlingaurel323-16/+303
Adds support for qemu to modify target process environment variables using -E and -U commandline switches. This replaces eventually the -drop-ld-preload flag. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Riku Voipio <riku.voipio@iki.fi> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6484 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-30target-ppc: Fix struct target_stat64 for 32-bit hostaurel321-2/+3
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6483 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-30target-sh4: Fix struct target_stat64 for 64-bit hostaurel321-1/+1
Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6482 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-30linuw-user fix: read() and acct() on NULL argumentsaurel321-8/+16
Returning efault in these cases is not correct. Originally proposed by Thayne Harbaugh in 2007: http://www.mail-archive.com/qemu-devel@nongnu.org/msg14658.html Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6481 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-30linux-user: don't crash with null nameaurel321-1/+1
From Thayne Harbaugh. path() may be called with null string, don't bother trying to remap in that case. Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6480 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-30linux-user: return EINVAL on incorrect sockaddraurel321-2/+31
From: Lauro Ramos Venancio <lauro.venancio@gmail.com> Fixes ltp test accept01 Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6479 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-30linux-user: fix accept(2) with NULL peeraurel321-0/+3
Based on scratchbox2 patch by Mika Westerberg Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6478 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-28Fix qemu_malloc.malc1-0/+2
make {linux,bsd}-user qemu_realloc handle ptr == NULL correctly. spotted by malc. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6466 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-23linux-user: add qemu_realloc() implementation to unbreak the build (Gerd ↵aliguori1-0/+13
Hoffman) Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6412 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-20Fix user emulator breakage, based on patch by Riku Voipioblueswir11-13/+15
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6371 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-15Convert references to logfile/loglevel to use qemu_log*() macrosaliguori3-21/+17
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-15Clean up debugging code #ifdefs (Eduardo Habkost)aliguori1-22/+17
Use macros to avoid #ifdefs on debugging code. This patch doesn't try to merge logging macros from different files, but just unify the debugging code #ifdefs onto a macro on each file. A further cleanup can unify the debugging macros on a common header, later 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@6332 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-14Get rid of user_mode_onlyaurel321-1/+0
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6305 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-14Add noreturn function attributeblueswir11-1/+2
Introduce noreturn attribute and attach it to cpu_loop_exit as well as interrupt/exception helpers for i386. This avoids a bunch of gcc4 warnings. [ Note that this patch comes with a workaround to include qemu-common.h even in cases where is currently causes conflicts with dyngen-exec.h. I've been told that these conflicts will get resolved in the future (/me will try to have a look as well - as time permits). ] Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6303 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
2009-01-07CRIS: Add a bunch of syscall numbers.edgar_igl1-0/+44
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6223 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-07CRIS: Clone flags are reversed on CRIS.edgar_igl1-0/+2
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6222 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-07CRIS: Implement set_thread_area for CRIS.edgar_igl1-0/+8
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6210 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-05Fix more FSF addressesblueswir17-7/+14
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6192 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-04Update FSF address in GPL/LGPL boilerplateaurel321-1/+1
The attached patch updates the FSF address in the GPL/LGPL boilerplate in most GPL/LGPLed files, and also in COPYING.LIB. Signed-off-by: Stuart Brady <stuart.brady@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6162 c046a42c-6fe2-441c-8c8c-71466251a162