diff options
| author | Anton Blanchard <anton@samba.org> | 2002-11-28 14:32:11 +1100 |
|---|---|---|
| committer | Anton Blanchard <anton@samba.org> | 2002-11-28 14:32:11 +1100 |
| commit | a94a71d653ceb31733a31f112bc7caf137f2a5da (patch) | |
| tree | 4d9bd5fc5ff01d72dc2f56d142e413e841080119 /arch/ppc64/kernel | |
| parent | 646adb15699118793a4807b98859517498858fab (diff) | |
ppc64: fix sys_clone bug (paulus) and fix fork arguments (Milton Miller)
Diffstat (limited to 'arch/ppc64/kernel')
| -rw-r--r-- | arch/ppc64/kernel/misc.S | 4 | ||||
| -rw-r--r-- | arch/ppc64/kernel/process.c | 20 |
2 files changed, 17 insertions, 7 deletions
diff --git a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S index 5879c4729dda..da030b27b2e3 100644 --- a/arch/ppc64/kernel/misc.S +++ b/arch/ppc64/kernel/misc.S @@ -485,8 +485,10 @@ _GLOBAL(cvt_df) _GLOBAL(kernel_thread) /* XXX fix this when we optimise syscall entry to not save volatiles */ mr r6,r3 /* function */ + mr r7,r4 /* arg */ ori r3,r5,CLONE_VM /* flags */ oris r3,r3,(CLONE_UNTRACED>>16) + li r4,0 /* new sp (unused) */ li r0,__NR_clone sc cmpi 0,r3,0 /* parent or child? */ @@ -496,7 +498,7 @@ _GLOBAL(kernel_thread) ld r2,8(r6) ld r6,0(r6) mtlr r6 /* fn addr in lr */ - mr r3,r4 /* load arg and call fn */ + mr r3,r7 /* load arg and call fn */ blrl li r0,__NR_exit /* exit after child exits */ li r3,0 diff --git a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c index 60cf613bcdb8..d1a30e2e8de4 100644 --- a/arch/ppc64/kernel/process.c +++ b/arch/ppc64/kernel/process.c @@ -191,8 +191,10 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp, #ifdef CONFIG_PPC_ISERIES set_ti_thread_flag(p->thread_info, TIF_RUN_LIGHT); #endif - } else + } else { + childregs->gpr[1] = usp; p->thread.regs = childregs; + } childregs->gpr[3] = 0; /* Result from fork() */ sp -= STACK_FRAME_OVERHEAD; @@ -266,13 +268,17 @@ int get_fpexc_mode(struct task_struct *tsk, unsigned long adr) return put_user(val, (unsigned int *) adr); } -int sys_clone(unsigned long clone_flags, u32 p2, u32 p3, u32 p4, u32 p5, - u32 p6, struct pt_regs *regs) +int sys_clone(unsigned long clone_flags, unsigned long p2, unsigned long p3, + unsigned long p4, unsigned long p5, unsigned long p6, + struct pt_regs *regs) { struct task_struct *p; unsigned long parent_tidptr = 0; unsigned long child_tidptr = 0; + if (p2 == 0) + p2 = regs->gpr[1]; /* stack pointer for child */ + if (clone_flags & (CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)) { parent_tidptr = p3; @@ -286,12 +292,13 @@ int sys_clone(unsigned long clone_flags, u32 p2, u32 p3, u32 p4, u32 p5, if (regs->msr & MSR_FP) giveup_fpu(current); - p = do_fork(clone_flags & ~CLONE_IDLETASK, regs->gpr[1], regs, 0, + p = do_fork(clone_flags & ~CLONE_IDLETASK, p2, regs, 0, (int *)parent_tidptr, (int *)child_tidptr); return IS_ERR(p) ? PTR_ERR(p) : p->pid; } -int sys_fork(u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, +int sys_fork(unsigned long p1, unsigned long p2, unsigned long p3, + unsigned long p4, unsigned long p5, unsigned long p6, struct pt_regs *regs) { struct task_struct *p; @@ -303,7 +310,8 @@ int sys_fork(u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, return IS_ERR(p) ? PTR_ERR(p) : p->pid; } -int sys_vfork(u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, +int sys_vfork(unsigned long p1, unsigned long p2, unsigned long p3, + unsigned long p4, unsigned long p5, unsigned long p6, struct pt_regs *regs) { struct task_struct *p; |
