public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix nptl/tst-getpid{1,2} on s390{,x}
@ 2004-12-14 17:14 Jakub Jelinek
  2004-12-15 14:07 ` [PATCH] Fix nptl/tst-getpid{1,2} on s390{,x} (take 2) Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2004-12-14 17:14 UTC (permalink / raw)
  To: Ulrich Drepper, Martin Schwidefsky; +Cc: Glibc hackers

Hi!

So far tested outside of glibc tree only (and solely 31 bit).
Martin, does this look ok?
I'll test it fully in my next automated glibc build.

2004-12-14  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/s390/s390-32/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.
	* sysdeps/unix/sysv/linux/s390/s390-64/clone.S (__clone): Likewise.
nptl/
	* sysdeps/unix/sysv/linux/s390/s390-32/clone.S: New file.
	* sysdeps/unix/sysv/linux/s390/s390-64/clone.S: New file.
	* sysdeps/s390/tcb-offsets.sym (TID): Add.

--- libc/sysdeps/unix/sysv/linux/s390/s390-32/clone.S.jj	2004-07-12 17:50:26.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/s390/s390-32/clone.S	2004-12-14 17:39:17.888568618 +0100
@@ -54,6 +54,18 @@ error:
 PSEUDO_END (__clone)
 	
 thread_start:
+#ifdef RESET_PID
+	tmh	%r3,1		/* CLONE_THREAD == 0x00010000 */
+	jne	1f
+	lhi	%r2,-1
+	tml	%r3,256		/* CLONE_VM == 0x00000100 */
+	jne	2f
+	svc	SYS_ify(getpid)
+2:	ear	%r3,%a0
+	st	%r2,PID(%r3)
+	st	%r2,TID(%r3)
+1:
+#endif
 	/* fn is in gpr 1, arg in gpr 0 */
 	lr      %r2,%r0         /* set first parameter to void *arg */
 	ahi     %r15,-96        /* make room on the stack for the save area */
--- libc/sysdeps/unix/sysv/linux/s390/s390-64/clone.S.jj	2004-07-12 17:50:26.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/s390/s390-64/clone.S	2004-12-14 18:03:24.020208726 +0100
@@ -55,6 +55,20 @@ error:
 PSEUDO_END (__clone)
 
 thread_start:
+#ifdef RESET_PID
+	tmh	%r3,1		/* CLONE_THREAD == 0x00010000 */
+	jne	1f
+	lhi	%r2,-1
+	tml	%r3,256		/* CLONE_VM == 0x00000100 */
+	jne	2f
+	svc	SYS_ify(getpid)
+2:	ear	%r3,%a0
+	sllg	%r3,%r3,32
+	ear	%r3,%a1
+	st	%r2,PID(%r3)
+	st	%r2,TID(%r3)
+1:
+#endif
 	/* fn is in gpr 1, arg in gpr 0 */
 	lgr	%r2,%r0		/* set first parameter to void *arg */
 	aghi	%r15,-160	/* make room on the stack for the save area */
--- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/clone.S.jj	2004-12-14 17:56:54.715727557 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/clone.S	2004-12-14 17:57:02.301372155 +0100
@@ -0,0 +1,2 @@
+#define RESET_PID
+#include <sysdeps/unix/sysv/linux/s390/s390-32/clone.S>
--- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/clone.S.jj	2004-12-14 17:56:54.000000000 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/clone.S	2004-12-14 18:03:46.223246796 +0100
@@ -0,0 +1,2 @@
+#define RESET_PID
+#include <sysdeps/unix/sysv/linux/s390/s390-64/clone.S>
--- libc/nptl/sysdeps/s390/tcb-offsets.sym.jj	2004-03-10 20:02:20.000000000 +0100
+++ libc/nptl/sysdeps/s390/tcb-offsets.sym	2004-12-14 17:56:00.412430245 +0100
@@ -3,3 +3,4 @@
 
 MULTIPLE_THREADS_OFFSET		offsetof (tcbhead_t, multiple_threads)
 PID				offsetof (struct pthread, pid)
+TID				offsetof (struct pthread, tid)

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] Fix nptl/tst-getpid{1,2} on s390{,x} (take 2)
  2004-12-14 17:14 [PATCH] Fix nptl/tst-getpid{1,2} on s390{,x} Jakub Jelinek
@ 2004-12-15 14:07 ` Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2004-12-15 14:07 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Martin Schwidefsky, Glibc hackers

On Tue, Dec 14, 2004 at 06:14:52PM +0100, Jakub Jelinek wrote:
> So far tested outside of glibc tree only (and solely 31 bit).
> Martin, does this look ok?
> I'll test it fully in my next automated glibc build.

