summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/powerpc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-12-15 09:16:13 +0000
committerJakub Jelinek <jakub@redhat.com>2004-12-15 09:16:13 +0000
commit0d60d7de5db10af7b1c1574520d3ab3c0f64d530 (patch)
tree55297be0fea4f11809c37ce1573cb7c564c22dcc /sysdeps/unix/sysv/linux/powerpc
parent1b88b322d45419e79aff6b3b1fc2e59b78d6818d (diff)
Updated to fedora-glibc-20041215T0847
Diffstat (limited to 'sysdeps/unix/sysv/linux/powerpc')
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S42
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S31
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S1
9 files changed, 74 insertions, 9 deletions
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
index 11768bcbb7..891cf83631 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)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
index 233697bf5e..3f74f55271 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
@@ -29,6 +29,7 @@
.tc __curbrk[TC],__curbrk
.section ".text"
ENTRY (BP_SYM (__brk))
+ CALL_MCOUNT 1
DISCARD_BOUNDS (r3) /* the bounds are meaningless, so toss 'em. */
stdu r1,-64(r1)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
index 1386b2fa22..be069c90c8 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
@@ -23,6 +23,9 @@
#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. */
@@ -32,6 +35,7 @@
void *tls [r8], void *child_tid [r9]); */
ENTRY (BP_SYM (__clone))
+ CALL_MCOUNT 7
/* GKM FIXME: add bounds checks, where sensible. */
DISCARD_BOUNDS (r4)
DISCARD_BOUNDS (r6)
@@ -44,10 +48,13 @@ ENTRY (BP_SYM (__clone))
beq- cr0,L(badargs)
/* Set up stack frame for parent. */
- stdu r1,-80(r1)
+ stdu r1,-88(r1)
std r29,56(r1)
std r30,64(r1)
std r31,72(r1)
+#ifdef RESET_PID
+ std r28,80(r1)
+#endif
/* Set up stack frame for child. */
clrrdi r4,r4,4
@@ -57,6 +64,9 @@ ENTRY (BP_SYM (__clone))
/* Save fn, args, stack across syscall. */
mr r29,r3 /* Function in r29. */
mr r30,r4 /* Stack pointer in r30. */
+#ifdef RESET_PID
+ mr r28,r5 /* Flags in r28. */
+#endif
mr r31,r6 /* Argument in r31. */
/* 'flags' argument is first parameter to clone syscall. (The other
@@ -80,6 +90,20 @@ ENTRY (BP_SYM (__clone))
it adds a race condition if a signal is sent to a thread
just after it is created (in the previous three instructions). */
mr r1,r30
+
+#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(r13)
+ stw r3,PID(r13)
+L(oldpid):
+#endif
+
/* Call procedure. */
ld r0,0(r29)
ld r2,8(r29)
@@ -95,10 +119,13 @@ ENTRY (BP_SYM (__clone))
L(parent):
/* Parent. Restore registers & return. */
+#ifdef RESET_PID
+ ld r28,88(r1)
+#endif
ld r31,72(r1)
ld r30,64(r1)
ld r29,56(r1)
- addi r1,r1,80
+ addi r1,r1,88
bnslr+
b JUMPTARGET(__syscall_error)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
index 851a171fa3..0f392366eb 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
@@ -30,6 +30,7 @@
#if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)
ENTRY(__novec_getcontext)
+ CALL_MCOUNT 1
#ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL
std r0,(SIGCONTEXT_GP_REGS+(PT_R0*8))(r3)
std r1,(SIGCONTEXT_GP_REGS+(PT_R1*8))(r3)
@@ -167,6 +168,7 @@ compat_symbol (libc, __novec_getcontext, getcontext, GLIBC_2_3)
.machine "altivec"
ENTRY(__getcontext)
+ CALL_MCOUNT 1
#ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL
std r0,(SIGCONTEXT_GP_REGS+(PT_R0*8))(r3)
std r1,(SIGCONTEXT_GP_REGS+(PT_R1*8))(r3)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
index adfeb3ee72..8034559200 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
@@ -26,6 +26,7 @@
#include <asm/errno.h>
ENTRY(__makecontext)
+ CALL_MCOUNT 3
#ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL
/* Save parameters into the parameter save area of callers frame. */
std r3,FRAME_PARM1_SAVE(r1) /* ucontext_t *ucp */
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
index 278489fb36..6514f442a6 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
@@ -29,6 +29,7 @@
#if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)
ENTRY(__novec_setcontext)
+ CALL_MCOUNT 1
#ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL
mflr r0
std r31,-8(1)
@@ -194,6 +195,7 @@ compat_symbol (libc, __novec_setcontext, setcontext, GLIBC_2_3)
.machine "altivec"
ENTRY(__setcontext)
+ CALL_MCOUNT 1
#ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL
mflr r0
std r31,-8(1)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
index a6dbcea24f..ec3ab5d9e6 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
@@ -51,6 +51,7 @@
.text
ENTRY(__socket)
+ CALL_MCOUNT NARGS
cfi_startproc
stdu r1,-144(r1)
cfi_adjust_cfa_offset(144)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
index ad1ba6963b..6644c8abff 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
@@ -29,6 +29,7 @@
#if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)
ENTRY(__novec_swapcontext)
+ CALL_MCOUNT 2
#ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL
std r0,(SIGCONTEXT_GP_REGS+(PT_R0*8))(r3)
std r1,(SIGCONTEXT_GP_REGS+(PT_R1*8))(r3)
@@ -289,6 +290,7 @@ compat_symbol (libc, __novec_swapcontext, swapcontext, GLIBC_2_3)
.machine "altivec"
ENTRY(__swapcontext)
+ CALL_MCOUNT 2
#ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL
std r0,(SIGCONTEXT_GP_REGS+(PT_R0*8))(r3)
std r1,(SIGCONTEXT_GP_REGS+(PT_R1*8))(r3)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S
index d36b917e1c..2f5df38cf8 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S
@@ -27,6 +27,7 @@
and the process ID of the new process to the old process. */
ENTRY (__vfork)
+ CALL_MCOUNT 0
#ifdef __NR_vfork