From 465e237bf7cb6a9d8f9f137508125a14efcce1d6 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Wed, 11 Apr 2018 21:23:47 +0200 Subject: linux-user: introduce target_sigsp() and target_save_altstack() Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson Message-Id: <20180411192347.30228-1-laurent@vivier.eu> --- linux-user/alpha/signal.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'linux-user/alpha') diff --git a/linux-user/alpha/signal.c b/linux-user/alpha/signal.c index a8c718f2c6..f24de02c6f 100644 --- a/linux-user/alpha/signal.c +++ b/linux-user/alpha/signal.c @@ -117,12 +117,10 @@ static inline abi_ulong get_sigframe(struct target_sigaction *sa, CPUAlphaState *env, unsigned long framesize) { - abi_ulong sp = env->ir[IR_SP]; + abi_ulong sp; + + sp = target_sigsp(get_sp_from_cpustate(env), sa); - /* This is the X/Open sanctioned signal stack switching. */ - if ((sa->sa_flags & TARGET_SA_ONSTACK) != 0 && !sas_ss_flags(sp)) { - sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size; - } return (sp - framesize) & -32; } @@ -187,12 +185,9 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, __put_user(0, &frame->uc.tuc_flags); __put_user(0, &frame->uc.tuc_link); __put_user(set->sig[0], &frame->uc.tuc_osf_sigmask); - __put_user(target_sigaltstack_used.ss_sp, - &frame->uc.tuc_stack.ss_sp); - __put_user(sas_ss_flags(env->ir[IR_SP]), - &frame->uc.tuc_stack.ss_flags); - __put_user(target_sigaltstack_used.ss_size, - &frame->uc.tuc_stack.ss_size); + + target_save_altstack(&frame->uc.tuc_stack, env); + setup_sigcontext(&frame->uc.tuc_mcontext, env, frame_addr, set); for (i = 0; i < TARGET_NSIG_WORDS; ++i) { __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]); -- cgit v1.2.3