aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-15 08:11:12 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-15 08:11:12 +0000
commit917fbe706900299552cfaf34d78ef66d8f128577 (patch)
tree9ee82275ad18a8f2d0d57e53be63a81ec979750d
parent1f9d7c2739c9442d07c5578920824abb4a3bf509 (diff)
downloadglibc-917fbe706900299552cfaf34d78ef66d8f128577.zip
glibc-917fbe706900299552cfaf34d78ef66d8f128577.tar.gz
glibc-917fbe706900299552cfaf34d78ef66d8f128577.tar.bz2
2004-12-15 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: Add support for pid caching in nptl.
-rw-r--r--ChangeLog5
-rw-r--r--nptl/ChangeLog4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S3
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S42
4 files changed, 47 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 35a3ac1..87a39a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-12-15 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: Add support
+ for pid caching in nptl.
+
2004-12-14 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Add support
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index e44a856..c347eb7 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,7 @@
+2004-12-15 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: New file.
+
2004-12-14 Ulrich Drepper <drepper@redhat.com>
* sysdeps/powerpc/tcb-offsets.sym: Add TID.
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
new file mode 100644
index 0000000..e19579e
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
@@ -0,0 +1,3 @@
+#define RESET_PID
+#include <tcb-offsets.h>
+#include <sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S>
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
index 11768bc..891cf83 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
@@ -1,5 +1,5 @@
/* Wrapper around clone system call.
- Copyright (C) 1997,98,99,2000,02 Free Software Foundation, Inc.
+ Copyright (C) 1997,98,99,2000,02,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,6 +24,10 @@
#include <bp-sym.h>
#include <bp-asm.h>
+#define CLONE_VM 0x00000100
+#define CLONE_THREAD 0x00010000
+
+
/* This is the only really unusual system call in PPC linux, but not
because of any weirdness in the system call itself; because of
all the freaky stuff we have to do to make the call useful. */
@@ -44,11 +48,15 @@ ENTRY (BP_SYM (__clone))
beq- cr0,L(badargs)
/* Set up stack frame for parent. */
- stwu r1,-32(r1)
-#ifndef __ASSUME_FIXED_CLONE_SYSCALL
- stmw r29,16(r1)
+ stwu r1,-36(r1)
+#ifdef RESET_PID
+ stmw r28,16(r1)
#else
+# ifndef __ASSUME_FIXED_CLONE_SYSCALL
+ stmw r29,16(r1)
+# else
stmw r30,16(r1)
+# endif
#endif
/* Set up stack frame for child. */
@@ -61,6 +69,9 @@ ENTRY (BP_SYM (__clone))
#ifndef __ASSUME_FIXED_CLONE_SYSCALL
mr r29,r4 /* Stack pointer in r29. */
#endif
+#ifdef RESET_PID
+ mr r28,r5
+#endif
mr r31,r6 /* Argument in r31. */
/* 'flags' argument is first parameter to clone syscall. (The other
@@ -88,6 +99,19 @@ ENTRY (BP_SYM (__clone))
mr r1,r29
#endif
+#ifdef RESET_PID
+ andis. r0,r28,1 /* This is & CLONE_THREAD */
+ bne+ r0,L(oldpid)
+ andi. r0,r28,CLONE_VM
+ li r3,-1
+ bne- r0,L(nomoregetpid)
+ DO_CALL(SYS_ify(getpid))
+L(nomoregetpid):
+ stw r3,TID(r2)
+ stw r3,PID(r2)
+L(oldpid):
+#endif
+
/* Call procedure. */
mtctr r30
mr r3,r31
@@ -97,12 +121,16 @@ ENTRY (BP_SYM (__clone))
L(parent):
/* Parent. Restore registers & return. */
-#ifndef __ASSUME_FIXED_CLONE_SYSCALL
- lmw r29,16(r1)
+#ifdef RESET_PID
+ lmw r28,16(r1)
#else
+# ifndef __ASSUME_FIXED_CLONE_SYSCALL
+ lmw r29,16(r1)
+# else
lmw r30,16(r1)
+# endif
#endif
- addi r1,r1,32
+ addi r1,r1,36
bnslr+
b JUMPTARGET(__syscall_error)