diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-03-10 07:39:55 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-03-10 07:39:55 +0000 |
commit | c2e5e08573cd001c4f57f6c0b1c5f7708c6eca6d (patch) | |
tree | ef6b894ff829b65aa36338e66796e34f26a09415 /nptl/sysdeps/unix/sysv/linux/x86_64 | |
parent | cd4b2a553a5e0fa51f2ad74166b12820316ab66e (diff) | |
download | glibc-c2e5e08573cd001c4f57f6c0b1c5f7708c6eca6d.tar glibc-c2e5e08573cd001c4f57f6c0b1c5f7708c6eca6d.tar.gz glibc-c2e5e08573cd001c4f57f6c0b1c5f7708c6eca6d.tar.bz2 glibc-c2e5e08573cd001c4f57f6c0b1c5f7708c6eca6d.zip |
Update.
* sysdeps/unix/sysv/linux/x86_64/pthread_once.S: Fix many
leftovers from the ia32 code.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Remove unneccessary
memory load.
(clear_once_control): Don't load %esi.
* sysdeps/x86_64/tls.h: Remove all traces of segment descriptor
handling.
* sysdeps/unix/sysv/linux/x86_64/fork.c: New file.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/x86_64')
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/x86_64/fork.c | 31 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S | 38 |
2 files changed, 49 insertions, 20 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/fork.c b/nptl/sysdeps/unix/sysv/linux/x86_64/fork.c new file mode 100644 index 0000000000..c828e158d9 --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/fork.c @@ -0,0 +1,31 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sched.h> +#include <signal.h> +#include <sysdep.h> +#include <tls.h> + + +#define ARCH_FORK() \ + INLINE_SYSCALL (clone, 4, \ + CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD, 0, \ + NULL, &THREAD_SELF->tid) + +#include "../fork.c" diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S index 3871c0e1a2..43eadcf40a 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S @@ -38,18 +38,20 @@ __pthread_once: testl $2, (%rdi) jz 1f xorl %eax, %eax -0: ret + retq -1: xorq %rsi, %rsi + /* Preserve the function pointer. */ +1: pushq %rsi + xorq %r10, %r10 /* Not yet initialized or initialization in progress. Get the fork generation counter now. */ 6: movl (%rdi), %eax -5: movq %rax, %rdx +5: movl %eax, %edx testl $2, %eax - jnz 0b + jnz 4f andl $3, %edx orl __fork_generation(%rip), %edx @@ -70,8 +72,8 @@ __pthread_once: jnz 3f /* Different for generation -> run initializer. */ /* Somebody else got here first. Wait. */ - movq %rsi, %rcx /* movl $FUTEX_WAIT, %ecx */ - movl $SYS_futex, %eax + movq %r10, %rsi /* movl $FUTEX_WAIT, %ecx */ + movq $SYS_futex, %eax syscall jmp 6b @@ -88,14 +90,11 @@ __pthread_once: movq %rsp, %rdi call __pthread_cleanup_push /* Note: no @PLT. */ - movq 48(%rsp), %rax - call *%rax + call *40(%rsp) - /* Pop the cleanup handler. This code depends on the once - handler and _pthread_cleanup_push not touch the content - of the stack. Otherwise the first parameter would have - to be reloaded. */ - xorq %rdi, %rdi + /* Pop the cleanup handler. */ + movq %rsp, %rdi + xorq %rsi, %rsi call __pthread_cleanup_pop /* Note: no @PLT. */ addq $32, %rsp @@ -110,12 +109,12 @@ __pthread_once: /* Wake up all other threads. */ movl $0x7fffffff, %edx movl $FUTEX_WAKE, %esi - xorq %rcx, %rcx - movl $SYS_futex, %eax + movq $SYS_futex, %rax syscall -4: xorq %rax, %rax - ret +4: addq $4, %rsp + xorq %rax, %rax + retq .size __pthread_once,.-__pthread_once @@ -128,11 +127,10 @@ pthread_once = __pthread_once clear_once_control: movl $0, (%rdi) - xorq %rcx, %rcx movl $0x7fffffff, %edx movl $FUTEX_WAKE, %esi - movl $SYS_futex, %eax + movq $SYS_futex, %rax syscall - ret + retq .size clear_once_control,.-clear_once_control |