From ebbece414d442a059e808b68b063568dcd05e122 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jakub=20Jel=C3=ADnek?= Date: Wed, 12 Mar 2003 19:34:20 -0800 Subject: [PATCH] [PATCH] ia64: clone2/clone argument order fixes do_fork is declared as: struct task_struct *do_fork(unsigned long clone_flags, unsigned long stack_start, struct pt_regs *regs, unsigned long stack_size, int *parent_tidptr, int *child_tidptr) ie. parent_tidptr is out4 and child_tidptr is out5, but the comments in clone2 were suggesting otherwise. So, we either need a patch which will codify current order of clone arguments (ie. ptid, ctid, tls; attached below - has the advantage that clone2 stays with the same ABI as in 2.5.[56]x), or the arguments of clone2 and clone should be reordered to match the IA-32 order (which is ptid, tls, ctid). --- arch/ia64/kernel/entry.S | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index 1145345f7e94c..d6b62ebd456ac 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S @@ -91,7 +91,7 @@ ENTRY(ia64_execve) END(ia64_execve) /* - * sys_clone2(u64 flags, u64 ustack_base, u64 ustack_size, u64 child_tidptr, u64 parent_tidptr, + * sys_clone2(u64 flags, u64 ustack_base, u64 ustack_size, u64 parent_tidptr, u64 child_tidptr, * u64 tls) */ GLOBAL_ENTRY(sys_clone2) @@ -105,10 +105,10 @@ GLOBAL_ENTRY(sys_clone2) mov out1=in1 mov out3=in2 tbit.nz p6,p0=in0,CLONE_SETTLS_BIT - mov out4=in3 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID + mov out4=in3 // parent_tidptr: valid only w/CLONE_PARENT_SETTID ;; (p6) st8 [r2]=in5 // store TLS in r16 for copy_thread() - mov out5=in4 // parent_tidptr: valid only w/CLONE_PARENT_SETTID + mov out5=in4 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID adds out2=IA64_SWITCH_STACK_SIZE+16,sp // out2 = ®s dep out0=0,in0,CLONE_IDLETASK_BIT,1 // out0 = clone_flags & ~CLONE_IDLETASK br.call.sptk.many rp=do_fork @@ -126,7 +126,7 @@ GLOBAL_ENTRY(sys_clone2) END(sys_clone2) /* - * sys_clone(u64 flags, u64 ustack_base, u64 user_tid, u64 tls) + * sys_clone(u64 flags, u64 ustack_base, u64 parent_tidptr, u64 child_tidptr, u64 tls) * Deprecated. Use sys_clone2() instead. */ GLOBAL_ENTRY(sys_clone) @@ -140,9 +140,10 @@ GLOBAL_ENTRY(sys_clone) mov out1=in1 mov out3=16 // stacksize (compensates for 16-byte scratch area) tbit.nz p6,p0=in0,CLONE_SETTLS_BIT - mov out4=in2 // out4 = user_tid (optional) + mov out4=in2 // parent_tidptr: valid only w/CLONE_PARENT_SETTID ;; -(p6) st8 [r2]=in3 // store TLS in r13 (tp) +(p6) st8 [r2]=in4 // store TLS in r13 (tp) + mov out5=in3 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID adds out2=IA64_SWITCH_STACK_SIZE+16,sp // out2 = ®s dep out0=0,in0,CLONE_IDLETASK_BIT,1 // out0 = clone_flags & ~CLONE_IDLETASK br.call.sptk.many rp=do_fork -- 2.53.0