aboutsummaryrefslogtreecommitdiff
path: root/linux-user/microblaze
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-09-29 09:05:40 -0400
committerLaurent Vivier <laurent@vivier.eu>2021-10-01 12:03:48 +0200
commit8004316d81c15681143c3b8d5e77f911b08cfc8b (patch)
treede0a129ef7b46158612e2fc23a94fcc45bdd986f /linux-user/microblaze
parent5125aced7cd291ba232944bf980612f905e524a0 (diff)
downloadqemu-8004316d81c15681143c3b8d5e77f911b08cfc8b.zip
qemu-8004316d81c15681143c3b8d5e77f911b08cfc8b.tar.gz
qemu-8004316d81c15681143c3b8d5e77f911b08cfc8b.tar.bz2
linux-user/microblaze: Implement setup_sigtramp
Create and record the rt signal trampoline. Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210929130553.121567-14-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/microblaze')
-rw-r--r--linux-user/microblaze/signal.c24
-rw-r--r--linux-user/microblaze/target_signal.h2
2 files changed, 19 insertions, 7 deletions
diff --git a/linux-user/microblaze/signal.c b/linux-user/microblaze/signal.c
index b822679..8ebb6a1 100644
--- a/linux-user/microblaze/signal.c
+++ b/linux-user/microblaze/signal.c
@@ -161,17 +161,11 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
/* Kernel does not use SA_RESTORER. */
- /* addi r12, r0, __NR_sigreturn */
- __put_user(0x31800000U | TARGET_NR_rt_sigreturn, frame->tramp + 0);
- /* brki r14, 0x8 */
- __put_user(0xb9cc0008U, frame->tramp + 1);
-
/*
* Return from sighandler will jump to the tramp.
* Negative 8 offset because return is rtsd r15, 8
*/
- env->regs[15] =
- frame_addr + offsetof(struct target_rt_sigframe, tramp) - 8;
+ env->regs[15] = default_rt_sigreturn - 8;
/* Set up registers for signal handler */
env->regs[1] = frame_addr;
@@ -220,3 +214,19 @@ long do_rt_sigreturn(CPUMBState *env)
force_sig(TARGET_SIGSEGV);
return -TARGET_QEMU_ESIGRETURN;
}
+
+void setup_sigtramp(abi_ulong sigtramp_page)
+{
+ uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 8, 0);
+ assert(tramp != NULL);
+
+ /*
+ * addi r12, r0, __NR_rt_sigreturn
+ * brki r14, 0x8
+ */
+ __put_user(0x31800000U | TARGET_NR_rt_sigreturn, tramp);
+ __put_user(0xb9cc0008U, tramp + 1);
+
+ default_rt_sigreturn = sigtramp_page;
+ unlock_user(tramp, sigtramp_page, 8);
+}
diff --git a/linux-user/microblaze/target_signal.h b/linux-user/microblaze/target_signal.h
index 1c32629..e8b510f 100644
--- a/linux-user/microblaze/target_signal.h
+++ b/linux-user/microblaze/target_signal.h
@@ -21,4 +21,6 @@ typedef struct target_sigaltstack {
#include "../generic/signal.h"
+#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
+
#endif /* MICROBLAZE_TARGET_SIGNAL_H */