MIPS: Remove nabi_no_regargs
Our sigreturn functions make use of a macro named nabi_no_regargs to declare 8 dummy arguments to a function, forcing the compiler to expect a pt_regs structure on the stack rather than in argument registers. This is an ugly hack which unnecessarily causes these sigreturn functions to need to care about the calling convention of the ABI the kernel is built for. Although this is abstracted via nabi_no_regargs, it's still ugly & unnecessary. Remove nabi_no_regargs & the struct pt_regs argument from sigreturn functions, and instead use current_pt_regs() to find the struct pt_regs on the stack, which works cleanly regardless of ABI. Signed-off-by: Paul Burton <paul.burton@mips.com> Patchwork: https://patchwork.linux-mips.org/patch/20106/ Cc: James Hogan <jhogan@kernel.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: linux-mips@linux-mips.org
This commit is contained in:
@@ -592,13 +592,15 @@ SYSCALL_DEFINE3(sigaction, int, sig, const struct sigaction __user *, act,
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TRAD_SIGNALS
|
||||
asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs)
|
||||
asmlinkage void sys_sigreturn(void)
|
||||
{
|
||||
struct sigframe __user *frame;
|
||||
struct pt_regs *regs;
|
||||
sigset_t blocked;
|
||||
int sig;
|
||||
|
||||
frame = (struct sigframe __user *) regs.regs[29];
|
||||
regs = current_pt_regs();
|
||||
frame = (struct sigframe __user *)regs->regs[29];
|
||||
if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
|
||||
goto badframe;
|
||||
if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked)))
|
||||
@@ -606,7 +608,7 @@ asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs)
|
||||
|
||||
set_current_blocked(&blocked);
|
||||
|
||||
sig = restore_sigcontext(®s, &frame->sf_sc);
|
||||
sig = restore_sigcontext(regs, &frame->sf_sc);
|
||||
if (sig < 0)
|
||||
goto badframe;
|
||||
else if (sig)
|
||||
@@ -618,8 +620,8 @@ asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs)
|
||||
__asm__ __volatile__(
|
||||
"move\t$29, %0\n\t"
|
||||
"j\tsyscall_exit"
|
||||
:/* no outputs */
|
||||
:"r" (®s));
|
||||
: /* no outputs */
|
||||
: "r" (regs));
|
||||
/* Unreached */
|
||||
|
||||
badframe:
|
||||
@@ -627,13 +629,15 @@ badframe:
|
||||
}
|
||||
#endif /* CONFIG_TRAD_SIGNALS */
|
||||
|
||||
asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
|
||||
asmlinkage void sys_rt_sigreturn(void)
|
||||
{
|
||||
struct rt_sigframe __user *frame;
|
||||
struct pt_regs *regs;
|
||||
sigset_t set;
|
||||
int sig;
|
||||
|
||||
frame = (struct rt_sigframe __user *) regs.regs[29];
|
||||
regs = current_pt_regs();
|
||||
frame = (struct rt_sigframe __user *)regs->regs[29];
|
||||
if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
|
||||
goto badframe;
|
||||
if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
|
||||
@@ -641,7 +645,7 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
|
||||
|
||||
set_current_blocked(&set);
|
||||
|
||||
sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext);
|
||||
sig = restore_sigcontext(regs, &frame->rs_uc.uc_mcontext);
|
||||
if (sig < 0)
|
||||
goto badframe;
|
||||
else if (sig)
|
||||
@@ -656,8 +660,8 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
|
||||
__asm__ __volatile__(
|
||||
"move\t$29, %0\n\t"
|
||||
"j\tsyscall_exit"
|
||||
:/* no outputs */
|
||||
:"r" (®s));
|
||||
: /* no outputs */
|
||||
: "r" (regs));
|
||||
/* Unreached */
|
||||
|
||||
badframe:
|
||||
|
Reference in New Issue
Block a user