about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-12-17 10:11:44 +0000
committerRichard Henderson <rth@redhat.com>2004-12-17 10:11:44 +0000
commitcbc53df0fa0726c6267978250c1f53bf9517bf39 (patch)
treebba468278efe59e95c6ac05cd3ed286e07ecea3e
parent9b7adbb732a1613dd454e966b3c18db0070f9f28 (diff)
downloadglibc-cbc53df0fa0726c6267978250c1f53bf9517bf39.tar.gz
glibc-cbc53df0fa0726c6267978250c1f53bf9517bf39.tar.xz
glibc-cbc53df0fa0726c6267978250c1f53bf9517bf39.zip
* 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.
2004-12-17  Richard Henderson  <rth@redhat.com>

	* 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.
-rw-r--r--ChangeLog6
-rw-r--r--nptl/ChangeLog5
-rw-r--r--nptl/sysdeps/alpha/tcb-offsets.sym1
-rw-r--r--nptl/sysdeps/unix/sysv/linux/alpha/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/clone.S35
5 files changed, 47 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 8849ecd9c0..d8ff129cc9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-12-17  Richard Henderson  <rth@redhat.com>
+
+	* 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.
+
 2004-12-17  Jakub Jelinek  <jakub@redhat.com>
 
 	* sysdeps/sparc/sparc64/fpu/libm-test-ulps: Update.
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 11858c38a6..0a6b1a4c92 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,8 @@
+2004-12-17  Richard Henderson  <rth@redhat.com>
+
+	* sysdeps/unix/sysv/linux/alpha/clone.S: New file.
+	* sysdeps/alpha/tcb-offsets.sym (TID_OFFSET): New.
+	
 2004-12-16  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/bits/local_lim.h: New file.
diff --git a/nptl/sysdeps/alpha/tcb-offsets.sym b/nptl/sysdeps/alpha/tcb-offsets.sym
index ebd84f35e5..c21a791040 100644
--- a/nptl/sysdeps/alpha/tcb-offsets.sym
+++ b/nptl/sysdeps/alpha/tcb-offsets.sym
@@ -11,3 +11,4 @@
 
 MULTIPLE_THREADS_OFFSET		thread_offsetof (header.multiple_threads)
 PID_OFFSET			thread_offsetof (pid)
+TID_OFFSET			thread_offsetof (tid)
diff --git a/nptl/sysdeps/unix/sysv/linux/alpha/clone.S b/nptl/sysdeps/unix/sysv/linux/alpha/clone.S
new file mode 100644
index 0000000000..eea1cbeed1
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/alpha/clone.S
@@ -0,0 +1,2 @@
+#define RESET_PID
+#include <sysdeps/unix/sysv/linux/alpha/clone.S>
diff --git a/sysdeps/unix/sysv/linux/alpha/clone.S b/sysdeps/unix/sysv/linux/alpha/clone.S
index b4766ec457..1c450d1737 100644
--- a/sysdeps/unix/sysv/linux/alpha/clone.S
+++ b/sysdeps/unix/sysv/linux/alpha/clone.S
@@ -24,6 +24,9 @@
 #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);
 
@@ -51,9 +54,12 @@ ENTRY(__clone)
 	beq	a1,$error		/* no NULL stack pointers */
 
 	/* Save the fn ptr and arg on the new stack.  */
-	subq	a1,16,a1
+	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
@@ -93,10 +99,19 @@ thread_start:
 	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,16,sp
+	addq	sp,32,sp
 
 	/* Call the user's function.  */
 	jsr	ra,(pv)
@@ -113,6 +128,22 @@ thread_start:
 	/* 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)