diff options
author | Michael Matz <matz@suse.de> | 2014-03-02 19:36:39 +0000 |
---|---|---|
committer | Riku Voipio <riku.voipio@linaro.org> | 2014-03-03 23:03:16 +0200 |
commit | 8a3ae9109eb45dd77b182a4953ef9e636f665296 (patch) | |
tree | 865653302cc4556a34cecbe9f4461855225b43af /linux-user/signal.c | |
parent | 4cf2348026002d64556f89d0971c663311be2525 (diff) | |
download | qemu-8a3ae9109eb45dd77b182a4953ef9e636f665296.zip |
linux-user: AArch64: Implement SA_RESTORER for signal handlers
Implement support for signal handlers with the SA_RESTORER
flag set.
Signed-off-by: Michael Matz <matz@suse.de>
[PMM: minor tweaks to make patch apply to current master]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'linux-user/signal.c')
-rw-r--r-- | linux-user/signal.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/linux-user/signal.c b/linux-user/signal.c index 29734b2c52..c8a1da0749 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -1273,7 +1273,7 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, CPUARMState *env) { struct target_rt_sigframe *frame; - abi_ulong frame_addr; + abi_ulong frame_addr, return_addr; frame_addr = get_sigframe(ka, env); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { @@ -1290,15 +1290,19 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, __put_user(target_sigaltstack_used.ss_size, &frame->uc.tuc_stack.ss_size); target_setup_sigframe(frame, env, set); - /* mov x8,#__NR_rt_sigreturn; svc #0 */ - __put_user(0xd2801168, &frame->tramp[0]); - __put_user(0xd4000001, &frame->tramp[1]); + if (ka->sa_flags & TARGET_SA_RESTORER) { + return_addr = ka->sa_restorer; + } else { + /* mov x8,#__NR_rt_sigreturn; svc #0 */ + __put_user(0xd2801168, &frame->tramp[0]); + __put_user(0xd4000001, &frame->tramp[1]); + return_addr = frame_addr + offsetof(struct target_rt_sigframe, tramp); + } env->xregs[0] = usig; env->xregs[31] = frame_addr; env->xregs[29] = env->xregs[31] + offsetof(struct target_rt_sigframe, fp); env->pc = ka->_sa_handler; - env->xregs[30] = env->xregs[31] + - offsetof(struct target_rt_sigframe, tramp); + env->xregs[30] = return_addr; if (info) { if (copy_siginfo_to_user(&frame->info, info)) { goto give_sigsegv; |