* sysdeps/unix/sysv/linux/i386/pthread_once.S: Use ENTER_KERNEL instead
	of int $0x80.
	* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/lowlevelrwlock.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Likewise.

	* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Add support for using
	sysenter.
	* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Likewise.

	* sysdeps/i386/tls.h: Unconditionally include <dl-sysdep.h>.
This commit is contained in:
Ulrich Drepper 2002-12-20 07:12:24 +00:00
parent 5f5843e30d
commit 097eca29e8
17 changed files with 100 additions and 52 deletions

View File

@ -1,5 +1,22 @@
2002-12-19 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Use ENTER_KERNEL instead
of int $0x80.
* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelrwlock.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Likewise.
* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Add support for using
sysenter.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Likewise.
* sysdeps/i386/tls.h: Unconditionally include <dl-sysdep.h>.
* allocatestack.c (allocate_stack) [NEED_DL_SYSINFO]: Set sysinfo
in new TCB.
* sysdeps/unix/sysv/linux/i386/createthread.c (create_thread): Check

View File

@ -20,6 +20,7 @@
#ifndef _TLS_H
#define _TLS_H 1
#include <dl-sysdep.h>
#ifndef __ASSEMBLER__
# include <stddef.h>
# include <stdint.h>

View File

@ -45,7 +45,7 @@ __lll_lock_wait:
1:
leal -1(%eax), %edx /* account for the preceeded xadd. */
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
orl $-1, %eax /* Load -1. */
#ifndef UP
@ -109,7 +109,7 @@ __lll_unlock_wake:
xorl %esi, %esi
movl %edx, (%ebx) /* Stores '$1'. */
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
popl %edx
popl %ecx
@ -136,7 +136,7 @@ __lll_timedwait_tid:
2: movl %esp, %ebx
xorl %ecx, %ecx
movl $SYS_gettimeofday, %eax
int $0x80
ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
@ -163,7 +163,7 @@ __lll_timedwait_tid:
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
movl %ebp, %ebx
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
movl %eax, %edx

View File

@ -46,7 +46,7 @@ __lll_mutex_lock_wait:
1:
leal 1(%eax), %edx /* account for the preceeded xadd. */
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
movl $1, %eax
#ifndef UP
@ -94,7 +94,7 @@ __lll_mutex_timedlock_wait:
movl %esp, %ebx
xorl %ecx, %ecx
movl $SYS_gettimeofday, %eax
int $0x80
ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
@ -118,7 +118,7 @@ __lll_mutex_timedlock_wait:
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
movl %ebp, %ebx
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
movl $1, %esi
#ifndef UP
@ -170,7 +170,7 @@ __lll_mutex_unlock_wake:
movl $0, (%ebx)
movl $1, %edx /* Wake one thread. */
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
popl %edx
popl %ecx

View File

@ -63,7 +63,7 @@ __lll_cond_wait:
3: xorl %ecx, %ecx
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
movl $1, %eax
LOCK
@ -121,7 +121,7 @@ __lll_cond_timedwait:
7: movl %esp, %ebx
xorl %ecx, %ecx
movl $SYS_gettimeofday, %eax
int $0x80
ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
@ -144,7 +144,7 @@ __lll_cond_timedwait:
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
movl %ebp, %ebx
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
movl %eax, %edx
@ -212,7 +212,7 @@ __lll_cond_wake:
xorl %esi, %esi
movl %ecx, %edx /* movl $1, %edx */
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
3: LOCK
decl cond_lock-cond_nr_wakers(%ebx)
@ -260,7 +260,7 @@ __lll_cond_broadcast:
6: movl $FUTEX_WAKE, %ecx
xorl %esi, %esi
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
3: LOCK
decl cond_lock-cond_nr_wakers(%ebx)

View File

@ -50,7 +50,7 @@ __lll_lock_wait:
1:
leal -1(%eax), %edx /* account for the preceeded xadd. */
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
orl $-1, %eax /* Load -1. */
LOCK
@ -104,7 +104,7 @@ __lll_unlock_wake:
xorl %esi, %esi
movl %edx, (%ebx) /* Stores '$1'. */
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
popl %edx
popl %ecx
@ -131,7 +131,7 @@ __lll_timedwait_tid:
2: movl %esp, %ebx
xorl %ecx, %ecx
movl $SYS_gettimeofday, %eax
int $0x80
ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
@ -158,7 +158,7 @@ __lll_timedwait_tid:
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
movl %ebp, %ebx
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
movl %eax, %edx

View File

@ -52,7 +52,7 @@ __lll_mutex_lock_wait:
1:
leal 1(%eax), %edx /* account for the preceeded xadd. */
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
movl $1, %eax
LOCK
@ -95,7 +95,7 @@ __lll_mutex_timedlock_wait:
movl %esp, %ebx
xorl %ecx, %ecx
movl $SYS_gettimeofday, %eax
int $0x80
ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
@ -119,7 +119,7 @@ __lll_mutex_timedlock_wait:
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
movl %ebp, %ebx
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
movl $1, %esi
LOCK
@ -166,7 +166,7 @@ __lll_mutex_unlock_wake:
movl $0, (%ebx)
movl $1, %edx /* Wake one thread. */
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
popl %edx
popl %ecx

