summaryrefslogtreecommitdiffstats
path: root/linux-user/signal.c
Commit message (Collapse)AuthorAgeFilesLines
* linux-user: Save the correct resume address for MIPS signal handlingKwok Cheung Yeung2013-05-201-1/+2
| | | | | | | | | | | | | | The current ISA mode needs to be saved in bit 0 of the resume address. If the current instruction happens to be in a branch delay slot, then the address of the preceding jump instruction should be stored instead. exception_resume_pc already does both of these tasks, so it is made available and reused. MIPS_HFLAG_BMASK in hflags is cleared, otherwise QEMU may treat the first instruction of the signal handler as a delay slot instruction. Signed-off-by: Kwok Cheung Yeung <kcy@codesourcery.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* linux-user: Fix MIPS ISA transitions during signal handlingKwok Cheung Yeung2013-05-201-0/+13
| | | | | | | | | | | | Processors supporting the MIPS16 or microMIPS ISAs set bit 0 in target addresses to indicate that the target is written using a compressed ISA. During signal handling, when jumping to or returning from a signal handler, bit 0 of the destination PC is inspected and MIPS_HFLAG_M16 in hflags cleared or set accordingly. Bit 0 of the PC is then cleared. Signed-off-by: Kwok Cheung Yeung <kcy@codesourcery.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* mips-linux-user: Save and restore fpu and dsp from sigcontextRichard Henderson2013-03-051-115/+42
| | | | | Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* mips-linux-user: Share o32 code for n32 and n64 signalsRichard Henderson2013-03-051-1/+29
| | | | | | Signed-off-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* mips-linux-user: Delete n32 and n64 signal stubsRichard Henderson2013-03-051-58/+0
| | | | | | | | | | Deleting these first makes the next patch much easier to read. This doesn't cause any sort of compilation failure because we have not yet enabled n32/n64 compilation. This is dead code. Signed-off-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Merge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agrafBlue Swirl2013-01-121-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf: (31 commits) PPC: linux-user: Calculate context pointer explicitly target-ppc: Error out for -cpu host on unknown PVR target-ppc: Slim conversion of model definitions to QOM subclasses PPC: Bring EPR support closer to reality PPC: KVM: set has-idle in guest device tree kvm: Update kernel headers openpic: fix CTPR and de-assertion of interrupts openpic: move IACK to its own function openpic: IRQ_check: search the queue a word at a time openpic: fix sense and priority bits openpic: add some bounds checking for IRQ numbers openpic: use standard bitmap operations Revert "openpic: Accelerate pending irq search" openpic: always call IRQ_check from IRQ_get_next openpic/fsl: critical interrupts ignore mask before v4.1 openpic: make ctpr signed openpic: rework critical interrupt support openpic: make register names correspond better with hw docs ppc/booke: fix crit/mcheck/debug exceptions openpic: lower interrupt when reading the MSI register ...
| * PPC: linux-user: Calculate context pointer explicitlySamuel Seay2013-01-071-1/+1
| | | | | | | | | | | | | | | | | | Peter Maydell recommended the change to be more proper. The result was tested and shows coming up with the same proper value. Signed-off-by: Samuel Seay <LightningTH@GMail.com> [agraf: change subject] Signed-off-by: Alexander Graf <agraf@suse.de>
| * PPC: fix segfault in signal handling codeSamuel Seay2013-01-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Removed h2g() macro around the ka->_sa_handler due to the _sa_handler being a guest memory address. Changed the __put_user to put_user as it was attempting to put a value at the stack address but the new address is a guest memory address, __put_user is for host memory addresses. Signed-off-by: Samuel Seay <LightningTH@GMail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> [agraf: change subject line, reformat commit message] Signed-off-by: Alexander Graf <agraf@suse.de>
* | alpha-linux-user: Fix sigactionRichard Henderson2013-01-121-14/+8
|/ | | | | | | Unconditional bswap replaced by __get_user/__put_user. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* linux-user: Fix siginfo handlingRichard Henderson2012-10-121-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>
* cleanup useless return sentenceAmos Kong2012-10-051-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>
* sparc: fix expression with uninitialized initial valueBlue Swirl2012-08-091-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>
* Replace 'struct siginfo' with 'siginfo_t'.Richard W.M. Jones2012-08-011-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>
* target-or32: Add linux user supportJia Liu2012-07-271-0/+229
| | | | | | | Add QEMU OpenRISC linux user support. Signed-off-by: Jia Liu <proljc@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* qemu-log: cleanupBlue Swirl2012-06-211-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>
* Bad zero comparison for sas_ss_flags on powerpcAlex Barcelo2012-03-151-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>
* Rename CPUState -> CPUArchStateAndreas Färber2012-03-141-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>
* linux-user: Don't overuse CPUStateAndreas Färber2012-03-141-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>
* Spelling fixes in comments (it's -> its)Stefan Weil2012-03-081-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>
* linux-user: Fix sa_flags byte swaps for mipsAndreas Färber2012-02-021-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>
* fix spelling in linux-user sub directoryDong Xu Wang2011-12-021-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>
* Merge remote-tracking branch 'riku/linux-user-for-upstream' into stagingAnthony Liguori2011-10-311-11/+11
|\
| * linux-user: fix abi_(u)long, target_ulong mismatchMatthias Braun2011-10-271-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>
* | target-sparc: Change fpr representation to doubles.Richard Henderson2011-10-261-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>
* linux-user: Remove unused codeStefan Weil2011-10-051-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>
* linux-user: Correct a few missuses of host addressesEdgar E. Iglesias2011-08-261-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>
* linux-user/signal.c: Rename s390 target_ucontext fields to fix ia64Peter Maydell2011-07-131-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>
* linux-user/signal.c: Remove unused fenabPeter Maydell2011-06-211-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>
* linux-user/signal.c: Remove only-ever-set variable fpu_save_addrPeter Maydell2011-06-211-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>
* Don't translate pointer when in restore_sigcontextMike McCormack2011-06-201-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>
* Fix compilation warning due to missing header for sigaction (followup)Alexandre Raymond2011-06-081-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>
* s390x: s390x-linux-user supportUlrich Hecht2011-05-201-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>
* Fix typo in comment (dieing -> dying)Stefan Weil2011-05-081-1/+1
| | | | | Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* linux-user/arm: fix compilation failures using softfloat's struct typesPeter Maydell2011-02-101-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>
* linux-user: avoid gcc array overrun warning for sparcPeter Maydell2011-02-011-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>
* linux-user: ARM: clear the IT bits when invoking a signal handlerPeter Maydell2011-01-141-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>
* ARM: linux-user: Restore iWMMXT state from ucontext on sigreturnPeter Maydell2010-12-031-0/+30
| | | | | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
* ARM: linux-user: Expose iWMMXT registers to signal handlersPeter Maydell2010-12-031-0/+37
| | | | | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
* ARM: linux-user: Restore VFP state from ucontext on sigreturnPeter Maydell2010-12-031-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>
* ARM: linux-user: Expose VFP registers to signal handlersPeter Maydell2010-12-031-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>
* ARM: linux-user: Correct size of padding in target_ucontext_v2Peter Maydell2010-12-031-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>
* microblaze: target-ify target_ucontextRichard Henderson2010-11-231-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>
* microblaze: Pass a ucontext * as 3rd sighandler argEdgar E. Iglesias2010-07-231-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>
* microblaze: Correct signal frame setup.Edgar E. Iglesias2010-07-151-1/+2
| | | | | | Pass the context in r7. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* sparc: Fix lazy flag calculation on interrupts, refactorBlue Swirl2010-05-091-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>
* linux-user/ia64: workaround ia64 strangenessesAurelien Jarno2010-04-011-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.
* Replace assert(0) with abort() or cpu_abort()Blue Swirl2010-03-181-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>
* Fix build with -DNDEBUG in CFLAGSBlue Swirl2010-03-131-1/+1
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* linux-user: Save/restore fpu registers to signal context on sh4takasi-y@ops.dti.ne.jp2010-03-061-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>
* alpha-linux-user: Implement signals.Richard Henderson2010-02-281-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>
OpenPOWER on IntegriCloud