Testing revealed missing #include <tls.h>, fixed below.
With this patch plus the ppc64 clone.S patch I posted today
tst-getpid{1,2} passes on i386/i686/x86_64/ia64/ppc/ppc64/s390/s390x.

2004-12-15  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/s390/s390-32/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.
	* sysdeps/unix/sysv/linux/s390/s390-64/clone.S (__clone): Likewise.
nptl/
	* sysdeps/unix/sysv/linux/s390/s390-32/clone.S: New file.
	* sysdeps/unix/sysv/linux/s390/s390-64/clone.S: New file.
	* sysdeps/s390/tcb-offsets.sym (TID): Add.

--- libc/sysdeps/unix/sysv/linux/s390/s390-32/clone.S	1 Jul 2004 17:34:29 -0000	1.8
+++ libc/sysdeps/unix/sysv/linux/s390/s390-32/clone.S	15 Dec 2004 12:20:45 -0000	1.8.2.2
@@ -21,6 +21,7 @@
    and invokes a function in the right context after its all over.  */
 
 #include <sysdep.h>
+#include <tls.h>
 #define _ERRNO_H	1
 #include <bits/errno.h>
 
@@ -54,6 +55,18 @@ error:
 PSEUDO_END (__clone)
 	
 thread_start:
+#ifdef RESET_PID
+	tmh	%r3,1		/* CLONE_THREAD == 0x00010000 */
+	jne	1f
+	lhi	%r2,-1
+	tml	%r3,256		/* CLONE_VM == 0x00000100 */
+	jne	2f
+	svc	SYS_ify(getpid)
+2:	ear	%r3,%a0
+	st	%r2,PID(%r3)
+	st	%r2,TID(%r3)
+1:
+#endif
 	/* fn is in gpr 1, arg in gpr 0 */
 	lr      %r2,%r0         /* set first parameter to void *arg */
 	ahi     %r15,-96        /* make room on the stack for the save area */
--- libc/sysdeps/unix/sysv/linux/s390/s390-64/clone.S	1 Jul 2004 17:34:30 -0000	1.10
+++ libc/sysdeps/unix/sysv/linux/s390/s390-64/clone.S	15 Dec 2004 12:20:47 -0000	1.10.2.2
@@ -22,6 +22,7 @@
    and invokes a function in the right context after its all over.  */
 
 #include <sysdep.h>
+#include <tls.h>
 #define _ERRNO_H	1
 #include <bits/errno.h>
 
@@ -55,6 +56,20 @@ error:
 PSEUDO_END (__clone)
 
 thread_start:
+#ifdef RESET_PID
+	tmh	%r3,1		/* CLONE_THREAD == 0x00010000 */
+	jne	1f
+	lhi	%r2,-1
+	tml	%r3,256		/* CLONE_VM == 0x00000100 */
+	jne	2f
+	svc	SYS_ify(getpid)
+2:	ear	%r3,%a0
+	sllg	%r3,%r3,32
+	ear	%r3,%a1
+	st	%r2,PID(%r3)
+	st	%r2,TID(%r3)
+1:
+#endif
 	/* fn is in gpr 1, arg in gpr 0 */
 	lgr	%r2,%r0		/* set first parameter to void *arg */
 	aghi	%r15,-160	/* make room on the stack for the save area */
--- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/clone.S 1 Jan 1970 00:00:00 -0000
+++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/clone.S	15 Dec 2004 09:53:45 -0000	1.1.2.1
@@ -0,0 +1,2 @@
+#define RESET_PID
+#include <sysdeps/unix/sysv/linux/s390/s390-32/clone.S>
--- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/clone.S 1 Jan 1970 00:00:00 -0000
+++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/clone.S	15 Dec 2004 09:53:45 -0000	1.1.2.1
@@ -0,0 +1,2 @@
+#define RESET_PID
+#include <sysdeps/unix/sysv/linux/s390/s390-64/clone.S>
--- libc/nptl/sysdeps/s390/tcb-offsets.sym	10 Mar 2004 18:59:29 -0000	1.2
+++ libc/nptl/sysdeps/s390/tcb-offsets.sym	15 Dec 2004 09:53:44 -0000	1.2.2.1
@@ -3,3 +3,4 @@
 
 MULTIPLE_THREADS_OFFSET		offsetof (tcbhead_t, multiple_threads)
 PID				offsetof (struct pthread, pid)
+TID				offsetof (struct pthread, tid)

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-12-15 14:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-14 17:14 [PATCH] Fix nptl/tst-getpid{1,2} on s390{,x} Jakub Jelinek
2004-12-15 14:07 ` [PATCH] Fix nptl/tst-getpid{1,2} on s390{,x} (take 2) Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).