View File

@ -83,7 +83,7 @@ __pthread_rwlock_rdlock:
11: addl $READERS_WAKEUP-MUTEX, %ebx
movl %esi, %ecx /* movl $FUTEX_WAIT, %ecx */
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
subl $READERS_WAKEUP-MUTEX, %ebx
@ -188,7 +188,7 @@ pthread_rwlock_timedrdlock:
movl %esp, %ebx
xorl %ecx, %ecx
movl $SYS_gettimeofday, %eax
int $0x80
ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
@ -212,7 +212,7 @@ pthread_rwlock_timedrdlock:
movl %ecx, %edx
leal READERS_WAKEUP(%ebp), %ebx
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
movl %eax, %edx
17:
@ -320,7 +320,7 @@ __pthread_rwlock_wrlock:
11: addl $WRITERS_WAKEUP-MUTEX, %ebx
movl %esi, %ecx /* movl $FUTEX_WAIT, %ecx */
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
subl $WRITERS_WAKEUP-MUTEX, %ebx
@ -415,7 +415,7 @@ pthread_rwlock_timedwrlock:
movl %esp, %ebx
xorl %ecx, %ecx
movl $SYS_gettimeofday, %eax
int $0x80
ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
@ -439,7 +439,7 @@ pthread_rwlock_timedwrlock:
movl %ecx, %edx
leal WRITERS_WAKEUP(%ebp), %ebx
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
movl %eax, %edx
17:
@ -547,7 +547,7 @@ __pthread_rwlock_unlock:
0:
#endif
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
6: LOCK
decl MUTEX(%edi)

View File

@ -66,7 +66,7 @@ __new_sem_wait:
movl $SYS_futex, %eax
movl %esi, %ecx
movl %esi, %edx
int $0x80
ENTER_KERNEL
testl %eax, %eax
je 3b
@ -171,7 +171,7 @@ sem_timedwait:
movl %esp, %ebx
movl %ecx, %edx
movl $SYS_gettimeofday, %eax
int $0x80
ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
@ -194,7 +194,7 @@ sem_timedwait:
xorl %ecx, %ecx
movl $SYS_futex, %eax
xorl %edx, %edx
int $0x80
ENTER_KERNEL
testl %eax, %eax
je,pt 9f
@ -255,7 +255,7 @@ __new_sem_post:
movl $SYS_futex, %eax
movl $FUTEX_WAKE, %ecx
incl %edx
int $0x80
ENTER_KERNEL
testl %eax, %eax
js 1f

View File

@ -70,7 +70,7 @@ pthread_barrier_wait:
if the CURR_EVENT memory has meanwhile been changed. */
7: movl %esi, %ecx /* movl $FUTEX_WAIT, %ecx */
8: movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
/* Don't return on spurious wakeups. The syscall does not change
any register except %eax so there is no need to reload any of
@ -95,7 +95,7 @@ pthread_barrier_wait:
movl $0x7fffffff, %edx
movl $FUTEX_WAKE, %ecx
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
/* Release the mutex. */
LOCK

View File

@ -257,6 +257,17 @@ extern int __libc_locking_needed attribute_hidden;
# define LLL_TID_EBX_LOAD
# define LLL_TID_EBX_REG "b"
#endif
#ifdef I386_USE_SYSENTER
# ifdef SHARED
# define LLL_TID_ENTER_KERNEL "call *%%gs:%P6\n\t"
# else
# define LLL_TID_ENTER_KERNEL "call *_dl_sysinfo\n\t"
# endif
#else
# define LLL_TID_ENTER_KERNEL "int $0x80\n\t"
#endif
#define lll_wait_tid(tid) \
do { \
int __ignore; \
@ -264,13 +275,14 @@ extern int __libc_locking_needed attribute_hidden;
if (_tid != 0) \
__asm __volatile (LLL_TID_EBX_LOAD \
"1:\tmovl %1, %%eax\n\t" \
"int $0x80\n\t" \
LLL_TID_ENTER_KERNEL \
"cmpl $0, (%%ebx)\n\t" \
"jne,pn 1b\n\t" \
LLL_TID_EBX_LOAD \
: "=&a" (__ignore) \
: "i" (SYS_futex), LLL_TID_EBX_REG (&tid), "S" (0), \
"c" (FUTEX_WAIT), "d" (_tid)); \
"c" (FUTEX_WAIT), "d" (_tid), \
"i" (offsetof (tcbhead_t, sysinfo))); \
} while (0)
extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime)
@ -293,11 +305,12 @@ extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime)
int __ignore; \
(tid) = 0; \
__asm __volatile (LLL_TID_EBX_LOAD \
"\tint $0x80\n\t" \
LLL_TID_ENTER_KERNEL \
LLL_TID_EBX_LOAD \
: "=a" (__ignore) \
: "0" (SYS_futex), LLL_TID_EBX_REG (&(tid)), "S" (0), \
"c" (FUTEX_WAKE), "d" (0x7fffffff)); \
"c" (FUTEX_WAKE), "d" (0x7fffffff) \
"i" (offsetof (tcbhead_t, sysinfo))); \
} while (0)

