]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Mon, 10 Mar 2003 07:39:55 +0000 (07:39 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 10 Mar 2003 07:39:55 +0000 (07:39 +0000)
* 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.

nptl/ChangeLog
nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S
nptl/sysdeps/unix/sysv/linux/x86_64/fork.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
nptl/sysdeps/x86_64/tls.h

index 3d708b6accbb99726c9b478bdb2a4b902335b821..91679b97d3b467d359102c7f2f30084943821d82 100644 (file)
@@ -1,5 +1,17 @@
 2003-03-09  Ulrich Drepper  <drepper@redhat.com>
 
+       * 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.
+
        * sysdeps/unix/sysv/linux/s390/createthread.c: Moved to...
        * sysdeps/unix/sysv/linux/createthread.c: ...here.
 
index abab62ff1eda4aef31f38c05537e4d3ef9c257f0..8d3deb88f8051718cc9b3bc2cd4ee90166ae39fe 100644 (file)
@@ -105,8 +105,7 @@ __pthread_once:
        pushl   %edx
        call    __pthread_cleanup_push  /* Note: no @PLT.  */
 
-       movl    44(%esp), %eax
-       call    *%eax
+       call    *44(%esp)
 
        /* Pop the cleanup handler.  This code depends on the once
           handler and _pthread_cleanup_push not touch the content
@@ -144,20 +143,17 @@ pthread_once = __pthread_once
        .type   clear_once_control,@function
        .align  16
 clear_once_control:
-       pushl   %esi
        pushl   %ebx
 
-       movl    12(%esp), %ebx
+       movl    8(%esp), %ebx
        movl    $0, (%ebx)
 
-       xorl    %esi, %esi
        movl    $0x7fffffff, %edx
        movl    $FUTEX_WAKE, %ecx
        movl    $SYS_futex, %eax
        ENTER_KERNEL
 
        popl    %ebx
-       popl    %esi
        ret
        .size   clear_once_control,.-clear_once_control
 
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 (file)
index 0000000..c828e15
--- /dev/null
@@ -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"
index 3871c0e1a22f5852fc15d521d59e371e90a38c62..43eadcf40a98a0c3a5c7a6c1a01cb45beb352dc1 100644 (file)
@@ -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
index 7a6394415ce6b4c931eda2e68d36500ee2d4d00e..66e878ef0b6f3ecfed7a53165cb42f398eacf1d7 100644 (file)
@@ -60,30 +60,6 @@ typedef struct
 /* Get system call information.  */
 # include <sysdep.h>
 
-/* The old way: using LDT.  */
-
-/* Structure passed to `modify_ldt', 'set_thread_area', and 'clone' calls.  */
-struct user_desc
-{
-  unsigned int entry_number;
-  unsigned long int base_addr;
-  unsigned int limit;
-  unsigned int seg_32bit:1;
-  unsigned int contents:2;
-  unsigned int read_exec_only:1;
-  unsigned int limit_in_pages:1;
-  unsigned int seg_not_present:1;
-  unsigned int useable:1;
-  unsigned int empty:25;
-};
-
-/* Initializing bit fields is slow.  We speed it up by using a union.  */
-union user_desc_init
-{
-  struct user_desc desc;
-  unsigned int vals[4];
-};
-
 
 /* Get the thread descriptor definition.  */
 # include <nptl/descr.h>
@@ -127,20 +103,6 @@ union user_desc_init
   __asm ("movl %0, %%fs" :: "q" (val))
 
 
-# ifndef __NR_set_thread_area
-#  define __NR_set_thread_area 205
-# endif
-# ifndef TLS_FLAG_WRITABLE
-#  define TLS_FLAG_WRITABLE            0x00000001
-# endif
-
-// XXX Enable for the real world.
-#if 0
-# ifndef __ASSUME_SET_THREAD_AREA
-#  error "we need set_thread_area"
-# endif
-#endif
-
 /* Code to initially initialize the thread pointer.  This might need
    special attention since 'errno' is not yet available and if the
    operation can cause a failure 'errno' must not be touched.