mirror of git://sourceware.org/git/glibc.git
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.
This commit is contained in:
parent
cd4b2a553a
commit
c2e5e08573
|
|
@ -1,5 +1,17 @@
|
||||||
2003-03-09 Ulrich Drepper <drepper@redhat.com>
|
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/s390/createthread.c: Moved to...
|
||||||
* sysdeps/unix/sysv/linux/createthread.c: ...here.
|
* sysdeps/unix/sysv/linux/createthread.c: ...here.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,7 @@ __pthread_once:
|
||||||
pushl %edx
|
pushl %edx
|
||||||
call __pthread_cleanup_push /* Note: no @PLT. */
|
call __pthread_cleanup_push /* Note: no @PLT. */
|
||||||
|
|
||||||
movl 44(%esp), %eax
|
call *44(%esp)
|
||||||
call *%eax
|
|
||||||
|
|
||||||
/* Pop the cleanup handler. This code depends on the once
|
/* Pop the cleanup handler. This code depends on the once
|
||||||
handler and _pthread_cleanup_push not touch the content
|
handler and _pthread_cleanup_push not touch the content
|
||||||
|
|
@ -144,20 +143,17 @@ pthread_once = __pthread_once
|
||||||
.type clear_once_control,@function
|
.type clear_once_control,@function
|
||||||
.align 16
|
.align 16
|
||||||
clear_once_control:
|
clear_once_control:
|
||||||
pushl %esi
|
|
||||||
pushl %ebx
|
pushl %ebx
|
||||||
|
|
||||||
movl 12(%esp), %ebx
|
movl 8(%esp), %ebx
|
||||||
movl $0, (%ebx)
|
movl $0, (%ebx)
|
||||||
|
|
||||||
xorl %esi, %esi
|
|
||||||
movl $0x7fffffff, %edx
|
movl $0x7fffffff, %edx
|
||||||
movl $FUTEX_WAKE, %ecx
|
movl $FUTEX_WAKE, %ecx
|
||||||
movl $SYS_futex, %eax
|
movl $SYS_futex, %eax
|
||||||
ENTER_KERNEL
|
ENTER_KERNEL
|
||||||
|
|
||||||
popl %ebx
|
popl %ebx
|
||||||
popl %esi
|
|
||||||
ret
|
ret
|
||||||
.size clear_once_control,.-clear_once_control
|
.size clear_once_control,.-clear_once_control
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
@ -38,18 +38,20 @@ __pthread_once:
|
||||||
testl $2, (%rdi)
|
testl $2, (%rdi)
|
||||||
jz 1f
|
jz 1f
|
||||||
xorl %eax, %eax
|
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.
|
/* Not yet initialized or initialization in progress.
|
||||||
Get the fork generation counter now. */
|
Get the fork generation counter now. */
|
||||||
6: movl (%rdi), %eax
|
6: movl (%rdi), %eax
|
||||||
|
|
||||||
5: movq %rax, %rdx
|
5: movl %eax, %edx
|
||||||
|
|
||||||
testl $2, %eax
|
testl $2, %eax
|
||||||
jnz 0b
|
jnz 4f
|
||||||
|
|
||||||
andl $3, %edx
|
andl $3, %edx
|
||||||
orl __fork_generation(%rip), %edx
|
orl __fork_generation(%rip), %edx
|
||||||
|
|
@ -70,8 +72,8 @@ __pthread_once:
|
||||||
jnz 3f /* Different for generation -> run initializer. */
|
jnz 3f /* Different for generation -> run initializer. */
|
||||||
|
|
||||||
/* Somebody else got here first. Wait. */
|
/* Somebody else got here first. Wait. */
|
||||||
movq %rsi, %rcx /* movl $FUTEX_WAIT, %ecx */
|
movq %r10, %rsi /* movl $FUTEX_WAIT, %ecx */
|
||||||
movl $SYS_futex, %eax
|
movq $SYS_futex, %eax
|
||||||
syscall
|
syscall
|
||||||
jmp 6b
|
jmp 6b
|
||||||
|
|
||||||
|
|
@ -88,14 +90,11 @@ __pthread_once:
|
||||||
movq %rsp, %rdi
|
movq %rsp, %rdi
|
||||||
call __pthread_cleanup_push /* Note: no @PLT. */
|
call __pthread_cleanup_push /* Note: no @PLT. */
|
||||||
|
|
||||||
movq 48(%rsp), %rax
|
call *40(%rsp)
|
||||||
call *%rax
|
|
||||||
|
|
||||||
/* Pop the cleanup handler. This code depends on the once
|
/* Pop the cleanup handler. */
|
||||||
handler and _pthread_cleanup_push not touch the content
|
movq %rsp, %rdi
|
||||||
of the stack. Otherwise the first parameter would have
|
xorq %rsi, %rsi
|
||||||
to be reloaded. */
|
|
||||||
xorq %rdi, %rdi
|
|
||||||
call __pthread_cleanup_pop /* Note: no @PLT. */
|
call __pthread_cleanup_pop /* Note: no @PLT. */
|
||||||
|
|
||||||
addq $32, %rsp
|
addq $32, %rsp
|
||||||
|
|
@ -110,12 +109,12 @@ __pthread_once:
|
||||||
/* Wake up all other threads. */
|
/* Wake up all other threads. */
|
||||||
movl $0x7fffffff, %edx
|
movl $0x7fffffff, %edx
|
||||||
movl $FUTEX_WAKE, %esi
|
movl $FUTEX_WAKE, %esi
|
||||||
xorq %rcx, %rcx
|
movq $SYS_futex, %rax
|
||||||
movl $SYS_futex, %eax
|
|
||||||
syscall
|
syscall
|
||||||
|
|
||||||
4: xorq %rax, %rax
|
4: addq $4, %rsp
|
||||||
ret
|
xorq %rax, %rax
|
||||||
|
retq
|
||||||
|
|
||||||
.size __pthread_once,.-__pthread_once
|
.size __pthread_once,.-__pthread_once
|
||||||
|
|
||||||
|
|
@ -128,11 +127,10 @@ pthread_once = __pthread_once
|
||||||
clear_once_control:
|
clear_once_control:
|
||||||
movl $0, (%rdi)
|
movl $0, (%rdi)
|
||||||
|
|
||||||
xorq %rcx, %rcx
|
|
||||||
movl $0x7fffffff, %edx
|
movl $0x7fffffff, %edx
|
||||||
movl $FUTEX_WAKE, %esi
|
movl $FUTEX_WAKE, %esi
|
||||||
movl $SYS_futex, %eax
|
movq $SYS_futex, %rax
|
||||||
syscall
|
syscall
|
||||||
|
|
||||||
ret
|
retq
|
||||||
.size clear_once_control,.-clear_once_control
|
.size clear_once_control,.-clear_once_control
|
||||||
|
|
|
||||||
|
|
@ -60,30 +60,6 @@ typedef struct
|
||||||
/* Get system call information. */
|
/* Get system call information. */
|
||||||
# include <sysdep.h>
|
# 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. */
|
/* Get the thread descriptor definition. */
|
||||||
# include <nptl/descr.h>
|
# include <nptl/descr.h>
|
||||||
|
|
@ -127,20 +103,6 @@ union user_desc_init
|
||||||
__asm ("movl %0, %%fs" :: "q" (val))
|
__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
|
/* Code to initially initialize the thread pointer. This might need
|
||||||
special attention since 'errno' is not yet available and if the
|
special attention since 'errno' is not yet available and if the
|
||||||
operation can cause a failure 'errno' must not be touched.
|
operation can cause a failure 'errno' must not be touched.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue