mirror of https://gitee.com/openkylin/qemu.git
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>
This commit is contained in:
parent
3c62b5d201
commit
31330e6cec
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue