diff options
author | Waldemar Brodkorb <wbx@openadk.org> | 2017-01-22 10:24:51 +0100 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2017-01-28 10:31:19 +0100 |
commit | bddde5860ffb8a78587854cc8e3e914bd69269ca (patch) | |
tree | d37c90a9ca983fb8be614844343ba2941927f88a | |
parent | 30adfbeb8843c28869cc6ee33d7c556721cb241a (diff) |
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 <jcmvbkbc@gmail.com>
Reviewed-by: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Acked-by: Matthew Fortune <Matthew.Fortune@imgtec.com>
Acked-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
99 files changed, 150 insertions, 1261 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 |