summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
Diffstat (limited to 'libc')
-rw-r--r--libc/sysdeps/linux/arc/clone.S13
-rw-r--r--libc/sysdeps/linux/arc/vfork.S13
-rw-r--r--libc/sysdeps/linux/arm/clone.S18
-rw-r--r--libc/sysdeps/linux/arm/vfork.S13
-rw-r--r--libc/sysdeps/linux/common/bits/kernel-features.h7
-rw-r--r--libc/sysdeps/linux/i386/Makefile.arch7
-rw-r--r--libc/sysdeps/linux/i386/clone.S8
-rw-r--r--libc/sysdeps/linux/i386/vfork.S8
-rw-r--r--libc/sysdeps/linux/ia64/clone2.S19
-rw-r--r--libc/sysdeps/linux/metag/clone.S21
-rw-r--r--libc/sysdeps/linux/metag/vfork.S12
-rw-r--r--libc/sysdeps/linux/mips/Makefile.arch4
-rw-r--r--libc/sysdeps/linux/mips/clone.S28
-rw-r--r--libc/sysdeps/linux/mips/vfork.S12
-rw-r--r--libc/sysdeps/linux/nds32/clone.S24
-rw-r--r--libc/sysdeps/linux/nds32/vfork.S14
-rw-r--r--libc/sysdeps/linux/nios2/clone.S8
-rw-r--r--libc/sysdeps/linux/nios2/vfork.S17
-rw-r--r--libc/sysdeps/linux/powerpc/Makefile.arch4
-rw-r--r--libc/sysdeps/linux/powerpc/clone.S30
-rw-r--r--libc/sysdeps/linux/sh/Makefile.arch7
-rw-r--r--libc/sysdeps/linux/sh/clone.S36
-rw-r--r--libc/sysdeps/linux/sparc/Makefile.arch8
-rw-r--r--libc/sysdeps/linux/sparc/clone.S17
-rw-r--r--libc/sysdeps/linux/sparc/vfork.S2
-rw-r--r--libc/sysdeps/linux/x86_64/Makefile.arch6
-rw-r--r--libc/sysdeps/linux/x86_64/clone.S13
-rw-r--r--libc/sysdeps/linux/x86_64/vfork.S8
-rw-r--r--libc/sysdeps/linux/xtensa/Makefile.arch4
-rw-r--r--libc/sysdeps/linux/xtensa/clone.S19
-rw-r--r--libc/sysdeps/linux/xtensa/vfork.S25
31 files changed, 20 insertions, 405 deletions
diff --git a/libc/sysdeps/linux/arc/clone.S b/libc/sysdeps/linux/arc/clone.S
index 3942b88f7..c2ce906c9 100644
--- a/libc/sysdeps/linux/arc/clone.S
+++ b/libc/sysdeps/linux/arc/clone.S
@@ -61,20 +61,9 @@ ENTRY(clone)
; Setup TP register (since kernel doesn't do that)
and.f 0, r12, CLONE_SETTLS
bz .Lnext_clone_quirk
- SET_TP r9
+ mov r25, r9
.Lnext_clone_quirk:
-#ifdef RESET_PID
- bbit1 r12, 16, .Lgo_thread ; CLONE_THREAD = (1 << 16)
-
- mov r8, __NR_getpid
- ARC_TRAP_INSN ; r0 has PID
- THREAD_SELF r1 ; Get to struct pthread (just before TCB)
- st r0, [r1, PTHREAD_PID]
- st r0, [r1, PTHREAD_TID]
-
-.Lgo_thread:
-#endif
#endif
; child jumps off to @fn with @arg as argument, and returns here
jl.d [r10]
diff --git a/libc/sysdeps/linux/arc/vfork.S b/libc/sysdeps/linux/arc/vfork.S
index 573a29f26..11959b66b 100644
--- a/libc/sysdeps/linux/arc/vfork.S
+++ b/libc/sysdeps/linux/arc/vfork.S
@@ -16,25 +16,12 @@
#define CLONE_FLAGS_FOR_VFORK (CLONE_VM|CLONE_VFORK|SIGCHLD)
ENTRY(__vfork)
-#ifdef SAVE_PID
- THREAD_SELF r1 ; Get to struct pthread (just before TCB)
- ld r2, [r1, PTHREAD_PID]
- neg.f r3, r2
- bset.z r3, r3, 31
- st r3, [r1, PTHREAD_PID]
-#endif
mov r0, CLONE_FLAGS_FOR_VFORK
mov_s r1, sp
mov r8, __NR_clone
ARC_TRAP_INSN
cmp r0, 0
-#ifdef RESTORE_PID
- bz 1f ; child continues
- THREAD_SELF r1 ; Get to struct pthread (just before TCB)
- st r2, [r1, PTHREAD_PID]
-1:
-#endif
jge [blink] ; pid >=0 return, else detour via tailcall to errno
b __syscall_error
diff --git a/libc/sysdeps/linux/arm/clone.S b/libc/sysdeps/linux/arm/clone.S
index 0b293ecb7..b156e932b 100644
--- a/libc/sysdeps/linux/arm/clone.S
+++ b/libc/sysdeps/linux/arm/clone.S
@@ -110,9 +110,6 @@ __clone:
@ do the system call
@ get flags
mov r0, r2
-#ifdef RESET_PID
- mov ip, r2
-#endif
@ new sp is already in r1
push {r4, r7}
cfi_adjust_cfa_offset (8)
@@ -138,21 +135,6 @@ PSEUDO_END (__clone)
1:
.fnstart
.cantunwind
-#ifdef RESET_PID
- tst ip, #CLONE_THREAD
- bne 3f
- GET_TLS (lr)
- mov r1, r0
- tst ip, #CLONE_VM
- ldr r7, =SYS_ify(getpid)
- ite ne
- movne r0, #-1
- swieq 0x0
- NEGOFF_ADJ_BASE (r1, TID_OFFSET)
- str r0, NEGOFF_OFF1 (r1, TID_OFFSET)
- str r0, NEGOFF_OFF2 (r1, PID_OFFSET, TID_OFFSET)
-3:
-#endif
@ pick the function arg and call address off the stack and execute
ldr r0, [sp, #4]
mov lr, pc
diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S
index 221a90c40..455b2f8d9 100644
--- a/libc/sysdeps/linux/arm/vfork.S
+++ b/libc/sysdeps/linux/arm/vfork.S
@@ -13,15 +13,6 @@
#include <bits/errno.h>
#include <sys/syscall.h>
-#ifndef SAVE_PID
-#define SAVE_PID
-#endif
-
-#ifndef RESTORE_PID
-#define RESTORE_PID
-#endif
-
-
#ifdef __NR_fork
.text
.global __vfork
@@ -33,9 +24,7 @@
.thumb_func
__vfork:
#ifdef __NR_vfork
- SAVE_PID
DO_CALL (vfork)
- RESTORE_PID
ldr r1, =0xfffff000
cmp r0, r1
bcs 1f
@@ -69,9 +58,7 @@ __error:
__vfork:
#ifdef __NR_vfork
- SAVE_PID
DO_CALL (vfork)
- RESTORE_PID
cmn r0, #4096
IT(t, cc)
BXC(cc, lr)
diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
index 0b3632063..e0195e405 100644
--- a/libc/sysdeps/linux/common/bits/kernel-features.h
+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
@@ -375,13 +375,6 @@
# define __ASSUME_AT_SECURE 1
#endif
-/* Starting with the 2.5.75 kernel the kernel fills in the correct value
- in the si_pid field passed as part of the siginfo_t struct to signal
- handlers. */
-#if __LINUX_KERNEL_VERSION >= 132427
-# define __ASSUME_CORRECT_SI_PID 1
-#endif
-
/* The utimes syscall has been available for some architectures
forever. For x86 it was introduced after 2.5.75, for x86-64,
ppc, and ppc64 it was introduced in 2.6.0-test3. */
diff --git a/libc/sysdeps/linux/i386/Makefile.arch b/libc/sysdeps/linux/i386/Makefile.arch
index e1739e193..6c9eed897 100644
--- a/libc/sysdeps/linux/i386/Makefile.arch
+++ b/libc/sysdeps/linux/i386/Makefile.arch
@@ -6,11 +6,8 @@
#
CSRC-y := brk.c __syscall_error.c sigaction.c
-
-SSRC-y := \
- __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
- sync_file_range.S syscall.S mmap.S mmap64.S
+SSRC-y := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
+ sync_file_range.S syscall.S mmap.S mmap64.S vfork.S clone.S
SSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.S
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += vfork.S clone.S
SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.S setcontext.S getcontext.S swapcontext.S
diff --git a/libc/sysdeps/linux/i386/clone.S b/libc/sysdeps/linux/i386/clone.S
index 632cf59df..68e87b567 100644
--- a/libc/sysdeps/linux/i386/clone.S
+++ b/libc/sysdeps/linux/i386/clone.S
@@ -78,10 +78,6 @@ clone:
movl %eax,8(%ecx)
/* Don't leak any information. */
movl $0,4(%ecx)
-#ifndef RESET_PID
- movl $0,(%ecx)
-#endif
-
/* Do the system call */
pushl %ebx
@@ -92,10 +88,6 @@ clone:
movl FLAGS+12(%esp),%ebx
movl CTID+12(%esp),%edi
movl $__NR_clone,%eax
-#ifdef RESET_PID
- /* Remember the flag value. */
- movl %ebx, (%ecx)
-#endif
int $0x80
popl %edi
popl %esi
diff --git a/libc/sysdeps/linux/i386/vfork.S b/libc/sysdeps/linux/i386/vfork.S
index d85726f19..6c4102e0a 100644
--- a/libc/sysdeps/linux/i386/vfork.S
+++ b/libc/sysdeps/linux/i386/vfork.S
@@ -19,18 +19,10 @@
__vfork:
popl %ecx
-#ifdef SAVE_PID
- SAVE_PID
-#endif
-
movl $__NR_vfork,%eax
int $0x80
pushl %ecx
-#ifdef RESTORE_PID
- RESTORE_PID
-#endif
-
cmpl $-4095,%eax
jae __syscall_error
ret
diff --git a/libc/sysdeps/linux/ia64/clone2.S b/libc/sysdeps/linux/ia64/clone2.S
index c077f722a..692ee3600 100644
--- a/libc/sysdeps/linux/ia64/clone2.S
+++ b/libc/sysdeps/linux/ia64/clone2.S
@@ -16,11 +16,8 @@
<http://www.gnu.org/licenses/>. */
#include "sysdep.h"
-
-#include "sysdep.h"
#include <asm/errno.h>
-
/* int __clone2(int (*fn) (void *arg), void *child_stack_base, */
/* size_t child_stack_size, int flags, void *arg, */
/* pid_t *parent_tid, void *tls, pid_t *child_tid) */
@@ -68,22 +65,6 @@ ENTRY(__clone2)
(CHILD) mov loc0=gp
(PARENT) ret
;;
-#ifdef RESET_PID
- tbit.nz p6,p0=in3,16 /* CLONE_THREAD */
- tbit.z p7,p10=in3,8 /* CLONE_VM */
-(p6) br.cond.dptk 1f
- ;;
- mov r15=SYS_ify (getpid)
-(p10) addl r8=-1,r0
-(p7) break __BREAK_SYSCALL
- ;;
- add r9=PID,r13
- add r10=TID,r13
- ;;
- st4 [r9]=r8
- st4 [r10]=r8
- ;;
-#endif
1: ld8 out1=[in0],8 /* Retrieve code pointer. */
mov out0=in4 /* Pass proper argument to fn */
;;
diff --git a/libc/sysdeps/linux/metag/clone.S b/libc/sysdeps/linux/metag/clone.S
index d9d836338..4687cbc0f 100644
--- a/libc/sysdeps/linux/metag/clone.S
+++ b/libc/sysdeps/linux/metag/clone.S
@@ -52,27 +52,6 @@ __clone:
! BRKPNT
! We are the child
-#ifdef RESET_PID
- SETL [A0StP++], D0FrT, D1RtP
- MOVT D0FrT, #HI(CLONE_THREAD)
- ADD D0FrT, D0FrT, #LO(CLONE_THREAD)
- ANDS D0FrT, D0FrT, D1Ar1
- BNZ 3f
- MOVT D0FrT, #HI(CLONE_VM)
- ADD D0FrT, D0FrT, #LO(CLONE_VM)
- ANDS D0FrT, D0FrT, D1Ar1
- BZ 1f
- MOV D1Ar1, #-1
- BA 2f
-1: MOV D1Re0, #__NR_getpid
- SWITCH #0x440001
- MOV D1Ar1, D0Re0
-2: CALLR D1RtP, __CLONE_METAG_LOAD_TP
- SUB D0Re0, D0Re0, #TLS_PRE_TCB_SIZE
- SETD [D0Re0 + #PID], D1Ar1
- SETD [D0Re0 + #TID], D1Ar1
-3: GETL D0FrT, D1RtP, [--A0StP]
-#endif
! Rearrange the function arg and call address from registers
MOV D0Ar2, D0FrT
MOV D1Ar1, D0Ar6
diff --git a/libc/sysdeps/linux/metag/vfork.S b/libc/sysdeps/linux/metag/vfork.S
index 8573dedd3..5e2fc8808 100644
--- a/libc/sysdeps/linux/metag/vfork.S
+++ b/libc/sysdeps/linux/metag/vfork.S
@@ -8,14 +8,6 @@
#include <bits/errno.h>
#include <sys/syscall.h>
-#ifndef SAVE_PID
-#define SAVE_PID
-#endif
-
-#ifndef RESTORE_PID
-#define RESTORE_PID
-#endif
-
#ifdef __NR_vfork
#define __VFORK_NR __NR_vfork
#else
@@ -33,8 +25,6 @@
.type ___vfork, @function
___vfork:
- SAVE_PID
-
MOV D1Ar1, #0x4111 /* CLONE_VM | CLONE_VFORK | SIGCHLD */
MOV D0Ar2, #0
MOV D1Ar3, #0
@@ -44,8 +34,6 @@ ___vfork:
MOV D1Re0, #__NR_clone
SWITCH #0x440001
- RESTORE_PID
-
MOVT D1Re0, #HI(-4096)
ADD D1Re0, D1Re0, #LO(-4096)
CMP D1Re0, D0Re0
diff --git a/libc/sysdeps/linux/mips/Makefile.arch b/libc/sysdeps/linux/mips/Makefile.arch
index 10deedc3e..5e54b07a6 100644
--- a/libc/sysdeps/linux/mips/Makefile.arch
+++ b/libc/sysdeps/linux/mips/Makefile.arch
@@ -9,11 +9,11 @@ CSRC-y := \
__longjmp.c brk.c setjmp_aux.c \
pread_write.c sigaction.c _test_and_set.c
-SSRC-y := bsd-_setjmp.S bsd-setjmp.S setjmp.S syscall.S pipe.S syscall_error.S
+SSRC-y := bsd-_setjmp.S bsd-setjmp.S setjmp.S syscall.S pipe.S syscall_error.S \
+ vfork.S clone.S
CSRC-$(UCLIBC_LINUX_SPECIFIC) += cacheflush.c sysmips.c
CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise.c posix_fadvise64.c
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += vfork.S clone.S
SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.S setcontext.S getcontext.S \
swapcontext.S
diff --git a/libc/sysdeps/linux/mips/clone.S b/libc/sysdeps/linux/mips/clone.S
index 1b5a8f472..326d1d34a 100644
--- a/libc/sysdeps/linux/mips/clone.S
+++ b/libc/sysdeps/linux/mips/clone.S
@@ -24,9 +24,6 @@
#include <sysdep.h>
#define _ERRNO_H 1
#include <bits/errno.h>
-#ifdef RESET_PID
-#include <tls.h>
-#endif
#define CLONE_VM 0x00000100
#define CLONE_THREAD 0x00010000
@@ -61,9 +58,6 @@ NESTED(clone,4*SZREG,sp)
PTR_SUBU a1,32 /* Reserve argument save space. */
PTR_S a0,0(a1) /* Save function pointer. */
PTR_S a3,PTRSIZE(a1) /* Save argument pointer. */
-#ifdef RESET_PID
- LONG_S a2,(PTRSIZE*2)(a1) /* Save clone flags. */
-#endif
move a0,a2
@@ -122,14 +116,6 @@ L(thread_start):
SAVE_GP (GPOFF)
/* The stackframe has been created on entry of clone(). */
-#ifdef RESET_PID
- /* Check and see if we need to reset the PID. */
- LONG_L a0,(PTRSIZE*2)(sp)
- and a1,a0,CLONE_THREAD
- beqz a1,L(restore_pid)
-L(donepid):
-#endif
-
/* Restore the arg for user's function. */
PTR_L t9,0(sp) /* Function pointer. */
PTR_L a0,PTRSIZE(sp) /* Argument pointer. */
@@ -146,20 +132,6 @@ L(donepid):
jal _exit
#endif
-#ifdef RESET_PID
-L(restore_pid):
- and a1,a0,CLONE_VM
- li v0,-1
- bnez a1,L(gotpid)
- li v0,__NR_getpid
- syscall
-L(gotpid):
- READ_THREAD_POINTER(v1)
- INT_S v0,PID_OFFSET(v1)
- INT_S v0,TID_OFFSET(v1)
- b L(donepid)
-#endif
-
END(__thread_start)
weak_alias(clone, __clone)
diff --git a/libc/sysdeps/linux/mips/vfork.S b/libc/sysdeps/linux/mips/vfork.S
index 494c34fd0..f504c2bb0 100644
--- a/libc/sysdeps/linux/mips/vfork.S
+++ b/libc/sysdeps/linux/mips/vfork.S
@@ -21,14 +21,6 @@
#include <sys/asm.h>
#include <sysdep.h>
-#ifndef SAVE_PID
-#define SAVE_PID
-#endif
-
-#ifndef RESTORE_PID
-#define RESTORE_PID
-#endif
-
#ifdef __NR_fork
/* int vfork() */
@@ -50,8 +42,6 @@ NESTED(__vfork,FRAMESZ,sp)
PTR_ADDU sp, FRAMESZ
- SAVE_PID
-
li a0, 0x4112 /* CLONE_VM | CLONE_VFORK | SIGCHLD */
move a1, sp
@@ -59,8 +49,6 @@ NESTED(__vfork,FRAMESZ,sp)
li v0,__NR_clone
syscall
- RESTORE_PID
-
bnez a3,L(error)
/* Successful return from the parent or child. */
diff --git a/libc/sysdeps/linux/nds32/clone.S b/libc/sysdeps/linux/nds32/clone.S
index 1ed77fb2e..0e6e432de 100644
--- a/libc/sysdeps/linux/nds32/clone.S
+++ b/libc/sysdeps/linux/nds32/clone.S
@@ -28,10 +28,6 @@
#define _ERRNO_H 1
#include <bits/errno.h>
-#ifdef RESET_PID
-#include <tcb-offsets.h>
-#endif
-
#define CLONE_VM 0x00000100
#define CLONE_THREAD 0x00010000
@@ -131,27 +127,7 @@ ENTRY(__clone)
cfi_restore(fp)
#endif /* PIC */
ret
-
-#ifdef RESET_PID
4:
- cfi_undefined(lp)
- movi $r0, CLONE_THREAD ! Skip when CLONE_THREAD is set.
- and $r0, $r5, $r0
- bnez $r0, 8f
- movi $r0, CLONE_VM ! Value = -1 when CLONE_VM is set.
- and $r0, $r5, $r0
- beqz $r0, 6f
- movi $r0, -1
- j 7f
-6:
- __do_syscall(getpid) ! __do_syscall(gettid) ! __do_syscall(getpid)
-7:
- swi $r0, [$r25 + PID_OFFSET]
- swi $r0, [$r25 + TID_OFFSET]
-8:
-#else
-4:
-#endif
/* Only in child's stack. */
pop $r1 ! fn
pop $r0 ! arg
diff --git a/libc/sysdeps/linux/nds32/vfork.S b/libc/sysdeps/linux/nds32/vfork.S
index ac3fa30fd..ab32135fc 100644
--- a/libc/sysdeps/linux/nds32/vfork.S
+++ b/libc/sysdeps/linux/nds32/vfork.S
@@ -25,32 +25,18 @@
#define _ERRNO_H 1
#include <bits/errno.h>
-#ifndef SAVE_PID
-#define SAVE_PID
-#endif
-
-#ifndef RESTORE_PID
-#define RESTORE_PID
-#endif
/* Clone the calling process, but without copying the whole address space.
The calling process is suspended until the new process exits or is
replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
and the process ID of the new process to the old process. */
-
ENTRY (__vfork)
#ifdef PIC
.pic
#endif
#ifdef __NR_vfork
-# ifdef SAVE_PID
- SAVE_PID
-# endif
syscall __NR_vfork
-# ifdef RESTORE_PID
- RESTORE_PID
-# endif
bltz $r0, 2f
1:
ret
diff --git a/libc/sysdeps/linux/nios2/clone.S b/libc/sysdeps/linux/nios2/clone.S
index 0626d8aa2..04f06348c 100644
--- a/libc/sysdeps/linux/nios2/clone.S
+++ b/libc/sysdeps/linux/nios2/clone.S
@@ -24,10 +24,6 @@
#define _ERRNO_H 1
#include <bits/errno.h>
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-#include <tcb-offsets.h>
-#endif
-
#define CLONE_VM 0x00000100
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
@@ -64,10 +60,6 @@ thread_start:
andi r2, r4, CLONE_VM
bne r2, zero, 2f
DO_CALL (getpid, 0)
-#ifdef RESET_PID
- stw r2, PID_OFFSET(r23)
- stw r2, TID_OFFSET(r23)
-#endif
2:
ldw r5, 4(sp) /* Function pointer. */
ldw r4, 0(sp) /* Argument pointer. */
diff --git a/libc/sysdeps/linux/nios2/vfork.S b/libc/sysdeps/linux/nios2/vfork.S
index 99e4a73e1..2bef2a982 100644
--- a/libc/sysdeps/linux/nios2/vfork.S
+++ b/libc/sysdeps/linux/nios2/vfork.S
@@ -18,21 +18,7 @@
#include <sysdep.h>
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-#include <tcb-offsets.h>
-#endif
-
ENTRY(__vfork)
-
-#ifdef RESET_PID
- ldw r6, PID_OFFSET(r23)
- sub r7, zero, r6
- bne r7, zero, 2f
- movhi r7, %hi(0x80000000)
-2:
- stw r7, PID_OFFSET(r23)
-#endif
-
movi r4, 0x4111 /* (CLONE_VM | CLONE_VFORK | SIGCHLD) */
mov r5, zero
@@ -42,9 +28,6 @@ ENTRY(__vfork)
trap
beq r2, zero, 1f
-#ifdef RESET_PID
- stw r6, PID_OFFSET(r23)
-#endif
1:
ret
diff --git a/libc/sysdeps/linux/powerpc/Makefile.arch b/libc/sysdeps/linux/powerpc/Makefile.arch
index f0144e7b9..9dc27c4a5 100644
--- a/libc/sysdeps/linux/powerpc/Makefile.arch
+++ b/libc/sysdeps/linux/powerpc/Makefile.arch
@@ -10,9 +10,7 @@ CSRC-$(if $(UCLIBC_HAS_LONG_DOUBLE_MATH),,y) += copysignl.c
SSRC-y := \
__longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S brk.S \
- __uClibc_syscall.S syscall.S
-
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += clone.S vfork.S
+ __uClibc_syscall.S syscall.S clone.S vfork.S
ifeq ($(CONFIG_E500),y)
ARCH_HEADERS := fenv.h
diff --git a/libc/sysdeps/linux/powerpc/clone.S b/libc/sysdeps/linux/powerpc/clone.S
index 8efbbda1a..45319d00d 100644
--- a/libc/sysdeps/linux/powerpc/clone.S
+++ b/libc/sysdeps/linux/powerpc/clone.S
@@ -47,14 +47,10 @@ __clone:
/* Set up stack frame for parent. */
stwu r1,-32(r1)
cfi_adjust_cfa_offset (32)
-#ifdef RESET_PID
- stmw r28,16(r1)
-#else
-# ifndef __ASSUME_FIXED_CLONE_SYSCALL
+#ifndef __ASSUME_FIXED_CLONE_SYSCALL
stmw r29,16(r1)
-# else
+#else
stmw r30,16(r1)
-# endif
#endif
/* Set up stack frame for child. */
@@ -67,9 +63,6 @@ __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
@@ -101,17 +94,6 @@ __clone:
mr r1,r29
#endif
-#ifdef RESET_PID
- andis. r0,r28,CLONE_THREAD>>16
- bne+ r0,.Loldpid
- andi. r0,r28,CLONE_VM
- li r3,-1
- bne- r0,.Lnomoregetpid
-.Lnomoregetpid:
- stw r3,TID(r2)
- stw r3,PID(r2)
-.Loldpid:
-#endif
/* Call procedure. */
mtctr r30
mr r3,r31
@@ -121,14 +103,10 @@ __clone:
.Lparent:
/* Parent. Restore registers & return. */
-#ifdef RESET_PID
- lmw r28,16(r1)
-#else
-# ifndef __ASSUME_FIXED_CLONE_SYSCALL
+#ifndef __ASSUME_FIXED_CLONE_SYSCALL
lmw r29,16(r1)
-# else
+#else
lmw r30,16(r1)
-# endif
#endif
addi r1,r1,32
bnslr+
diff --git a/libc/sysdeps/linux/sh/Makefile.arch b/libc/sysdeps/linux/sh/Makefile.arch
index 99a77213b..6103381fd 100644
--- a/libc/sysdeps/linux/sh/Makefile.arch
+++ b/libc/sysdeps/linux/sh/Makefile.arch
@@ -6,10 +6,7 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC-y := \
- pipe.c __init_brk.c brk.c sbrk.c pread_write.c
-
-SSRC-y := setjmp.S __longjmp.S ___fpscr_values.S
+CSRC-y := pipe.c __init_brk.c brk.c sbrk.c pread_write.c
+SSRC-y := setjmp.S __longjmp.S ___fpscr_values.S clone.S vfork.S
CSRC-$(UCLIBC_LINUX_SPECIFIC) += cacheflush.c
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += clone.S vfork.S
diff --git a/libc/sysdeps/linux/sh/clone.S b/libc/sysdeps/linux/sh/clone.S
index 3ed6b25de..334f83f1a 100644
--- a/libc/sysdeps/linux/sh/clone.S
+++ b/libc/sysdeps/linux/sh/clone.S
@@ -23,9 +23,7 @@
#include <sysdep.h>
#define _ERRNO_H 1
#include <bits/errno.h>
-#ifdef RESET_PID
-#include <tcb-offsets.h>
-#endif
+
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
pid_t *ptid, void *tls, pid_t *ctid); */
@@ -85,29 +83,7 @@ ENTRY(__clone)
2:
/* terminate the stack frame */
mov #0, r14
-#ifdef RESET_PID
- mov r4, r0
- shlr16 r0
- tst #1, r0 // CLONE_THREAD = (1 << 16)
- bf/s 4f
- mov r4, r0
- /* new pid */
- shlr8 r0
- tst #1, r0 // CLONE_VM = (1 << 8)
- bf/s 3f
- mov #-1, r0
- mov #+SYS_ify(getpid), r3
- trapa #0x15
-3:
- stc gbr, r1
- mov.w .Lpidoff, r2
- add r1, r2
- mov.l r0, @r2
- mov.w .Ltidoff, r2
- add r1, r2
- mov.l r0, @r2
-4:
-#endif
+
/* thread starts */
mov.l @r15, r1
jsr @r1
@@ -138,12 +114,6 @@ ENTRY(__clone)
.long _GLOBAL_OFFSET_TABLE_
.L3:
.long PLTJMP(C_SYMBOL_NAME(_exit))
-#ifdef RESET_PID
-.Lpidoff:
- .word PID - TLS_PRE_TCB_SIZE
-.Ltidoff:
- .word TID - TLS_PRE_TCB_SIZE
-#endif
-PSEUDO_END (__clone)
+PSEUDO_END (__clone)
weak_alias (__clone, clone)
diff --git a/libc/sysdeps/linux/sparc/Makefile.arch b/libc/sysdeps/linux/sparc/Makefile.arch
index 92ea7d93f..be393b832 100644
--- a/libc/sysdeps/linux/sparc/Makefile.arch
+++ b/libc/sysdeps/linux/sparc/Makefile.arch
@@ -6,12 +6,8 @@
#
CSRC-y := brk.c __syscall_error.c sigaction.c
-
-SSRC-y := \
- __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
- syscall.S urem.S udiv.S umul.S sdiv.S rem.S pipe.S
-
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += fork.S vfork.S clone.S
+SSRC-y := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
+ syscall.S urem.S udiv.S umul.S sdiv.S rem.S pipe.S fork.S vfork.S clone.S
CSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.c
SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += getcontext.S setcontext.S swapcontext.S
diff --git a/libc/sysdeps/linux/sparc/clone.S b/libc/sysdeps/linux/sparc/clone.S
index 1d0e3e6e1..3ee88da78 100644
--- a/libc/sysdeps/linux/sparc/clone.S
+++ b/libc/sysdeps/linux/sparc/clone.S
@@ -22,9 +22,6 @@
#include <asm/errno.h>
#include <asm/unistd.h>
-#ifdef RESET_PID
-#include <tcb-offsets.h>
-#endif
#include <sysdep.h>
#define CLONE_VM 0x00000100
@@ -83,20 +80,6 @@ END(__clone)
.type __thread_start,@function
__thread_start:
-#ifdef RESET_PID
- sethi %hi(CLONE_THREAD), %l0
- andcc %g4, %l0, %g0
- bne 1f
- andcc %g4, CLONE_VM, %g0
- bne,a 2f
- mov -1,%o0
- set __NR_getpid,%g1
- ta 0x10
-2:
- st %o0,[%g7 + PID]
- st %o0,[%g7 + TID]
-1:
-#endif
mov %g0, %fp /* terminate backtrace */
call %g2
mov %g3,%o0
diff --git a/libc/sysdeps/linux/sparc/vfork.S b/libc/sysdeps/linux/sparc/vfork.S
index e5a3c303d..5b05e6476 100644
--- a/libc/sysdeps/linux/sparc/vfork.S
+++ b/libc/sysdeps/linux/sparc/vfork.S
@@ -16,8 +16,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Code taken from glibc2.2.2/sysdeps/unix/sysv/linux/sparc/vfork.S */
-
#include <sys/syscall.h>
#ifndef __NR_vfork
diff --git a/libc/sysdeps/linux/x86_64/Makefile.arch b/libc/sysdeps/linux/x86_64/Makefile.arch
index 2bc838f0e..d84e43daa 100644
--- a/libc/sysdeps/linux/x86_64/Makefile.arch
+++ b/libc/sysdeps/linux/x86_64/Makefile.arch
@@ -6,11 +6,9 @@
#
CSRC-y := brk.c __syscall_error.c sigaction.c
+SSRC-y := __longjmp.S setjmp.S syscall.S bsd-setjmp.S bsd-_setjmp.S \
+ vfork.S clone.S
-SSRC-y := \
- __longjmp.S setjmp.S syscall.S bsd-setjmp.S bsd-_setjmp.S
-
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += vfork.S clone.S
ARCH_OBJ_FILTEROUT-$(UCLIBC_LINUX_SPECIFIC) := sched_getcpu.c
ifeq ($(UCLIBC_LINUX_SPECIFIC),y)
SSRC-$(UCLIBC_HAS_TLS) += sched_getcpu.S
diff --git a/libc/sysdeps/linux/x86_64/clone.S b/libc/sysdeps/linux/x86_64/clone.S
index 374504140..3dda8da02 100644
--- a/libc/sysdeps/linux/x86_64/clone.S
+++ b/libc/sysdeps/linux/x86_64/clone.S
@@ -89,19 +89,6 @@ clone:
the outermost frame obviously. */
xorl %ebp, %ebp
-#ifdef RESET_PID
- testq $CLONE_THREAD, %rdi
- jne 1f
- testq $CLONE_VM, %rdi
- movl $-1, %eax
- jne 2f
- movl $__NR_getpid, %eax
- syscall
-2: movl %eax, %fs:PID
- movl %eax, %fs:TID
-1:
-#endif
-
/* Set up arguments for the function call. */
popq %rax /* Function to call. */
popq %rdi /* Argument. */
diff --git a/libc/sysdeps/linux/x86_64/vfork.S b/libc/sysdeps/linux/x86_64/vfork.S
index a8a2f6e4b..8e096bc3e 100644
--- a/libc/sysdeps/linux/x86_64/vfork.S
+++ b/libc/sysdeps/linux/x86_64/vfork.S
@@ -38,10 +38,6 @@ __vfork:
is preserved by the syscall and that we're allowed to destroy. */
popq %rdi
-#ifdef SAVE_PID
- SAVE_PID
-#endif
-
/* Stuff the syscall number in RAX and enter into the kernel. */
movl $__NR_vfork, %eax
syscall
@@ -49,10 +45,6 @@ __vfork:
/* Push back the return PC. */
pushq %rdi
-#ifdef RESTORE_PID
- RESTORE_PID
-#endif
-
cmpl $-4095, %eax
jae __syscall_error /* Branch forward if it failed. */
diff --git a/libc/sysdeps/linux/xtensa/Makefile.arch b/libc/sysdeps/linux/xtensa/Makefile.arch
index b9b6b87d5..23cd08ee5 100644
--- a/libc/sysdeps/linux/xtensa/Makefile.arch
+++ b/libc/sysdeps/linux/xtensa/Makefile.arch
@@ -6,9 +6,7 @@
#
CSRC-y := brk.c sigaction.c __syscall_error.c
-
SSRC-y := bsd-_setjmp.S bsd-setjmp.S setjmp.S clone.S \
- sigrestorer.S syscall.S mmap.S windowspill.S __longjmp.S vfork.S
+ sigrestorer.S syscall.S mmap.S windowspill.S __longjmp.S vfork.S
CSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += fork.c
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += clone.S
diff --git a/libc/sysdeps/linux/xtensa/clone.S b/libc/sysdeps/linux/xtensa/clone.S
index efdfcdd5e..913ec5a5f 100644
--- a/libc/sysdeps/linux/xtensa/clone.S
+++ b/libc/sysdeps/linux/xtensa/clone.S
@@ -21,9 +21,6 @@
#include <sysdep.h>
#define _ERRNO_H 1
#include <bits/errno.h>
-#ifdef RESET_PID
-#include <tls.h>
-#endif
#define __ASSEMBLY__
#include <linux/sched.h>
@@ -76,21 +73,6 @@ ENTRY (__clone)
# error invalid values for CLONE_THREAD or CLONE_VM
#endif
-#ifdef RESET_PID
- bbsi.l a6, 16, .Lskip_restore_pid /* CLONE_THREAD = 0x00010000 */
- movi a2, -1
- bbsi a6, 8, .Lgotpid /* CLONE_VM = 0x00000100 */
- movi a2, SYS_ify(getpid)
- syscall
-.Lgotpid:
- rur a3, threadptr
- movi a0, TLS_PRE_TCB_SIZE
- sub a3, a3, a0
- s32i a2, a3, PID
- s32i a2, a3, TID
-.Lskip_restore_pid:
-#endif
-
/* start child thread */
movi a0, 0 /* terminate the stack frame */
@@ -115,5 +97,4 @@ ENTRY (__clone)
#endif
PSEUDO_END (__clone)
-
weak_alias (__clone, clone)
diff --git a/libc/sysdeps/linux/xtensa/vfork.S b/libc/sysdeps/linux/xtensa/vfork.S
index 8058fb057..140ab775e 100644
--- a/libc/sysdeps/linux/xtensa/vfork.S
+++ b/libc/sysdeps/linux/xtensa/vfork.S
@@ -34,16 +34,6 @@
*/
-#ifndef SAVE_PID
-#define SAVE_PID(a,b,c,d)
-#endif
-#ifndef RESTORE_PID
-#define RESTORE_PID(a,b,c)
-#endif
-#ifndef RESTORE_PID12
-#define RESTORE_PID12(a,b,c)
-#endif
-
/*
pid_t vfork(void);
Implemented as __clone_syscall(CLONE_VFORK | CLONE_VM | SIGCHLD, 0)
@@ -73,8 +63,6 @@ HIDDEN_ENTRY (__vfork)
.L4: mov a12, a2
mov a13, a3
- SAVE_PID(a5,a15,a2,a3)
-
/* use syscall 'clone' and set new stack pointer to the same address */
movi a2, SYS_ify(clone)
@@ -83,8 +71,6 @@ HIDDEN_ENTRY (__vfork)
syscall
- RESTORE_PID(a5,a15,a2)
-
movi a5, -4096
mov a6, a2
@@ -102,16 +88,12 @@ HIDDEN_ENTRY (__vfork)
mov a13, a3
mov a14, a6
- SAVE_PID(a9,a15,a2,a3)
-
movi a2, SYS_ify(clone)
movi a3, 0
movi a6, CLONE_VM | CLONE_VFORK | SIGCHLD
syscall
- RESTORE_PID(a9,a15,a2)
-
movi a9, -4096
mov a10, a2
@@ -131,16 +113,12 @@ HIDDEN_ENTRY (__vfork)
mov a13, a3
mov a14, a6
- SAVE_PID (a2,a3,a2,a6)
-
movi a2, SYS_ify(clone)
movi a3, 0
movi a6, CLONE_VM | CLONE_VFORK | SIGCHLD
syscall
- RESTORE_PID12(a3,a6,a15)
-
mov a3, a13
movi a13, -4096
@@ -168,7 +146,6 @@ HIDDEN_ENTRY (__vfork)
.Lpseudo_end:
retw
#elif defined(__XTENSA_CALL0_ABI__)
- SAVE_PID(a5, a8, a3, a4)
/* Use syscall 'clone'. Set new stack pointer to the same address. */
movi a2, SYS_ify (clone)
@@ -176,8 +153,6 @@ HIDDEN_ENTRY (__vfork)
movi a6, CLONE_VM | CLONE_VFORK | SIGCHLD
syscall
- RESTORE_PID(a5, a8, a2)
-
movi a3, -4096
bgeu a2, a3, 1f
ret