aboutsummaryrefslogtreecommitdiffstats
path: root/linux-user/signal.c
AgeCommit message (Collapse)AuthorFilesLines
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-10-31Merge remote-tracking branch 'riku/linux-user-for-upstream' into stagingAnthony Liguori1-11/+11
2011-10-27linux-user: fix abi_(u)long, target_ulong mismatchMatthias Braun1-11/+11
abi_(u)long might be different from target_ulong, so don't use tswapl but introduce a new tswapal Signed-off-by: Matthias Braun <matze@braunis.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-10-26target-sparc: Change fpr representation to doubles.Richard Henderson1-12/+16
This allows a more efficient representation for 64-bit hosts. It should be about the same for 32-bit hosts, as we can still access the individual pieces of the double. Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-10-05linux-user: Remove unused codeStefan Weil1-4/+1
The code is unused since 8 years, so remove it. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-08-26linux-user: Correct a few missuses of host addressesEdgar E. Iglesias1-14/+15
Fix a few cases where we were passing host pointers to the guest. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-07-13linux-user/signal.c: Rename s390 target_ucontext fields to fix ia64Peter Maydell1-15/+15
The ia64 sys/ucontext.h defines macros 'uc_link', 'uc_sigmask' and 'uc_stack'. Rename the s390 target_ucontext struct members to tuc_*, bringing them into line with the other targets and fixing a compile failure on ia64 hosts caused by this clash. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2011-06-21linux-user/signal.c: Remove unused fenabPeter Maydell1-2/+5
Remove fenab as it is only written, never used. Add a FIXME comment about the discrepancy between our behaviour and that of the Linux kernel for this routine. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-21linux-user/signal.c: Remove only-ever-set variable fpu_save_addrPeter Maydell1-5/+5
Move the access of fpu_save into the commented out skeleton code for restoring FPU registers on SPARC sigreturn, thus silencing a gcc 4.6 "variable set but never used" warning. (This doesn't affect the calculation of 'err' because in fact __get_user() can never fail.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-20Don't translate pointer when in restore_sigcontextMike McCormack1-2/+2
Fixes crash in i386 when user emulation base address is non-zero. 21797 rt_sigreturn(8,1082124603,1,0,1082126048,1082126248)Exit reason and status: signal 11 Signed-off-by: Mike McCormack <mj.mccormack@samsung.com> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-06-08Fix compilation warning due to missing header for sigaction (followup)Alexandre Raymond1-1/+0
This patch removes all references to signal.h when qemu-common.h is included as they become redundant. Signed-off-by: Alexandre Raymond <cerbere@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-05-20s390x: s390x-linux-user supportUlrich Hecht1-0/+333
This patch adds support for running s390x binaries in the linux-user emulation code. Signed-off-by: Ulrich Hecht <uli@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2011-05-08Fix typo in comment (dieing -> dying)Stefan Weil1-1/+1
Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-02-10linux-user/arm: fix compilation failures using softfloat's struct typesPeter Maydell1-2/+2
Add uses of the float32/float64 boxing and unboxing macros so that the ARM linux-user targets will compile with USE_SOFTFLOAT_STRUCT_TYPES enabled. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-01linux-user: avoid gcc array overrun warning for sparcPeter Maydell1-3/+4
Suppress a gcc array bounds overrun warning when filling in the SPARC signal frame by adjusting our definition of the structure so that the fp and callers_pc membes are part of the ins[] array rather than separate fields; since qemu has no need to access the fields individually there is no need to follow the kernel's structure field naming exactly. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-14linux-user: ARM: clear the IT bits when invoking a signal handlerPeter Maydell1-7/+9
When invoking a signal handler for an ARM target, make sure the IT bits in the CPSR are cleared. (This would otherwise cause incorrect execution if the IT state was non-zero when an exception occured. This bug has been masked previously because we weren't getting the IT state bits at exception entry right anyway.) Also use the proper cpsr_read()/cpsr_write() interface to update the CPSR rather than manipulating CPUState fields directly. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-12-03ARM: linux-user: Restore iWMMXT state from ucontext on sigreturnPeter Maydell1-0/+30
Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03ARM: linux-user: Expose iWMMXT registers to signal handlersPeter Maydell1-0/+37
Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03ARM: linux-user: Restore VFP state from ucontext on sigreturnPeter Maydell1-0/+40
Restore the VFP registers from the ucontext on return from a signal handler in linux-user mode. This means that signal handlers cannot accidentally corrupt the interrupted code's VFP state, and allows them to deliberately modify the state via the ucontext structure. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03ARM: linux-user: Expose VFP registers to signal handlersPeter Maydell1-1/+46
For ARM linux-user mode signal handlers, fill in the ucontext with VFP register contents in the same way that the kernel does. We only do this for v2 format sigframe (2.6.12 and above); this is actually bug-for-bug compatible with the older kernels, which don't save and restore VFP registers either. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03ARM: linux-user: Correct size of padding in target_ucontext_v2Peter Maydell1-1/+1
The padding in the target_ucontext_v2 is defined by the size of the target's sigset_t type, not the host's. (This bug only causes problems when we start using the uc_regspace[] array to expose VFP registers to userspace signal handlers.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-11-23microblaze: target-ify target_ucontextRichard Henderson1-9/+9
Rename the members of target_ucontext so that they don't conflict with possible host macros for ucontext members. This has already been done for the other targets. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-07-23microblaze: Pass a ucontext * as 3rd sighandler argEdgar E. Iglesias1-6/+20
There is disagreement between microblaze glibc and the kernel to what the third arg of signal handlers should point to. Change QEMU linux-user to match the kernel port. glibc patches are pending. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
2010-07-15microblaze: Correct signal frame setup.Edgar E. Iglesias1-1/+2
Pass the context in r7. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-05-09sparc: Fix lazy flag calculation on interrupts, refactorBlue Swirl1-2/+2
Recalculate Sparc64 CPU flags on interrupts, otherwise some earlier flags could be stored to pstate. Refactor PSR/CCR/CWP handling: concentrate the actual functions to op_helper.c. Thanks to Igor Kovalenko for reporting. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-01linux-user/ia64: workaround ia64 strangenessesAurelien Jarno1-104/+104
ia64 has some strangenesses that need to be workaround: - it has a __clone2() syscall instead of the using clone() one, with different arguments, and which is not declared in the usual headers. - ucontext.uc_sigmask is declared with type long int, while it is actually of type sigset_t. - uc_mcontext, uc_sigmask, uc_stack, uc_link are declared using #define, which clashes with the target_ucontext fields. Change their names to tuc_*, as already done for some target architectures.
2010-03-18Replace assert(0) with abort() or cpu_abort()Blue Swirl1-1/+0
When building with -DNDEBUG, assert(0) will not stop execution so it must not be used for abnormal termination. Use cpu_abort() when in CPU context, abort() otherwise. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-03-13Fix build with -DNDEBUG in CFLAGSBlue Swirl1-1/+1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-03-06linux-user: Save/restore fpu registers to signal context on sh4takasi-y@ops.dti.ne.jp1-8/+21
As "todo" comment in source code. And modify restore_sigcontext() to have three args as kernel's does. Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-02-28alpha-linux-user: Implement signals.Richard Henderson1-0/+267
Move userland PALcode handling into linux-user main loop so that we can send signals from there. This also makes alpha_palcode.c system-level only, so don't build it for userland. Add defines for GENTRAP PALcall mapping to signals. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-12-19linux-user: cleanup force_sig() callsRiku Voipio1-20/+20
Force_sig should be always called with TARGET_ signals. Not that it really matters with SEGV, so this patch is just for cleanup and improving consistency. Signed-off-by: Riku Voipio <riku.voipio@nokia.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-11-24linux-user: remove hardcoded value of _NSIG in signal.cArnaud Patard1-6/+6
In a bunch of places, 64 is used as value of _NSIG but it's wrong at least on MIPS were _NSIG is 128. Based on a patch from Arnaud Patard <arnaud.patard@rtp-net.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-10-01Revert "Get rid of _t suffix"Anthony Liguori1-123/+123
In the very least, a change like this requires discussion on the list. The naming convention is goofy and it causes a massive merge problem. Something like this _must_ be presented on the list first so people can provide input and cope with it. This reverts commit 99a0949b720a0936da2052cb9a46db04ffc6db29. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-01Get rid of _t suffixmalc1-123/+123
Some not so obvious bits, slirp and Xen were left alone for the time being. Signed-off-by: malc <av1474@comtv.ru>
2009-08-25m68k, linux-user: add setup_rt_frameLaurent Vivier1-3/+202
This patch implements setup_rt_frame(). Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-08-25m68k,linux-user: add setup_frameLaurent Vivier1-0/+183
This patch adds signals management for linux-user. It implements setup_frame() which allows to call the user signal handler. setup_rt_frame() is always unimplemented. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-07-20Fix most warnings (errors with -Werror) when debugging is enabledBlue Swirl1-2/+2
I used the following command to enable debugging: perl -p -i -e 's/^\/\/#define DEBUG/#define DEBUG/g' * */* */*/* Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-07-18Avoid name clashes with symbols that leak from system headersmalc1-4/+4
Signed-off-by: malc <av1474@comtv.ru>
2009-07-16Update to a hopefully more future proof FSF addressBlue Swirl1-3/+1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-07-09MIPS signal handling fixPaul Brook1-0/+2
Add explicit padding to MIPS signal frame structures. Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-16linux-user: implemented ELF coredump support for ARM targetMika Westerberg1-3/+37
When target process is killed with signal (such signal that should dump core) a coredump file is created. This file is similar than coredump generated by Linux (there are few exceptions though). Riku Voipio: added support for rlimit Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-05-26microblaze: linux-user support.Edgar E. Iglesias1-0/+216
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2009-05-16linux-user: ppc signal handlingNathan Froyd1-0/+596
Implement setup_{,rt_}frame and do_{,rt_}sigreturn for PPC 32-bit. Use the same TARGET_QEMU_ESIGRETURN hack as for MIPS to avoid clobbering register state on a sigreturn. Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Signed-off-by: malc <av1474@comtv.ru>
2009-04-21MIPS signal handling fixes.pbrook1-4/+101
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-16Translate signal values in exit status.pbrook1-1/+1
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-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-03-07Use a dedicated function to request exit from execution loopaurel321-1/+1
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,pbrook1-1/+1
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-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