@@ -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);
+}
@@ -31,4 +31,6 @@ typedef struct target_sigaltstack {
#include "../generic/signal.h"
+#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
+
#endif /* TARGET_SIGNAL_H */