aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-10-22 22:49:03 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-11-28 23:43:40 -0500
commitcb56217362d87159b683175247d8d059df80aefa (patch)
tree1d2889e6b854efb4ddea4b0861cdc14d7b4e8741
parenteda96977024c84e677191cad785351abbb945901 (diff)
unicore32: switch to generic clone(2)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--arch/unicore32/include/uapi/asm/unistd.h1
-rw-r--r--arch/unicore32/kernel/entry.S6
-rw-r--r--arch/unicore32/kernel/process.c11
-rw-r--r--arch/unicore32/kernel/sys.c14
4 files changed, 7 insertions, 25 deletions
diff --git a/arch/unicore32/include/uapi/asm/unistd.h b/arch/unicore32/include/uapi/asm/unistd.h
index d18a3be89b38..00cf5e286fca 100644
--- a/arch/unicore32/include/uapi/asm/unistd.h
+++ b/arch/unicore32/include/uapi/asm/unistd.h
@@ -13,3 +13,4 @@
13/* Use the standard ABI for syscalls. */ 13/* Use the standard ABI for syscalls. */
14#include <asm-generic/unistd.h> 14#include <asm-generic/unistd.h>
15#define __ARCH_WANT_SYS_EXECVE 15#define __ARCH_WANT_SYS_EXECVE
16#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/unicore32/kernel/entry.S b/arch/unicore32/kernel/entry.S
index 7049350c790f..581630d91444 100644
--- a/arch/unicore32/kernel/entry.S
+++ b/arch/unicore32/kernel/entry.S
@@ -668,12 +668,6 @@ __cr_alignment:
668#endif 668#endif
669 .ltorg 669 .ltorg
670 670
671ENTRY(sys_clone)
672 add ip, sp, #S_OFF
673 stw ip, [sp+], #4
674 b __sys_clone
675ENDPROC(sys_clone)
676
677ENTRY(sys_rt_sigreturn) 671ENTRY(sys_rt_sigreturn)
678 add r0, sp, #S_OFF 672 add r0, sp, #S_OFF
679 mov why, #0 @ prevent syscall restart handling 673 mov why, #0 @ prevent syscall restart handling
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
index a8fe265ce2c0..79e44e8ae31c 100644
--- a/arch/unicore32/kernel/process.c
+++ b/arch/unicore32/kernel/process.c
@@ -262,26 +262,27 @@ asmlinkage void ret_from_kernel_thread(void) __asm__("ret_from_kernel_thread");
262 262
263int 263int
264copy_thread(unsigned long clone_flags, unsigned long stack_start, 264copy_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 struct thread_info *thread = task_thread_info(p); 267 struct thread_info *thread = task_thread_info(p);
268 struct pt_regs *childregs = task_pt_regs(p); 268 struct pt_regs *childregs = task_pt_regs(p);
269 269
270 memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save)); 270 memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save));
271 thread->cpu_context.sp = (unsigned long)childregs; 271 thread->cpu_context.sp = (unsigned long)childregs;
272 if (unlikely(!regs)) { 272 if (unlikely(p->flags & PF_KTHREAD)) {
273 thread->cpu_context.pc = (unsigned long)ret_from_kernel_thread; 273 thread->cpu_context.pc = (unsigned long)ret_from_kernel_thread;
274 thread->cpu_context.r4 = stack_start; 274 thread->cpu_context.r4 = stack_start;
275 thread->cpu_context.r5 = stk_sz; 275 thread->cpu_context.r5 = stk_sz;
276 memset(childregs, 0, sizeof(struct pt_regs)); 276 memset(childregs, 0, sizeof(struct pt_regs));
277 } else { 277 } else {
278 thread->cpu_context.pc = (unsigned long)ret_from_fork; 278 thread->cpu_context.pc = (unsigned long)ret_from_fork;
279 *childregs = *regs; 279 *childregs = *current_pt_regs();
280 childregs->UCreg_00 = 0; 280 childregs->UCreg_00 = 0;
281 childregs->UCreg_sp = stack_start; 281 if (stack_start)
282 childregs->UCreg_sp = stack_start;
282 283
283 if (clone_flags & CLONE_SETTLS) 284 if (clone_flags & CLONE_SETTLS)
284 childregs->UCreg_16 = regs->UCreg_03; 285 childregs->UCreg_16 = childregs->UCreg_03;
285 } 286 }
286 return 0; 287 return 0;
287} 288}
diff --git a/arch/unicore32/kernel/sys.c b/arch/unicore32/kernel/sys.c
index 9680134b31f0..cfe79c9529b3 100644
--- a/arch/unicore32/kernel/sys.c
+++ b/arch/unicore32/kernel/sys.c
@@ -28,20 +28,6 @@
28#include <asm/syscalls.h> 28#include <asm/syscalls.h>
29#include <asm/cacheflush.h> 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 */
34asmlinkage 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/* Note: used by the compat code even in 64-bit Linux. */ 31/* Note: used by the compat code even in 64-bit Linux. */
46SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, 32SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
47 unsigned long, prot, unsigned long, flags, 33 unsigned long, prot, unsigned long, flags,