diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2021-09-29 09:05:48 -0400 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2021-10-01 12:03:48 +0200 |
commit | 31330e6cecfdf2c4617ecb95c7e2804a8dae2488 (patch) | |
tree | 7cdc8b9877fba29edb26ecc84d7fccc97417994a | |
parent | 3c62b5d2015b8292d4453f8174abf5fadbc6cc0f (diff) | |
download | qemu-31330e6cecfdf2c4617ecb95c7e2804a8dae2488.zip qemu-31330e6cecfdf2c4617ecb95c7e2804a8dae2488.tar.gz qemu-31330e6cecfdf2c4617ecb95c7e2804a8dae2488.tar.bz2 |
linux-user/s390x: Implement setup_sigtramp
Create and record the two signal trampolines.
Use them when the guest does not use SA_RESTORER.
Cc: qemu-s390x@nongnu.org
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210929130553.121567-22-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
-rw-r--r-- | linux-user/s390x/signal.c | 24 | ||||
-rw-r--r-- | linux-user/s390x/target_signal.h | 2 |
2 files changed, 18 insertions, 8 deletions
diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 80f3408..676b948 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -68,7 +68,6 @@ typedef struct { target_sigregs sregs; int signo; target_sigregs_ext sregs_ext; - uint16_t retcode; } sigframe; #define TARGET_UC_VXRS 2 @@ -85,7 +84,6 @@ struct target_ucontext { typedef struct { uint8_t callee_used_stack[__SIGNAL_FRAMESIZE]; - uint16_t retcode; struct target_siginfo info; struct target_ucontext uc; } rt_sigframe; @@ -209,9 +207,7 @@ void setup_frame(int sig, struct target_sigaction *ka, if (ka->sa_flags & TARGET_SA_RESTORER) { restorer = ka->sa_restorer; } else { - restorer = frame_addr + offsetof(sigframe, retcode); - __put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn, - &frame->retcode); + restorer = default_sigreturn; } /* Set up registers for signal handler */ @@ -262,9 +258,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, if (ka->sa_flags & TARGET_SA_RESTORER) { restorer = ka->sa_restorer; } else { - restorer = frame_addr + offsetof(typeof(*frame), retcode); - __put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn, - &frame->retcode); + restorer = default_rt_sigreturn; } /* Create siginfo on the signal stack. */ @@ -405,3 +399,17 @@ long do_rt_sigreturn(CPUS390XState *env) unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint16_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 2 + 2, 0); + assert(tramp != NULL); + + default_sigreturn = sigtramp_page; + __put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn, &tramp[0]); + + default_rt_sigreturn = sigtramp_page + 2; + __put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn, &tramp[1]); + + unlock_user(tramp, sigtramp_page, 2 + 2); +} diff --git a/linux-user/s390x/target_signal.h b/linux-user/s390x/target_signal.h index bbfc464..64f5f42 100644 --- a/linux-user/s390x/target_signal.h +++ b/linux-user/s390x/target_signal.h @@ -19,4 +19,6 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" #define TARGET_ARCH_HAS_SETUP_FRAME +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif /* S390X_TARGET_SIGNAL_H */ |