]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] ia64: clone2/clone argument order fixes
authorJakub Jelínek <jakub@redhat.com>
Thu, 13 Mar 2003 03:34:20 +0000 (19:34 -0800)
committerDavid Mosberger <davidm@tiger.hpl.hp.com>
Thu, 13 Mar 2003 03:34:20 +0000 (19:34 -0800)
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

index 1145345f7e94cd67a50b08fde3fa88e03dbfe6e6..d6b62ebd456ac20be63ae4ba3f16783e390578b9 100644 (file)
@@ -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 = &regs
        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 = &regs
        dep out0=0,in0,CLONE_IDLETASK_BIT,1     // out0 = clone_flags & ~CLONE_IDLETASK
        br.call.sptk.many rp=do_fork