aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/kernel
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2012-10-23 13:30:54 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-10-23 16:23:58 -0400
commit6b14e4198c729b748a7f6d22059e6a101d2b241a (patch)
tree77668782763f74aec995899e919231e81a71d56a /arch/tile/kernel
parent530550651fdfd548d25b6bd5ff4607803540508b (diff)
arch/tile: eliminate pt_regs trampolines for syscalls
Using the new current_pt_regs() model, we can remove some trampolines from assembly code and call directly to the C syscall implementations. rt_sigreturn() and clone() still need some assembly wrapping, but no longer are passed a pt_regs pointer. sigaltstack() and the tilepro-specific cmpxchg_badaddr() syscalls are now just straight C. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/kernel')
-rw-r--r--arch/tile/kernel/compat.c4
-rw-r--r--arch/tile/kernel/compat_signal.c10
-rw-r--r--arch/tile/kernel/intvec_32.S13
-rw-r--r--arch/tile/kernel/intvec_64.S13
-rw-r--r--arch/tile/kernel/process.c6
-rw-r--r--arch/tile/kernel/signal.c9
-rw-r--r--arch/tile/kernel/sys.c8
7 files changed, 20 insertions, 43 deletions
diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c
index a8e5a847037c..a2e805569d5d 100644
--- a/arch/tile/kernel/compat.c
+++ b/arch/tile/kernel/compat.c
@@ -102,9 +102,9 @@ long compat_sys_sched_rr_get_interval(compat_pid_t pid,
102#define compat_sys_fadvise64_64 sys32_fadvise64_64 102#define compat_sys_fadvise64_64 sys32_fadvise64_64
103#define compat_sys_readahead sys32_readahead 103#define compat_sys_readahead sys32_readahead
104 104
105/* Call the trampolines to manage pt_regs where necessary. */ 105/* Call the assembly trampolines where necessary. */
106#define compat_sys_sigaltstack _compat_sys_sigaltstack
107#define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn 106#define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn
107#undef sys_clone
108#define sys_clone _sys_clone 108#define sys_clone _sys_clone
109 109
110/* 110/*
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c
index 08b4fe1717bb..210a9bbae963 100644
--- a/arch/tile/kernel/compat_signal.c
+++ b/arch/tile/kernel/compat_signal.c
@@ -197,8 +197,7 @@ int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from)
197} 197}
198 198
199long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr, 199long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
200 struct compat_sigaltstack __user *uoss_ptr, 200 struct compat_sigaltstack __user *uoss_ptr)
201 struct pt_regs *regs)
202{ 201{
203 stack_t uss, uoss; 202 stack_t uss, uoss;
204 int ret; 203 int ret;
@@ -219,7 +218,7 @@ long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
219 set_fs(KERNEL_DS); 218 set_fs(KERNEL_DS);
220 ret = do_sigaltstack(uss_ptr ? (stack_t __user __force *)&uss : NULL, 219 ret = do_sigaltstack(uss_ptr ? (stack_t __user __force *)&uss : NULL,
221 (stack_t __user __force *)&uoss, 220 (stack_t __user __force *)&uoss,
222 (unsigned long)compat_ptr(regs->sp)); 221 (unsigned long)compat_ptr(current_pt_regs()->sp));
223 set_fs(seg); 222 set_fs(seg);
224 if (ret >= 0 && uoss_ptr) { 223 if (ret >= 0 && uoss_ptr) {
225 if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(*uoss_ptr)) || 224 if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(*uoss_ptr)) ||
@@ -232,8 +231,9 @@ long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
232} 231}
233 232
234/* The assembly shim for this function arranges to ignore the return value. */ 233/* The assembly shim for this function arranges to ignore the return value. */
235long compat_sys_rt_sigreturn(struct pt_regs *regs) 234long compat_sys_rt_sigreturn(void)
236{ 235{
236 struct pt_regs *regs = current_pt_regs();
237 struct compat_rt_sigframe __user *frame = 237 struct compat_rt_sigframe __user *frame =
238 (struct compat_rt_sigframe __user *) compat_ptr(regs->sp); 238 (struct compat_rt_sigframe __user *) compat_ptr(regs->sp);
239 sigset_t set; 239 sigset_t set;
@@ -248,7 +248,7 @@ long compat_sys_rt_sigreturn(struct pt_regs *regs)
248 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 248 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
249 goto badframe; 249 goto badframe;
250 250
251 if (compat_sys_sigaltstack(&frame->uc.uc_stack, NULL, regs) != 0) 251 if (compat_sys_sigaltstack(&frame->uc.uc_stack, NULL) != 0)
252 goto badframe; 252 goto badframe;
253 253
254 return 0; 254 return 0;
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S
index 174b837ef926..f212bf7cea86 100644
--- a/arch/tile/kernel/intvec_32.S
+++ b/arch/tile/kernel/intvec_32.S
@@ -1452,15 +1452,6 @@ STD_ENTRY_LOCAL(bad_intr)
1452 panic "Unhandled interrupt %#x: PC %#lx" 1452 panic "Unhandled interrupt %#x: PC %#lx"
1453 STD_ENDPROC(bad_intr) 1453 STD_ENDPROC(bad_intr)
1454 1454
1455/* Put address of pt_regs in reg and jump. */
1456#define PTREGS_SYSCALL(x, reg) \
1457 STD_ENTRY(_##x); \
1458 { \
1459 PTREGS_PTR(reg, PTREGS_OFFSET_BASE); \
1460 j x \
1461 }; \
1462 STD_ENDPROC(_##x)
1463
1464/* 1455/*
1465 * Special-case sigreturn to not write r0 to the stack on return. 1456 * Special-case sigreturn to not write r0 to the stack on return.
1466 * This is technically more efficient, but it also avoids difficulties 1457 * This is technically more efficient, but it also avoids difficulties
@@ -1476,11 +1467,9 @@ STD_ENTRY_LOCAL(bad_intr)
1476 }; \ 1467 }; \
1477 STD_ENDPROC(_##x) 1468 STD_ENDPROC(_##x)
1478 1469
1479PTREGS_SYSCALL(sys_sigaltstack, r2)
1480PTREGS_SYSCALL_SIGRETURN(sys_rt_sigreturn, r0) 1470PTREGS_SYSCALL_SIGRETURN(sys_rt_sigreturn, r0)
1481PTREGS_SYSCALL(sys_cmpxchg_badaddr, r1)
1482 1471
1483/* Save additional callee-saves to pt_regs, put address in r4 and jump. */ 1472/* Save additional callee-saves to pt_regs and jump to standard function. */
1484STD_ENTRY(_sys_clone) 1473STD_ENTRY(_sys_clone)
1485 push_extra_callee_saves r4 1474 push_extra_callee_saves r4
1486 j sys_clone 1475 j sys_clone
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S
index 283efedf67d6..54bc9a6678e8 100644
--- a/arch/tile/kernel/intvec_64.S
+++ b/arch/tile/kernel/intvec_64.S
@@ -1181,15 +1181,6 @@ STD_ENTRY_LOCAL(bad_intr)
1181 panic "Unhandled interrupt %#x: PC %#lx" 1181 panic "Unhandled interrupt %#x: PC %#lx"
1182 STD_ENDPROC(bad_intr) 1182 STD_ENDPROC(bad_intr)
1183 1183
1184/* Put address of pt_regs in reg and jump. */
1185#define PTREGS_SYSCALL(x, reg) \
1186 STD_ENTRY(_##x); \
1187 { \
1188 PTREGS_PTR(reg, PTREGS_OFFSET_BASE); \
1189 j x \
1190 }; \
1191 STD_ENDPROC(_##x)
1192
1193/* 1184/*
1194 * Special-case sigreturn to not write r0 to the stack on return. 1185 * Special-case sigreturn to not write r0 to the stack on return.
1195 * This is technically more efficient, but it also avoids difficulties 1186 * This is technically more efficient, but it also avoids difficulties
@@ -1205,14 +1196,12 @@ STD_ENTRY_LOCAL(bad_intr)
1205 }; \ 1196 }; \
1206 STD_ENDPROC(_##x) 1197 STD_ENDPROC(_##x)
1207 1198
1208PTREGS_SYSCALL(sys_sigaltstack, r2)
1209PTREGS_SYSCALL_SIGRETURN(sys_rt_sigreturn, r0) 1199PTREGS_SYSCALL_SIGRETURN(sys_rt_sigreturn, r0)
1210#ifdef CONFIG_COMPAT 1200#ifdef CONFIG_COMPAT
1211PTREGS_SYSCALL(compat_sys_sigaltstack, r2)
1212PTREGS_SYSCALL_SIGRETURN(compat_sys_rt_sigreturn, r0) 1201PTREGS_SYSCALL_SIGRETURN(compat_sys_rt_sigreturn, r0)
1213#endif 1202#endif
1214 1203
1215/* Save additional callee-saves to pt_regs, put address in r4 and jump. */ 1204/* Save additional callee-saves to pt_regs and jump to standard function. */
1216STD_ENTRY(_sys_clone) 1205STD_ENTRY(_sys_clone)
1217 push_extra_callee_saves r4 1206 push_extra_callee_saves r4
1218 j sys_clone 1207 j sys_clone
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c
index 58f8fd1f0bc2..6e7fb4e41f1c 100644
--- a/arch/tile/kernel/process.c
+++ b/arch/tile/kernel/process.c
@@ -584,10 +584,10 @@ int do_work_pending(struct pt_regs *regs, u32 thread_info_flags)
584} 584}
585 585
586/* Note there is an implicit fifth argument if (clone_flags & CLONE_SETTLS). */ 586/* Note there is an implicit fifth argument if (clone_flags & CLONE_SETTLS). */
587SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, 587SYSCALL_DEFINE4(clone, unsigned long, clone_flags, unsigned long, newsp,
588 void __user *, parent_tidptr, void __user *, child_tidptr, 588 void __user *, parent_tidptr, void __user *, child_tidptr)
589 struct pt_regs *, regs)
590{ 589{
590 struct pt_regs *regs = current_pt_regs();
591 if (!newsp) 591 if (!newsp)
592 newsp = regs->sp; 592 newsp = regs->sp;
593 return do_fork(clone_flags, newsp, regs, 0, 593 return do_fork(clone_flags, newsp, regs, 0,
diff --git a/arch/tile/kernel/signal.c b/arch/tile/kernel/signal.c
index 67efb656d104..657a7ace4ab4 100644
--- a/arch/tile/kernel/signal.c
+++ b/arch/tile/kernel/signal.c
@@ -37,10 +37,10 @@
37 37
38#define DEBUG_SIG 0 38#define DEBUG_SIG 0
39 39
40SYSCALL_DEFINE3(sigaltstack, const stack_t __user *, uss, 40SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss,
41 stack_t __user *, uoss, struct pt_regs *, regs) 41 stack_t __user *, uoss)
42{ 42{
43 return do_sigaltstack(uss, uoss, regs->sp); 43 return do_sigaltstack(uss, uoss, current_pt_regs()->sp);
44} 44}
45 45
46 46
@@ -83,8 +83,9 @@ void signal_fault(const char *type, struct pt_regs *regs,
83} 83}
84 84
85/* The assembly shim for this function arranges to ignore the return value. */ 85/* The assembly shim for this function arranges to ignore the return value. */
86SYSCALL_DEFINE1(rt_sigreturn, struct pt_regs *, regs) 86SYSCALL_DEFINE0(rt_sigreturn)
87{ 87{
88 struct pt_regs *regs = current_pt_regs();
88 struct rt_sigframe __user *frame = 89 struct rt_sigframe __user *frame =
89 (struct rt_sigframe __user *)(regs->sp); 90 (struct rt_sigframe __user *)(regs->sp);
90 sigset_t set; 91 sigset_t set;
diff --git a/arch/tile/kernel/sys.c b/arch/tile/kernel/sys.c
index 359e76f68838..02ff5c0ef775 100644
--- a/arch/tile/kernel/sys.c
+++ b/arch/tile/kernel/sys.c
@@ -106,13 +106,11 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
106#define sys_readahead sys32_readahead 106#define sys_readahead sys32_readahead
107#endif 107#endif
108 108
109/* Call the trampolines to manage pt_regs where necessary. */ 109/* Call the assembly trampolines where necessary. */
110#define sys_sigaltstack _sys_sigaltstack 110#undef sys_rt_sigreturn
111#define sys_rt_sigreturn _sys_rt_sigreturn 111#define sys_rt_sigreturn _sys_rt_sigreturn
112#undef sys_clone
112#define sys_clone _sys_clone 113#define sys_clone _sys_clone
113#ifndef __tilegx__
114#define sys_cmpxchg_badaddr _sys_cmpxchg_badaddr
115#endif
116 114
117/* 115/*
118 * Note that we can't include <linux/unistd.h> here since the header 116 * Note that we can't include <linux/unistd.h> here since the header