summaryrefslogtreecommitdiff
path: root/linux-user/signal.c
AgeCommit message (Collapse)AuthorFilesLines
2012-10-12linux-user: Fix siginfo handlingRichard Henderson1-19/+40
Compare signal numbers in the proper domain. Convert all of the fields for SIGIO and SIGCHLD. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-10-05cleanup useless return sentenceAmos Kong1-2/+0
This patch cleans up return sentences in the end of void functions. Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Amos Kong <akong@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2012-08-09sparc: fix expression with uninitialized initial valueBlue Swirl1-5/+3
err was uninitialized, it's not OK to use |=. Spotted by Clang compiler. Fix by implementing the earlier statement which initializes the variable. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-08-01Replace 'struct siginfo' with 'siginfo_t'.Richard W.M. Jones1-4/+4
glibc 2.16 will remove the undocumented definition of 'struct siginfo' from <bits/siginfo.h>. This change is already present in glibc 2.15.90, so qemu compilation of certain targets (eg. cris-user) breaks. This struct was always typedef'd to be the same as 'siginfo_t' which is what POSIX documents, so use that instead. Signed-off-by: Richard W.M. Jones <rjones@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-07-27target-or32: Add linux user supportJia Liu1-0/+229
Add QEMU OpenRISC linux user support. Signed-off-by: Jia Liu <proljc@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-21qemu-log: cleanupBlue Swirl1-8/+4
Don't use global variables directly but via accessor functions. Rename globals. Convert macros to functions, add GCC format attributes. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-15Bad zero comparison for sas_ss_flags on powerpcAlex Barcelo1-1/+1
All architectures work the same way, and all check for sas_ss_flags == 0. The powerpc lines are wrong, and do the check the other way round (it's a qemu internal check, which is done wrong only for this architecture, it's more a typo than a bug). It's NOT ppc specific, it's POSIX standard (sigaltstack) and qemu internal. I have a test source that I will send in a follow-up (it's longer than I would have wished, I'm sure that a better test case can be written if needed) Signed-off-by: Alex Barcelo <abarcelo@ac.upc.edu> Signed-off-by: Alexander Graf <agraf@suse.de>
2012-03-14Rename CPUState -> CPUArchStateAndreas Färber1-8/+8
Scripted conversion: for file in *.[hc] hw/*.[hc] hw/kvm/*.[hc] linux-user/*.[hc] linux-user/m68k/*.[hc] bsd-user/*.[hc] darwin-user/*.[hc] tcg/*/*.[hc] target-*/cpu.h; do sed -i "s/CPUState/CPUArchState/g" $file done All occurrences of CPUArchState are expected to be replaced by QOM CPUState, once all targets are QOM'ified and common fields have been extracted. Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
2012-03-14linux-user: Don't overuse CPUStateAndreas Färber1-97/+104
In target-specific code use CPU*State. While at it, fix indentation on those lines. Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-03-08Spelling fixes in comments (it's -> its)Stefan Weil1-1/+1
* it's -> its (fixed for all files) * dont -> don't (only fixed in a line which was touched by the previous fix) * distrub -> disturb (fixed in the same line) Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-02-02linux-user: Fix sa_flags byte swaps for mipsAndreas Färber1-0/+8
sa_flags is uint32_t for mips{,n32,64}, so don't use tswapal(). edited by Riku Voipio: likewise on alpha Reported-by: Khansa Butt <khansa@kics.edu.pk> Suggested-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Ehsan Ul Haq <ehsan.ulhaq@kics.edu.pk> Signed-off-by: Riku Voipio <riku.voipio@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-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>