aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-12-27 12:11:46 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-03 18:33:02 -0500
commit50150d2bb9033de8a4d94b3feb2dfed81a605ed5 (patch)
tree038a165e4fd33f8f27713bb61a39d20da1c7b450
parent64b3122df48b81a40366a11f299ab819138c96e8 (diff)
mips: switch to generic sys_fork() and sys_clone()
we still need the wrappers to store callee-saved registers in pt_regs, but once that done we can jump to kernel/fork.c variants. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--arch/mips/Kconfig1
-rw-r--r--arch/mips/include/asm/sim.h24
-rw-r--r--arch/mips/include/asm/unistd.h2
-rw-r--r--arch/mips/kernel/linux32.c19
-rw-r--r--arch/mips/kernel/scall32-o32.S4
-rw-r--r--arch/mips/kernel/scall64-64.S4
-rw-r--r--arch/mips/kernel/scall64-n32.S4
-rw-r--r--arch/mips/kernel/scall64-o32.S4
-rw-r--r--arch/mips/kernel/syscall.c34
9 files changed, 23 insertions, 73 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 7352acfe70b7..0772b5c5bc72 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -41,6 +41,7 @@ config MIPS
41 select HAVE_MOD_ARCH_SPECIFIC 41 select HAVE_MOD_ARCH_SPECIFIC
42 select MODULES_USE_ELF_REL if MODULES 42 select MODULES_USE_ELF_REL if MODULES
43 select MODULES_USE_ELF_RELA if MODULES && 64BIT 43 select MODULES_USE_ELF_RELA if MODULES && 64BIT
44 select CLONE_BACKWARDS
44 select GENERIC_SIGALTSTACK 45 select GENERIC_SIGALTSTACK
45 select GENERIC_COMPAT_RT_SIGACTION 46 select GENERIC_COMPAT_RT_SIGACTION
46 select GENERIC_COMPAT_RT_SIGQUEUEINFO 47 select GENERIC_COMPAT_RT_SIGQUEUEINFO
diff --git a/arch/mips/include/asm/sim.h b/arch/mips/include/asm/sim.h
index 0cd719fabb51..91831800c480 100644
--- a/arch/mips/include/asm/sim.h
+++ b/arch/mips/include/asm/sim.h
@@ -20,10 +20,10 @@
20#define save_static_function(symbol) \ 20#define save_static_function(symbol) \
21__asm__( \ 21__asm__( \
22 ".text\n\t" \ 22 ".text\n\t" \
23 ".globl\t" #symbol "\n\t" \ 23 ".globl\t__" #symbol "\n\t" \
24 ".align\t2\n\t" \ 24 ".align\t2\n\t" \
25 ".type\t" #symbol ", @function\n\t" \ 25 ".type\t__" #symbol ", @function\n\t" \
26 ".ent\t" #symbol ", 0\n" \ 26 ".ent\t__" #symbol ", 0\n__" \
27 #symbol":\n\t" \ 27 #symbol":\n\t" \
28 ".frame\t$29, 0, $31\n\t" \ 28 ".frame\t$29, 0, $31\n\t" \
29 "sw\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \ 29 "sw\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \
@@ -35,9 +35,9 @@ __asm__( \
35 "sw\t$22,"__str(PT_R22)"($29)\n\t" \ 35 "sw\t$22,"__str(PT_R22)"($29)\n\t" \
36 "sw\t$23,"__str(PT_R23)"($29)\n\t" \ 36 "sw\t$23,"__str(PT_R23)"($29)\n\t" \
37 "sw\t$30,"__str(PT_R30)"($29)\n\t" \ 37 "sw\t$30,"__str(PT_R30)"($29)\n\t" \
38 "j\t_" #symbol "\n\t" \ 38 "j\t" #symbol "\n\t" \
39 ".end\t" #symbol "\n\t" \ 39 ".end\t__" #symbol "\n\t" \
40 ".size\t" #symbol",. - " #symbol) 40 ".size\t__" #symbol",. - __" #symbol)
41 41
42#define nabi_no_regargs 42#define nabi_no_regargs
43 43
@@ -48,10 +48,10 @@ __asm__( \
48#define save_static_function(symbol) \ 48#define save_static_function(symbol) \
49__asm__( \ 49__asm__( \
50 ".text\n\t" \ 50 ".text\n\t" \
51 ".globl\t" #symbol "\n\t" \ 51 ".globl\t__" #symbol "\n\t" \
52 ".align\t2\n\t" \ 52 ".align\t2\n\t" \
53 ".type\t" #symbol ", @function\n\t" \ 53 ".type\t__" #symbol ", @function\n\t" \
54 ".ent\t" #symbol ", 0\n" \ 54 ".ent\t__" #symbol ", 0\n__" \
55 #symbol":\n\t" \ 55 #symbol":\n\t" \
56 ".frame\t$29, 0, $31\n\t" \ 56 ".frame\t$29, 0, $31\n\t" \
57 "sd\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \ 57 "sd\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \
@@ -63,9 +63,9 @@ __asm__( \
63 "sd\t$22,"__str(PT_R22)"($29)\n\t" \ 63 "sd\t$22,"__str(PT_R22)"($29)\n\t" \
64 "sd\t$23,"__str(PT_R23)"($29)\n\t" \ 64 "sd\t$23,"__str(PT_R23)"($29)\n\t" \
65 "sd\t$30,"__str(PT_R30)"($29)\n\t" \ 65 "sd\t$30,"__str(PT_R30)"($29)\n\t" \
66 "j\t_" #symbol "\n\t" \ 66 "j\t" #symbol "\n\t" \
67 ".end\t" #symbol "\n\t" \ 67 ".end\t__" #symbol "\n\t" \
68 ".size\t" #symbol",. - " #symbol) 68 ".size\t__" #symbol",. - __" #symbol)
69 69
70#define nabi_no_regargs \ 70#define nabi_no_regargs \
71 unsigned long __dummy0, \ 71 unsigned long __dummy0, \
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
index 9e47cc11aa26..06f6463c24ad 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -43,6 +43,8 @@
43# ifdef CONFIG_MIPS32_O32 43# ifdef CONFIG_MIPS32_O32
44# define __ARCH_WANT_COMPAT_SYS_TIME 44# define __ARCH_WANT_COMPAT_SYS_TIME
45# endif 45# endif
46#define __ARCH_WANT_SYS_FORK
47#define __ARCH_WANT_SYS_CLONE
46 48
47/* whitelists for checksyscalls */ 49/* whitelists for checksyscalls */
48#define __IGNORE_select 50#define __IGNORE_select
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 9df3e330c37c..253bd8ad7446 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -279,25 +279,6 @@ asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_a2,
279 merge_64(len_a4, len_a5)); 279 merge_64(len_a4, len_a5));
280} 280}
281 281
282save_static_function(sys32_clone);
283static int noinline __used
284_sys32_clone(nabi_no_regargs struct pt_regs regs)
285{
286 unsigned long clone_flags;
287 unsigned long newsp;
288 int __user *parent_tidptr, *child_tidptr;
289
290 clone_flags = regs.regs[4];
291 newsp = regs.regs[5];
292 parent_tidptr = (int __user *) regs.regs[6];
293
294 /* Use __dummy4 instead of getting it off the stack, so that
295 syscall() works. */
296 child_tidptr = (int __user *) __dummy4;
297 return do_fork(clone_flags, newsp, 0,
298 parent_tidptr, child_tidptr);
299}
300
301asmlinkage long sys32_lookup_dcookie(u32 a0, u32 a1, char __user *buf, 282asmlinkage long sys32_lookup_dcookie(u32 a0, u32 a1, char __user *buf,
302 size_t len) 283 size_t len)
303{ 284{
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index d20a4bc9ed05..80ff9422215f 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -226,7 +226,7 @@ einval: li v0, -ENOSYS
226 .macro syscalltable 226 .macro syscalltable
227 sys sys_syscall 8 /* 4000 */ 227 sys sys_syscall 8 /* 4000 */
228 sys sys_exit 1 228 sys sys_exit 1
229 sys sys_fork 0 229 sys __sys_fork 0
230 sys sys_read 3 230 sys sys_read 3
231 sys sys_write 3 231 sys sys_write 3
232 sys sys_open 3 /* 4005 */ 232 sys sys_open 3 /* 4005 */
@@ -344,7 +344,7 @@ einval: li v0, -ENOSYS
344 sys sys_ipc 6 344 sys sys_ipc 6
345 sys sys_fsync 1 345 sys sys_fsync 1
346 sys sys_sigreturn 0 346 sys sys_sigreturn 0
347 sys sys_clone 0 /* 4120 */ 347 sys __sys_clone 6 /* 4120 */
348 sys sys_setdomainname 2 348 sys sys_setdomainname 2
349 sys sys_newuname 1 349 sys sys_newuname 1
350 sys sys_ni_syscall 0 /* sys_modify_ldt */ 350 sys sys_ni_syscall 0 /* sys_modify_ldt */
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index b64f642da073..9444ad9ea575 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -170,8 +170,8 @@ sys_call_table:
170 PTR sys_socketpair 170 PTR sys_socketpair
171 PTR sys_setsockopt 171 PTR sys_setsockopt
172 PTR sys_getsockopt 172 PTR sys_getsockopt
173 PTR sys_clone /* 5055 */ 173 PTR __sys_clone /* 5055 */
174 PTR sys_fork 174 PTR __sys_fork
175 PTR sys_execve 175 PTR sys_execve
176 PTR sys_exit 176 PTR sys_exit
177 PTR sys_wait4 177 PTR sys_wait4
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 4b335467ea3f..3b18a8e29215 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -159,8 +159,8 @@ EXPORT(sysn32_call_table)
159 PTR sys_socketpair 159 PTR sys_socketpair
160 PTR compat_sys_setsockopt 160 PTR compat_sys_setsockopt
161 PTR sys_getsockopt 161 PTR sys_getsockopt
162 PTR sys_clone /* 6055 */ 162 PTR __sys_clone /* 6055 */
163 PTR sys_fork 163 PTR __sys_fork
164 PTR compat_sys_execve 164 PTR compat_sys_execve
165 PTR sys_exit 165 PTR sys_exit
166 PTR compat_sys_wait4 166 PTR compat_sys_wait4
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 78e1ef17abcc..063cd0d6ddd2 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -194,7 +194,7 @@ einval: li v0, -ENOSYS
194sys_call_table: 194sys_call_table:
195 PTR sys32_syscall /* 4000 */ 195 PTR sys32_syscall /* 4000 */
196 PTR sys_exit 196 PTR sys_exit
197 PTR sys_fork 197 PTR __sys_fork
198 PTR sys_read 198 PTR sys_read
199 PTR sys_write 199 PTR sys_write
200 PTR compat_sys_open /* 4005 */ 200 PTR compat_sys_open /* 4005 */
@@ -312,7 +312,7 @@ sys_call_table:
312 PTR sys_32_ipc 312 PTR sys_32_ipc
313 PTR sys_fsync 313 PTR sys_fsync
314 PTR sys32_sigreturn 314 PTR sys32_sigreturn
315 PTR sys32_clone /* 4120 */ 315 PTR __sys_clone /* 4120 */
316 PTR sys_setdomainname 316 PTR sys_setdomainname
317 PTR sys_newuname 317 PTR sys_newuname
318 PTR sys_ni_syscall /* sys_modify_ldt */ 318 PTR sys_ni_syscall /* sys_modify_ldt */
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 28daa66baa7b..b32466a1a1d2 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -83,41 +83,7 @@ SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len,
83} 83}
84 84
85save_static_function(sys_fork); 85save_static_function(sys_fork);
86static int __used noinline
87_sys_fork(nabi_no_regargs struct pt_regs regs)
88{
89 return do_fork(SIGCHLD, 0, 0, NULL, NULL);
90}
91
92save_static_function(sys_clone); 86save_static_function(sys_clone);
93static int __used noinline
94_sys_clone(nabi_no_regargs struct pt_regs regs)
95{
96 unsigned long clone_flags;
97 unsigned long newsp;
98 int __user *parent_tidptr, *child_tidptr;
99
100 clone_flags = regs.regs[4];
101 newsp = regs.regs[5];
102 parent_tidptr = (int __user *) regs.regs[6];
103#ifdef CONFIG_32BIT
104 /* We need to fetch the fifth argument off the stack. */
105 child_tidptr = NULL;
106 if (clone_flags & (CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)) {
107 int __user *__user *usp = (int __user *__user *) regs.regs[29];
108 if (regs.regs[2] == __NR_syscall) {
109 if (get_user (child_tidptr, &usp[5]))
110 return -EFAULT;
111 }
112 else if (get_user (child_tidptr, &usp[4]))
113 return -EFAULT;
114 }
115#else
116 child_tidptr = (int __user *) regs.regs[8];
117#endif
118 return do_fork(clone_flags, newsp, 0,
119 parent_tidptr, child_tidptr);
120}
121 87
122SYSCALL_DEFINE1(set_thread_area, unsigned long, addr) 88SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
123{ 89{