Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

Al Viro 50150d2b 64b3122d

+23 -73
+1
arch/mips/Kconfig
··· 41 41 select HAVE_MOD_ARCH_SPECIFIC 42 42 select MODULES_USE_ELF_REL if MODULES 43 43 select MODULES_USE_ELF_RELA if MODULES && 64BIT 44 + select CLONE_BACKWARDS 44 45 select GENERIC_SIGALTSTACK 45 46 select GENERIC_COMPAT_RT_SIGACTION 46 47 select GENERIC_COMPAT_RT_SIGQUEUEINFO
+12 -12
arch/mips/include/asm/sim.h
··· 20 20 #define save_static_function(symbol) \ 21 21 __asm__( \ 22 22 ".text\n\t" \ 23 - ".globl\t" #symbol "\n\t" \ 23 + ".globl\t__" #symbol "\n\t" \ 24 24 ".align\t2\n\t" \ 25 - ".type\t" #symbol ", @function\n\t" \ 26 - ".ent\t" #symbol ", 0\n" \ 25 + ".type\t__" #symbol ", @function\n\t" \ 26 + ".ent\t__" #symbol ", 0\n__" \ 27 27 #symbol":\n\t" \ 28 28 ".frame\t$29, 0, $31\n\t" \ 29 29 "sw\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \ ··· 35 35 "sw\t$22,"__str(PT_R22)"($29)\n\t" \ 36 36 "sw\t$23,"__str(PT_R23)"($29)\n\t" \ 37 37 "sw\t$30,"__str(PT_R30)"($29)\n\t" \ 38 - "j\t_" #symbol "\n\t" \ 39 - ".end\t" #symbol "\n\t" \ 40 - ".size\t" #symbol",. - " #symbol) 38 + "j\t" #symbol "\n\t" \ 39 + ".end\t__" #symbol "\n\t" \ 40 + ".size\t__" #symbol",. - __" #symbol) 41 41 42 42 #define nabi_no_regargs 43 43 ··· 48 48 #define save_static_function(symbol) \ 49 49 __asm__( \ 50 50 ".text\n\t" \ 51 - ".globl\t" #symbol "\n\t" \ 51 + ".globl\t__" #symbol "\n\t" \ 52 52 ".align\t2\n\t" \ 53 - ".type\t" #symbol ", @function\n\t" \ 54 - ".ent\t" #symbol ", 0\n" \ 53 + ".type\t__" #symbol ", @function\n\t" \ 54 + ".ent\t__" #symbol ", 0\n__" \ 55 55 #symbol":\n\t" \ 56 56 ".frame\t$29, 0, $31\n\t" \ 57 57 "sd\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \ ··· 63 63 "sd\t$22,"__str(PT_R22)"($29)\n\t" \ 64 64 "sd\t$23,"__str(PT_R23)"($29)\n\t" \ 65 65 "sd\t$30,"__str(PT_R30)"($29)\n\t" \ 66 - "j\t_" #symbol "\n\t" \ 67 - ".end\t" #symbol "\n\t" \ 68 - ".size\t" #symbol",. - " #symbol) 66 + "j\t" #symbol "\n\t" \ 67 + ".end\t__" #symbol "\n\t" \ 68 + ".size\t__" #symbol",. - __" #symbol) 69 69 70 70 #define nabi_no_regargs \ 71 71 unsigned long __dummy0, \
+2
arch/mips/include/asm/unistd.h
··· 43 43 # ifdef CONFIG_MIPS32_O32 44 44 # define __ARCH_WANT_COMPAT_SYS_TIME 45 45 # endif 46 + #define __ARCH_WANT_SYS_FORK 47 + #define __ARCH_WANT_SYS_CLONE 46 48 47 49 /* whitelists for checksyscalls */ 48 50 #define __IGNORE_select
-19
arch/mips/kernel/linux32.c
··· 279 279 merge_64(len_a4, len_a5)); 280 280 } 281 281 282 - save_static_function(sys32_clone); 283 - static 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 - 301 282 asmlinkage long sys32_lookup_dcookie(u32 a0, u32 a1, char __user *buf, 302 283 size_t len) 303 284 {
+2 -2
arch/mips/kernel/scall32-o32.S
··· 226 226 .macro syscalltable 227 227 sys sys_syscall 8 /* 4000 */ 228 228 sys sys_exit 1 229 - sys sys_fork 0 229 + sys __sys_fork 0 230 230 sys sys_read 3 231 231 sys sys_write 3 232 232 sys sys_open 3 /* 4005 */ ··· 344 344 sys sys_ipc 6 345 345 sys sys_fsync 1 346 346 sys sys_sigreturn 0 347 - sys sys_clone 0 /* 4120 */ 347 + sys __sys_clone 6 /* 4120 */ 348 348 sys sys_setdomainname 2 349 349 sys sys_newuname 1 350 350 sys sys_ni_syscall 0 /* sys_modify_ldt */
+2 -2
arch/mips/kernel/scall64-64.S
··· 170 170 PTR sys_socketpair 171 171 PTR sys_setsockopt 172 172 PTR sys_getsockopt 173 - PTR sys_clone /* 5055 */ 174 - PTR sys_fork 173 + PTR __sys_clone /* 5055 */ 174 + PTR __sys_fork 175 175 PTR sys_execve 176 176 PTR sys_exit 177 177 PTR sys_wait4
+2 -2
arch/mips/kernel/scall64-n32.S
··· 159 159 PTR sys_socketpair 160 160 PTR compat_sys_setsockopt 161 161 PTR sys_getsockopt 162 - PTR sys_clone /* 6055 */ 163 - PTR sys_fork 162 + PTR __sys_clone /* 6055 */ 163 + PTR __sys_fork 164 164 PTR compat_sys_execve 165 165 PTR sys_exit 166 166 PTR compat_sys_wait4
+2 -2
arch/mips/kernel/scall64-o32.S
··· 194 194 sys_call_table: 195 195 PTR sys32_syscall /* 4000 */ 196 196 PTR sys_exit 197 - PTR sys_fork 197 + PTR __sys_fork 198 198 PTR sys_read 199 199 PTR sys_write 200 200 PTR compat_sys_open /* 4005 */ ··· 312 312 PTR sys_32_ipc 313 313 PTR sys_fsync 314 314 PTR sys32_sigreturn 315 - PTR sys32_clone /* 4120 */ 315 + PTR __sys_clone /* 4120 */ 316 316 PTR sys_setdomainname 317 317 PTR sys_newuname 318 318 PTR sys_ni_syscall /* sys_modify_ldt */
-34
arch/mips/kernel/syscall.c
··· 83 83 } 84 84 85 85 save_static_function(sys_fork); 86 - static 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 - 92 86 save_static_function(sys_clone); 93 - static 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 122 88 SYSCALL_DEFINE1(set_thread_area, unsigned long, addr) 123 89 {