summaryrefslogtreecommitdiffstats
path: root/linux-user/hexagon/signal.c
diff options
context:
space:
mode:
authorRichard Henderson2021-09-29 15:05:35 +0200
committerLaurent Vivier2021-10-01 12:03:48 +0200
commitc8ef02b1acf0d78e909c6cbd38ed60ecc5ce52ff (patch)
tree66e941e101ebd134ba9545cfb59743ac27ca4c5a /linux-user/hexagon/signal.c
parentlinux-user/cris: Implement setup_sigtramp (diff)
downloadqemu-c8ef02b1acf0d78e909c6cbd38ed60ecc5ce52ff.tar.gz
qemu-c8ef02b1acf0d78e909c6cbd38ed60ecc5ce52ff.tar.xz
qemu-c8ef02b1acf0d78e909c6cbd38ed60ecc5ce52ff.zip
linux-user/hexagon: Implement setup_sigtramp
Continue to initialize the words on the stack, as documented. However, use the off-stack trampoline. Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210929130553.121567-9-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/hexagon/signal.c')
-rw-r--r--linux-user/hexagon/signal.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/linux-user/hexagon/signal.c b/linux-user/hexagon/signal.c
index c7f0bf6b92..74e61739a0 100644
--- a/linux-user/hexagon/signal.c
+++ b/linux-user/hexagon/signal.c
@@ -162,6 +162,11 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
setup_ucontext(&frame->uc, env, set);
tswap_siginfo(&frame->info, info);
+ /*
+ * The on-stack signal trampoline is no longer executed;
+ * however, the libgcc signal frame unwinding code checks
+ * for the presence of these two numeric magic values.
+ */
install_sigtramp(frame->tramp);
env->gpr[HEX_REG_PC] = ka->_sa_handler;
@@ -171,8 +176,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
frame_addr + offsetof(struct target_rt_sigframe, info);
env->gpr[HEX_REG_R02] =
frame_addr + offsetof(struct target_rt_sigframe, uc);
- env->gpr[HEX_REG_LR] =
- frame_addr + offsetof(struct target_rt_sigframe, tramp);
+ env->gpr[HEX_REG_LR] = default_rt_sigreturn;
return;
@@ -271,3 +275,14 @@ badframe:
force_sig(TARGET_SIGSEGV);
return 0;
}
+
+void setup_sigtramp(abi_ulong sigtramp_page)
+{
+ uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 4 * 2, 0);
+ assert(tramp != NULL);
+
+ default_rt_sigreturn = sigtramp_page;
+ install_sigtramp(tramp);
+
+ unlock_user(tramp, sigtramp_page, 4 * 2);
+}