aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@mips.com>2018-08-01 16:12:42 -0400
committerPaul Burton <paul.burton@mips.com>2018-08-01 16:20:15 -0400
commit96a68b14db358c310e1c5cc5229752845192c1fa (patch)
tree2ba8dc7a1f0621597b4169ac88743bcd45028292 /arch/mips/kernel
parent84a7f564fa14bf4713240f614c0b9a18730418fa (diff)
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
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r--arch/mips/kernel/signal.c24
-rw-r--r--arch/mips/kernel/signal_n32.c12
-rw-r--r--arch/mips/kernel/signal_o32.c24
3 files changed, 35 insertions, 25 deletions
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 00f2535d2226..ed6023a74f77 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -592,13 +592,15 @@ SYSCALL_DEFINE3(sigaction, int, sig, const struct sigaction __user *, act,
592#endif 592#endif
593 593
594#ifdef CONFIG_TRAD_SIGNALS 594#ifdef CONFIG_TRAD_SIGNALS
595asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs) 595asmlinkage void sys_sigreturn(void)
596{ 596{
597 struct sigframe __user *frame; 597 struct sigframe __user *frame;
598 struct pt_regs *regs;
598 sigset_t blocked; 599 sigset_t blocked;
599 int sig; 600 int sig;
600 601
601 frame = (struct sigframe __user *) regs.regs[29]; 602 regs = current_pt_regs();
603 frame = (struct sigframe __user *)regs->regs[29];
602 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 604 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
603 goto badframe; 605 goto badframe;
604 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) 606 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)
606 608
607 set_current_blocked(&blocked); 609 set_current_blocked(&blocked);
608 610
609 sig = restore_sigcontext(&regs, &frame->sf_sc); 611 sig = restore_sigcontext(regs, &frame->sf_sc);
610 if (sig < 0) 612 if (sig < 0)
611 goto badframe; 613 goto badframe;
612 else if (sig) 614 else if (sig)
@@ -618,8 +620,8 @@ asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs)
618 __asm__ __volatile__( 620 __asm__ __volatile__(
619 "move\t$29, %0\n\t" 621 "move\t$29, %0\n\t"
620 "j\tsyscall_exit" 622 "j\tsyscall_exit"
621 :/* no outputs */ 623 : /* no outputs */
622 :"r" (&regs)); 624 : "r" (regs));
623 /* Unreached */ 625 /* Unreached */
624 626
625badframe: 627badframe:
@@ -627,13 +629,15 @@ badframe:
627} 629}
628#endif /* CONFIG_TRAD_SIGNALS */ 630#endif /* CONFIG_TRAD_SIGNALS */
629 631
630asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 632asmlinkage void sys_rt_sigreturn(void)
631{ 633{
632 struct rt_sigframe __user *frame; 634 struct rt_sigframe __user *frame;
635 struct pt_regs *regs;
633 sigset_t set; 636 sigset_t set;
634 int sig; 637 int sig;
635 638
636 frame = (struct rt_sigframe __user *) regs.regs[29]; 639 regs = current_pt_regs();
640 frame = (struct rt_sigframe __user *)regs->regs[29];
637 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 641 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
638 goto badframe; 642 goto badframe;
639 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) 643 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)
641 645
642 set_current_blocked(&set); 646 set_current_blocked(&set);
643 647
644 sig = restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext); 648 sig = restore_sigcontext(regs, &frame->rs_uc.uc_mcontext);
645 if (sig < 0) 649 if (sig < 0)
646 goto badframe; 650 goto badframe;
647 else if (sig) 651 else if (sig)
@@ -656,8 +660,8 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
656 __asm__ __volatile__( 660 __asm__ __volatile__(
657 "move\t$29, %0\n\t" 661 "move\t$29, %0\n\t"
658 "j\tsyscall_exit" 662 "j\tsyscall_exit"
659 :/* no outputs */ 663 : /* no outputs */
660 :"r" (&regs)); 664 : "r" (regs));
661 /* Unreached */ 665 /* Unreached */
662 666
663badframe: 667badframe:
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index b672cebb4a1a..8f65aaf9206d 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -64,13 +64,15 @@ struct rt_sigframe_n32 {
64 struct ucontextn32 rs_uc; 64 struct ucontextn32 rs_uc;
65}; 65};
66 66
67asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 67asmlinkage void sysn32_rt_sigreturn(void)
68{ 68{
69 struct rt_sigframe_n32 __user *frame; 69 struct rt_sigframe_n32 __user *frame;
70 struct pt_regs *regs;
70 sigset_t set; 71 sigset_t set;
71 int sig; 72 int sig;
72 73
73 frame = (struct rt_sigframe_n32 __user *) regs.regs[29]; 74 regs = current_pt_regs();
75 frame = (struct rt_sigframe_n32 __user *)regs->regs[29];
74 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 76 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
75 goto badframe; 77 goto badframe;
76 if (__copy_conv_sigset_from_user(&set, &frame->rs_uc.uc_sigmask)) 78 if (__copy_conv_sigset_from_user(&set, &frame->rs_uc.uc_sigmask))
@@ -78,7 +80,7 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
78 80
79 set_current_blocked(&set); 81 set_current_blocked(&set);
80 82
81 sig = restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext); 83 sig = restore_sigcontext(regs, &frame->rs_uc.uc_mcontext);
82 if (sig < 0) 84 if (sig < 0)
83 goto badframe; 85 goto badframe;
84 else if (sig) 86 else if (sig)
@@ -93,8 +95,8 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
93 __asm__ __volatile__( 95 __asm__ __volatile__(
94 "move\t$29, %0\n\t" 96 "move\t$29, %0\n\t"
95 "j\tsyscall_exit" 97 "j\tsyscall_exit"
96 :/* no outputs */ 98 : /* no outputs */
97 :"r" (&regs)); 99 : "r" (regs));
98 /* Unreached */ 100 /* Unreached */
99 101
100badframe: 102badframe:
diff --git a/arch/mips/kernel/signal_o32.c b/arch/mips/kernel/signal_o32.c
index 2b3572fb5f1b..b6e3ddef48a0 100644
--- a/arch/mips/kernel/signal_o32.c
+++ b/arch/mips/kernel/signal_o32.c
@@ -151,13 +151,15 @@ static int setup_frame_32(void *sig_return, struct ksignal *ksig,
151 return 0; 151 return 0;
152} 152}
153 153
154asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 154asmlinkage void sys32_rt_sigreturn(void)
155{ 155{
156 struct rt_sigframe32 __user *frame; 156 struct rt_sigframe32 __user *frame;
157 struct pt_regs *regs;
157 sigset_t set; 158 sigset_t set;
158 int sig; 159 int sig;
159 160
160 frame = (struct rt_sigframe32 __user *) regs.regs[29]; 161 regs = current_pt_regs();
162 frame = (struct rt_sigframe32 __user *)regs->regs[29];
161 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 163 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
162 goto badframe; 164 goto badframe;
163 if (__copy_conv_sigset_from_user(&set, &frame->rs_uc.uc_sigmask)) 165 if (__copy_conv_sigset_from_user(&set, &frame->rs_uc.uc_sigmask))
@@ -165,7 +167,7 @@ asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
165 167
166 set_current_blocked(&set); 168 set_current_blocked(&set);
167 169
168 sig = restore_sigcontext32(&regs, &frame->rs_uc.uc_mcontext); 170 sig = restore_sigcontext32(regs, &frame->rs_uc.uc_mcontext);
169 if (sig < 0) 171 if (sig < 0)
170 goto badframe; 172 goto badframe;
171 else if (sig) 173 else if (sig)
@@ -180,8 +182,8 @@ asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
180 __asm__ __volatile__( 182 __asm__ __volatile__(
181 "move\t$29, %0\n\t" 183 "move\t$29, %0\n\t"
182 "j\tsyscall_exit" 184 "j\tsyscall_exit"
183 :/* no outputs */ 185 : /* no outputs */
184 :"r" (&regs)); 186 : "r" (regs));
185 /* Unreached */ 187 /* Unreached */
186 188
187badframe: 189badframe:
@@ -251,13 +253,15 @@ struct mips_abi mips_abi_32 = {
251}; 253};
252 254
253 255
254asmlinkage void sys32_sigreturn(nabi_no_regargs struct pt_regs regs) 256asmlinkage void sys32_sigreturn(void)
255{ 257{
256 struct sigframe32 __user *frame; 258 struct sigframe32 __user *frame;
259 struct pt_regs *regs;
257 sigset_t blocked; 260 sigset_t blocked;
258 int sig; 261 int sig;
259 262
260 frame = (struct sigframe32 __user *) regs.regs[29]; 263 regs = current_pt_regs();
264 frame = (struct sigframe32 __user *)regs->regs[29];
261 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 265 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
262 goto badframe; 266 goto badframe;
263 if (__copy_conv_sigset_from_user(&blocked, &frame->sf_mask)) 267 if (__copy_conv_sigset_from_user(&blocked, &frame->sf_mask))
@@ -265,7 +269,7 @@ asmlinkage void sys32_sigreturn(nabi_no_regargs struct pt_regs regs)
265 269
266 set_current_blocked(&blocked); 270 set_current_blocked(&blocked);
267 271
268 sig = restore_sigcontext32(&regs, &frame->sf_sc); 272 sig = restore_sigcontext32(regs, &frame->sf_sc);
269 if (sig < 0) 273 if (sig < 0)
270 goto badframe; 274 goto badframe;
271 else if (sig) 275 else if (sig)
@@ -277,8 +281,8 @@ asmlinkage void sys32_sigreturn(nabi_no_regargs struct pt_regs regs)
277 __asm__ __volatile__( 281 __asm__ __volatile__(
278 "move\t$29, %0\n\t" 282 "move\t$29, %0\n\t"
279 "j\tsyscall_exit" 283 "j\tsyscall_exit"
280 :/* no outputs */ 284 : /* no outputs */
281 :"r" (&regs)); 285 : "r" (regs));
282 /* Unreached */ 286 /* Unreached */
283 287
284badframe: 288badframe: