This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

alpha clone update


Just like all the others.  Committed.


r~


        * sysdeps/unix/sysv/linux/alpha/clone.S (__clone): Add support
        for NPTL where the PID is stored at userlevel and needs to be
        reset when CLONE_THREAD is not used.
nptl/
        * sysdeps/unix/sysv/linux/alpha/clone.S: New file.
        * sysdeps/alpha/tcb-offsets.sym (TID_OFFSET): New.

Index: nptl/sysdeps/alpha/tcb-offsets.sym
===================================================================
RCS file: /cvs/glibc/libc/nptl/sysdeps/alpha/tcb-offsets.sym,v
retrieving revision 1.4
diff -c -p -d -r1.4 tcb-offsets.sym
*** nptl/sysdeps/alpha/tcb-offsets.sym	15 Oct 2004 07:07:57 -0000	1.4
--- nptl/sysdeps/alpha/tcb-offsets.sym	16 Dec 2004 19:04:58 -0000
***************
*** 11,13 ****
--- 11,14 ----
  
  MULTIPLE_THREADS_OFFSET		thread_offsetof (header.multiple_threads)
  PID_OFFSET			thread_offsetof (pid)
+ TID_OFFSET			thread_offsetof (tid)
Index: nptl/sysdeps/unix/sysv/linux/alpha/clone.S
===================================================================
RCS file: nptl/sysdeps/unix/sysv/linux/alpha/clone.S
diff -N nptl/sysdeps/unix/sysv/linux/alpha/clone.S
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- nptl/sysdeps/unix/sysv/linux/alpha/clone.S	16 Dec 2004 19:04:58 -0000
***************
*** 0 ****
--- 1,2 ----
+ #define RESET_PID
+ #include <sysdeps/unix/sysv/linux/alpha/clone.S>
Index: sysdeps/unix/sysv/linux/alpha/clone.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/clone.S,v
retrieving revision 1.16
diff -c -p -d -r1.16 clone.S
*** sysdeps/unix/sysv/linux/alpha/clone.S	25 Aug 2004 19:59:01 -0000	1.16
--- sysdeps/unix/sysv/linux/alpha/clone.S	16 Dec 2004 19:05:01 -0000
***************
*** 24,29 ****
--- 24,32 ----
  #define _ERRNO_H	1
  #include <bits/errno.h>
  
+ #define CLONE_VM	0x00000100
+ #define CLONE_THREAD	0x00010000
+ 
  /* int clone(int (*fn)(void *arg), void *child_stack, int flags,
  	     void *arg, pid_t *ptid, void *tls, pid_t *ctid);
  
*************** ENTRY(__clone)
*** 51,59 ****
  	beq	a1,$error		/* no NULL stack pointers */
  
  	/* Save the fn ptr and arg on the new stack.  */
! 	subq	a1,16,a1
  	stq	a0,0(a1)
  	stq	a3,8(a1)
  
  	/* The syscall is of the form clone(flags, usp, ptid, ctid, tls).
  	   Shift the flags, ptid, ctid, tls arguments into place; the
--- 54,65 ----
  	beq	a1,$error		/* no NULL stack pointers */
  
  	/* Save the fn ptr and arg on the new stack.  */
! 	subq	a1,32,a1
  	stq	a0,0(a1)
  	stq	a3,8(a1)
+ #ifdef RESET_PID
+ 	stq	a2,16(a1)
+ #endif
  
  	/* The syscall is of the form clone(flags, usp, ptid, ctid, tls).
  	   Shift the flags, ptid, ctid, tls arguments into place; the
*************** thread_start:
*** 93,102 ****
  	mov	0, fp
  	.prologue 0
  
  	/* Load up the arguments.  */
  	ldq	pv,0(sp)
  	ldq	a0,8(sp)
! 	addq	sp,16,sp
  
  	/* Call the user's function.  */
  	jsr	ra,(pv)
--- 99,117 ----
  	mov	0, fp
  	.prologue 0
  
+ #ifdef RESET_PID
+ 	/* Check and see if we need to reset the PID.  */
+ 	ldq	t0,16(sp)
+ 	lda	t1,CLONE_THREAD
+ 	and	t0,t1,t2
+ 	beq	t2,2f
+ 1:
+ #endif
+ 
  	/* Load up the arguments.  */
  	ldq	pv,0(sp)
  	ldq	a0,8(sp)
! 	addq	sp,32,sp
  
  	/* Call the user's function.  */
  	jsr	ra,(pv)
*************** thread_start:
*** 113,118 ****
--- 128,149 ----
  	/* Die horribly.  */
  	halt
  
+ #ifdef RESET_PID
+ 2:
+ 	rduniq
+ 	lda	t1, CLONE_VM
+ 	mov	v0, s0
+ 	lda	v0, -1
+ 	and	t0, t1, t2
+ 	bne	t2, 3f
+ 	lda	v0, __NR_getxpid
+ 	callsys
+ 3:
+ 	stl	v0, PID_OFFSET(s0)
+ 	stl	v0, TID_OFFSET(s0)
+ 	br	1b
+ #endif
+ 
  	.end thread_start
  
  weak_alias(__clone, clone)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]