summaryrefslogtreecommitdiff
path: root/linux-user/signal.c
AgeCommit message (Collapse)AuthorFilesLines
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
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-05Fix more FSF addressesblueswir11-1/+2
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6192 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-03Fix qemu endless loop when raising a SIGSEGV/SIGBUS signal with gdbstub in ↵aurel321-2/+2
user emulation When a SIGSEGV signal is raised in user mode emulation the current test to know whether the signal is sent by the kernel is wrong : info->si_code == SI_KERNEL according to /usr/include/bits/siginfo.h it should be info->si_code > 0 Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6151 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-18User-mode GDB stub improvements - handle signalsaurel321-16/+49
Handle signals in the user-mode GDB stub. Report them to GDB, and allow it to change or cancel them. Also correct the protocol numbering; it happens to match Linux numbering for SIGINT and SIGTRAP, but that's just good fortune. Signed-off-by: Daniel Jacobowitz <dan@codesourcery.com> Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6096 c046a42c-6fe2-441c-8c8c-71466251a162
2008-11-27linux-user: Add support for STOP/CONT signals.ths1-1/+6
Signed-off-by: Riku Voipio <riku.voipio@iki.fi> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5802 c046a42c-6fe2-441c-8c8c-71466251a162
2008-11-27linux-user: sig is target signal.ths1-1/+1
Signed-off-by: Riku Voipio <riku.voipio@iki.fi> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5801 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-08CRIS: linux-user signals dont need ERP compensation after break anymore.edgar_igl1-3/+0
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5450 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-05Make target_sigaltstack_used staticblueswir11-1/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5428 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-16Move offsetof to osdep.h, remove local defintions.balrog1-4/+0
With this container_of can actually be used without causing build errors. Reformat container_of. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5234 c046a42c-6fe2-441c-8c8c-71466251a162
2008-08-17Fix some warnings that would be generated by gcc -Wmissing-prototypesblueswir11-2/+3
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5022 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
2008-06-27More efficient target register / TC accesses.ths1-17/+17
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4794 c046a42c-6fe2-441c-8c8c-71466251a162