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>
This commit is contained in:
parent
5125aced7c
commit
8004316d81
@ -161,17 +161,11 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
|
|||||||
|
|
||||||
/* Kernel does not use SA_RESTORER. */
|
/* 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.
|
* Return from sighandler will jump to the tramp.
|
||||||
* Negative 8 offset because return is rtsd r15, 8
|
* Negative 8 offset because return is rtsd r15, 8
|
||||||
*/
|
*/
|
||||||
env->regs[15] =
|
env->regs[15] = default_rt_sigreturn - 8;
|
||||||
frame_addr + offsetof(struct target_rt_sigframe, tramp) - 8;
|
|
||||||
|
|
||||||
/* Set up registers for signal handler */
|
/* Set up registers for signal handler */
|
||||||
env->regs[1] = frame_addr;
|
env->regs[1] = frame_addr;
|
||||||
@ -220,3 +214,19 @@ long do_rt_sigreturn(CPUMBState *env)
|
|||||||
force_sig(TARGET_SIGSEGV);
|
force_sig(TARGET_SIGSEGV);
|
||||||
return -TARGET_QEMU_ESIGRETURN;
|
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);
|
||||||
|
}
|
||||||
|
@ -21,4 +21,6 @@ typedef struct target_sigaltstack {
|
|||||||
|
|
||||||
#include "../generic/signal.h"
|
#include "../generic/signal.h"
|
||||||
|
|
||||||
|
#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
|
||||||
|
|
||||||
#endif /* MICROBLAZE_TARGET_SIGNAL_H */
|
#endif /* MICROBLAZE_TARGET_SIGNAL_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user