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

unicore32: switch to generic clone(2)

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro cb562173 eda96977

+7 -25
+1
arch/unicore32/include/uapi/asm/unistd.h
··· 13 13 /* Use the standard ABI for syscalls. */ 14 14 #include <asm-generic/unistd.h> 15 15 #define __ARCH_WANT_SYS_EXECVE 16 + #define __ARCH_WANT_SYS_CLONE
-6
arch/unicore32/kernel/entry.S
··· 668 668 #endif 669 669 .ltorg 670 670 671 - ENTRY(sys_clone) 672 - add ip, sp, #S_OFF 673 - stw ip, [sp+], #4 674 - b __sys_clone 675 - ENDPROC(sys_clone) 676 - 677 671 ENTRY(sys_rt_sigreturn) 678 672 add r0, sp, #S_OFF 679 673 mov why, #0 @ prevent syscall restart handling
+6 -5
arch/unicore32/kernel/process.c
··· 262 262 263 263 int 264 264 copy_thread(unsigned long clone_flags, unsigned long stack_start, 265 - unsigned long stk_sz, struct task_struct *p, struct pt_regs *regs) 265 + unsigned long stk_sz, struct task_struct *p, struct pt_regs *unused) 266 266 { 267 267 struct thread_info *thread = task_thread_info(p); 268 268 struct pt_regs *childregs = task_pt_regs(p); 269 269 270 270 memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save)); 271 271 thread->cpu_context.sp = (unsigned long)childregs; 272 - if (unlikely(!regs)) { 272 + if (unlikely(p->flags & PF_KTHREAD)) { 273 273 thread->cpu_context.pc = (unsigned long)ret_from_kernel_thread; 274 274 thread->cpu_context.r4 = stack_start; 275 275 thread->cpu_context.r5 = stk_sz; 276 276 memset(childregs, 0, sizeof(struct pt_regs)); 277 277 } else { 278 278 thread->cpu_context.pc = (unsigned long)ret_from_fork; 279 - *childregs = *regs; 279 + *childregs = *current_pt_regs(); 280 280 childregs->UCreg_00 = 0; 281 - childregs->UCreg_sp = stack_start; 281 + if (stack_start) 282 + childregs->UCreg_sp = stack_start; 282 283 283 284 if (clone_flags & CLONE_SETTLS) 284 - childregs->UCreg_16 = regs->UCreg_03; 285 + childregs->UCreg_16 = childregs->UCreg_03; 285 286 } 286 287 return 0; 287 288 }
-14
arch/unicore32/kernel/sys.c
··· 28 28 #include <asm/syscalls.h> 29 29 #include <asm/cacheflush.h> 30 30 31 - /* Clone a task - this clones the calling program thread. 32 - * This is called indirectly via a small wrapper 33 - */ 34 - asmlinkage long __sys_clone(unsigned long clone_flags, unsigned long newsp, 35 - void __user *parent_tid, void __user *child_tid, 36 - struct pt_regs *regs) 37 - { 38 - if (!newsp) 39 - newsp = regs->UCreg_sp; 40 - 41 - return do_fork(clone_flags, newsp, regs, 0, 42 - parent_tid, child_tid); 43 - } 44 - 45 31 /* Note: used by the compat code even in 64-bit Linux. */ 46 32 SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, 47 33 unsigned long, prot, unsigned long, flags,