View File

@ -20,6 +20,9 @@
#ifndef _LOWLEVELSEM_H
#define _LOWLEVELSEM_H 1
#include <dl-sysdep.h>
#include <tls.h>
#ifndef LOCK
# ifdef UP
# define LOCK /* nothing */
@ -31,6 +34,16 @@
#define SYS_futex 240
#ifdef I386_USE_SYSENTER
# ifdef SHARED
# define LLL_SEM_ENTER_KERNEL(arg) "call *%%gs:%P" #arg "\n\t"
# else
# define LLL_SEM_ENTER_KERNEL(arg) "call *_dl_sysinfo\n\t"
# endif
#else
# define LLL_SEM_ENTER_KERNEL(arg) "int $0x80\n\t"
#endif
#define lll_sem_wait(sem) \
({ int result, ignore1, ignore2; \
__asm __volatile ("1:\tincl 8(%4)\n\t" \
@ -46,7 +59,7 @@
"movl %%esi, %%edx\n\t" \
"leal 4(%4), %%ebx\n\t" \
"movl %5, %%eax\n\t" \
"int $0x80\n\t" \
LLL_SEM_ENTER_KERNEL (9) \
"movl %%eax, %%edx\n\t" \
"popl %%ebx\n\t" \
"orl $-1, %%eax\n\t" \
@ -68,7 +81,8 @@
: "=a" (result), "=c" (ignore1), "=d" (ignore2), \
"=m" (*sem) \
: "D" (sem), "i" (SYS_futex), "S" (0), \
"i" (-EINTR), "i" (EINTR)); \
"i" (-EINTR), "i" (EINTR), \
"i" (offsetof (tcbhead_t, sysinfo))); \
result; })
@ -91,11 +105,12 @@ extern int __lll_sem_timedwait (struct sem *sem, const struct timespec *ts)
"movl %5, %%eax\n\t" \
/* movl $FUTEX_WAKE, %ecx */ \
"movl $1, %%ecx\n\t" \
"int $0x80\n\t" \
LLL_SEM_ENTER_KERNEL (6) \
"popl %%ebx\n\t" \
"popl %%esi" \
: "=&a" (ignore1), "=c" (ignore2), \
"=m" (*sem), "=d" (ignore3) \
: "r" (sem), "i" (SYS_futex)); })
: "r" (sem), "i" (SYS_futex), \
"i" (offsetof (tcbhead_t, sysinfo))); })
#endif /* lowlevelsem.h */

View File

@ -86,7 +86,7 @@ __pthread_once:
/* Somebody else got here first. Wait. */
movl %esi, %ecx /* movl $FUTEX_WAIT, %ecx */
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
jmp 6b
3: /* Call the initializer function after setting up the
@ -125,7 +125,7 @@ __pthread_once:
movl $0x7fffffff, %edx
movl $FUTEX_WAKE, %ecx
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
4: popl %esi
popl %ebx
@ -154,7 +154,7 @@ clear_once_control:
movl $0x7fffffff, %edx
movl $FUTEX_WAKE, %ecx
movl $SYS_futex, %eax
int $0x80
ENTER_KERNEL
popl %ebx
popl %esi

View File

@ -27,11 +27,13 @@ _exit:
/* Try the new syscall first. */
#ifdef __NR_exit_group
movl $__NR_exit_group, %eax
int $0x80
ENTER_KERNEL
#endif
/* Not available. Now the old one. */
movl $__NR_exit, %eax
/* Don't bother using ENTER_KERNEL here. If the exit_group
syscall is not available AT_SYSINFO isn't either. */
int $0x80
/* This must not fail. Be sure we don't return. */

View File

@ -1,5 +1,5 @@
/* Save current context.
Copyright (C) 2001 Free Software Foundation, Inc.
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
@ -63,7 +63,7 @@ ENTRY(__getcontext)
xorl %ecx, %ecx
movl $SIG_BLOCK, %ebx
movl $__NR_sigprocmask, %eax
int $0x80
ENTER_KERNEL
popl %ebx
cmpl $-4095, %eax /* Check %eax for error. */
jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */

View File

@ -1,5 +1,5 @@
/* Install given context.
Copyright (C) 2001 Free Software Foundation, Inc.
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
@ -35,7 +35,7 @@ ENTRY(__setcontext)
leal oSIGMASK(%eax), %ecx
movl $SIG_SETMASK, %ebx
movl $__NR_sigprocmask, %eax
int $0x80
ENTER_KERNEL
popl %ebx
cmpl $-4095, %eax /* Check %eax for error. */
jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */

View File

@ -1,5 +1,5 @@
/* Save current context and install the given one.
Copyright (C) 2001 Free Software Foundation, Inc.
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
@ -65,7 +65,7 @@ ENTRY(__swapcontext)
leal oSIGMASK(%ecx), %ecx
movl $SIG_SETMASK, %ebx
movl $__NR_sigprocmask, %eax
int $0x80
ENTER_KERNEL
popl %ebx
cmpl $-4095, %eax /* Check %eax for error. */
jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */