diff options
author | Laurent Vivier <laurent@vivier.eu> | 2018-04-11 21:23:47 +0200 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2018-05-03 18:29:15 +0200 |
commit | 465e237bf7cb6a9d8f9f137508125a14efcce1d6 (patch) | |
tree | 1eaf5f3576d7f080b2a664466582975ae81ae986 /linux-user/arm/signal.c | |
parent | e8fa72957419c11984608062c7dcb204a6003a06 (diff) |
linux-user: introduce target_sigsp() and target_save_altstack()
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20180411192347.30228-1-laurent@vivier.eu>
Diffstat (limited to 'linux-user/arm/signal.c')
-rw-r--r-- | linux-user/arm/signal.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c index eb72be5dd0..59b5b65ed1 100644 --- a/linux-user/arm/signal.c +++ b/linux-user/arm/signal.c @@ -201,14 +201,9 @@ setup_sigcontext(struct target_sigcontext *sc, /*struct _fpstate *fpstate,*/ static inline abi_ulong get_sigframe(struct target_sigaction *ka, CPUARMState *regs, int framesize) { - unsigned long sp = regs->regs[13]; + unsigned long sp; - /* - * This is the X/Open sanctioned signal stack switching. - */ - if ((ka->sa_flags & TARGET_SA_ONSTACK) && !sas_ss_flags(sp)) { - sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size; - } + sp = target_sigsp(get_sp_from_cpustate(regs), ka); /* * ATPCS B01 mandates 8-byte alignment */ @@ -346,9 +341,7 @@ static void setup_sigframe_v2(struct target_ucontext_v2 *uc, memset(uc, 0, offsetof(struct target_ucontext_v2, tuc_mcontext)); memset(&stack, 0, sizeof(stack)); - __put_user(target_sigaltstack_used.ss_sp, &stack.ss_sp); - __put_user(target_sigaltstack_used.ss_size, &stack.ss_size); - __put_user(sas_ss_flags(get_sp_from_cpustate(env)), &stack.ss_flags); + target_save_altstack(&stack, env); memcpy(&uc->tuc_stack, &stack, sizeof(stack)); setup_sigcontext(&uc->tuc_mcontext, env, set->sig[0]); @@ -461,9 +454,7 @@ static void setup_rt_frame_v1(int usig, struct target_sigaction *ka, memset(&frame->uc, 0, offsetof(struct target_ucontext_v1, tuc_mcontext)); memset(&stack, 0, sizeof(stack)); - __put_user(target_sigaltstack_used.ss_sp, &stack.ss_sp); - __put_user(target_sigaltstack_used.ss_size, &stack.ss_size); - __put_user(sas_ss_flags(get_sp_from_cpustate(env)), &stack.ss_flags); + target_save_altstack(&stack, env); memcpy(&frame->uc.tuc_stack, &stack, sizeof(stack)); setup_sigcontext(&frame->uc.tuc_mcontext, env, set->sig[0]); |