aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/kernel/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/avr32/kernel/process.c')
-rw-r--r--arch/avr32/kernel/process.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
index 09b894d96d6e..03d7aa4a4bc9 100644
--- a/arch/avr32/kernel/process.c
+++ b/arch/avr32/kernel/process.c
@@ -299,11 +299,11 @@ asmlinkage void syscall_return(void);
299 299
300int copy_thread(unsigned long clone_flags, unsigned long usp, 300int copy_thread(unsigned long clone_flags, unsigned long usp,
301 unsigned long arg, 301 unsigned long arg,
302 struct task_struct *p, struct pt_regs *regs) 302 struct task_struct *p, struct pt_regs *unused)
303{ 303{
304 struct pt_regs *childregs = task_pt_regs(p); 304 struct pt_regs *childregs = task_pt_regs(p);
305 305
306 if (unlikely(!regs)) { 306 if (unlikely(p->flags & PF_KTHREAD)) {
307 memset(childregs, 0, sizeof(struct pt_regs)); 307 memset(childregs, 0, sizeof(struct pt_regs));
308 p->thread.cpu_context.r0 = arg; 308 p->thread.cpu_context.r0 = arg;
309 p->thread.cpu_context.r1 = usp; /* fn */ 309 p->thread.cpu_context.r1 = usp; /* fn */
@@ -311,8 +311,9 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
311 p->thread.cpu_context.pc = (unsigned long)ret_from_kernel_thread; 311 p->thread.cpu_context.pc = (unsigned long)ret_from_kernel_thread;
312 childregs->sr = MODE_SUPERVISOR; 312 childregs->sr = MODE_SUPERVISOR;
313 } else { 313 } else {
314 *childregs = *regs; 314 *childregs = *current_pt_regs();
315 childregs->sp = usp; 315 if (usp)
316 childregs->sp = usp;
316 childregs->r12 = 0; /* Set return value for child */ 317 childregs->r12 = 0; /* Set return value for child */
317 p->thread.cpu_context.pc = (unsigned long)ret_from_fork; 318 p->thread.cpu_context.pc = (unsigned long)ret_from_fork;
318 } 319 }
@@ -327,28 +328,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
327 return 0; 328 return 0;
328} 329}
329 330
330/* r12-r8 are dummy parameters to force the compiler to use the stack */
331asmlinkage int sys_fork(struct pt_regs *regs)
332{
333 return do_fork(SIGCHLD, regs->sp, regs, 0, NULL, NULL);
334}
335
336asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
337 void __user *parent_tidptr, void __user *child_tidptr,
338 struct pt_regs *regs)
339{
340 if (!newsp)
341 newsp = regs->sp;
342 return do_fork(clone_flags, newsp, regs, 0, parent_tidptr,
343 child_tidptr);
344}
345
346asmlinkage int sys_vfork(struct pt_regs *regs)
347{
348 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->sp, regs,
349 0, NULL, NULL);
350}
351
352/* 331/*
353 * This function is supposed to answer the question "who called 332 * This function is supposed to answer the question "who called
354 * schedule()?" 333 * schedule()?"