mirror of https://github.com/xemu-project/xemu.git
linux-user/nios2: Use QEMU_ESIGRETURN from do_rt_sigreturn
Drop the kernel-specific "pr2" code structure and use the qemu-specific error return value. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220421151735.31996-8-richard.henderson@linaro.org>
This commit is contained in:
parent
dfb810bcaa
commit
1b5fb4d252
|
@ -77,8 +77,7 @@ static void rt_setup_ucontext(struct target_ucontext *uc, CPUNios2State *env)
|
||||||
__put_user(env->regs[R_SP], &gregs[28]);
|
__put_user(env->regs[R_SP], &gregs[28]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rt_restore_ucontext(CPUNios2State *env, struct target_ucontext *uc,
|
static int rt_restore_ucontext(CPUNios2State *env, struct target_ucontext *uc)
|
||||||
int *pr2)
|
|
||||||
{
|
{
|
||||||
int temp;
|
int temp;
|
||||||
unsigned long *gregs = uc->tuc_mcontext.gregs;
|
unsigned long *gregs = uc->tuc_mcontext.gregs;
|
||||||
|
@ -128,8 +127,6 @@ static int rt_restore_ucontext(CPUNios2State *env, struct target_ucontext *uc,
|
||||||
__get_user(env->regs[R_SP], &gregs[28]);
|
__get_user(env->regs[R_SP], &gregs[28]);
|
||||||
|
|
||||||
target_restore_altstack(&uc->tuc_stack, env);
|
target_restore_altstack(&uc->tuc_stack, env);
|
||||||
|
|
||||||
*pr2 = env->regs[2];
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +188,6 @@ long do_rt_sigreturn(CPUNios2State *env)
|
||||||
abi_ulong frame_addr = env->regs[R_SP];
|
abi_ulong frame_addr = env->regs[R_SP];
|
||||||
struct target_rt_sigframe *frame;
|
struct target_rt_sigframe *frame;
|
||||||
sigset_t set;
|
sigset_t set;
|
||||||
int rval;
|
|
||||||
|
|
||||||
if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) {
|
if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) {
|
||||||
goto badframe;
|
goto badframe;
|
||||||
|
@ -200,15 +196,15 @@ long do_rt_sigreturn(CPUNios2State *env)
|
||||||
target_to_host_sigset(&set, &frame->uc.tuc_sigmask);
|
target_to_host_sigset(&set, &frame->uc.tuc_sigmask);
|
||||||
set_sigmask(&set);
|
set_sigmask(&set);
|
||||||
|
|
||||||
if (rt_restore_ucontext(env, &frame->uc, &rval)) {
|
if (rt_restore_ucontext(env, &frame->uc)) {
|
||||||
goto badframe;
|
goto badframe;
|
||||||
}
|
}
|
||||||
|
|
||||||
unlock_user_struct(frame, frame_addr, 0);
|
unlock_user_struct(frame, frame_addr, 0);
|
||||||
return rval;
|
return -QEMU_ESIGRETURN;
|
||||||
|
|
||||||
badframe:
|
badframe:
|
||||||
unlock_user_struct(frame, frame_addr, 0);
|
unlock_user_struct(frame, frame_addr, 0);
|
||||||
force_sig(TARGET_SIGSEGV);
|
force_sig(TARGET_SIGSEGV);
|
||||||
return 0;
|
return -QEMU_ESIGRETURN;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue