From bddde5860ffb8a78587854cc8e3e914bd69269ca Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 22 Jan 2017 10:24:51 +0100 Subject: remove PID caching Follow GNU C Library from c579f48edba88380635ab98cb612030e3ed8691e and remove the PID caching. These simplifies the architecture specific assembly code. The run of the test suite found no regressions, it even solves some of the test failures for x86/x86_64/sparc. Reviewed-by: Max Filippov Reviewed-by: Vineet Gupta Acked-by: Matthew Fortune Acked-by: Alexey Brodkin --- libc/sysdeps/linux/xtensa/Makefile.arch | 4 +--- libc/sysdeps/linux/xtensa/clone.S | 19 ------------------- libc/sysdeps/linux/xtensa/vfork.S | 25 ------------------------- 3 files changed, 1 insertion(+), 47 deletions(-) (limited to 'libc/sysdeps/linux/xtensa') 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 #define _ERRNO_H 1 #include -#ifdef RESET_PID -#include -#endif #define __ASSEMBLY__ #include @@ -74,21 +71,6 @@ ENTRY (__clone) #if CLONE_THREAD != 0x00010000 || CLONE_VM != 0x00000100 # 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 */ @@ -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 -- cgit v1.2.3