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
#ifndef _TLS_H
#define _TLS_H 1
+#include <dl-sysdep.h>
#ifndef __ASSEMBLER__
# include <stddef.h>
# include <stdint.h>
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
xorl %esi, %esi
movl %edx, (%ebx) /* Stores '$1'. */
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
popl %edx
popl %ecx
2: movl %esp, %ebx
xorl %ecx, %ecx
movl $SYS_gettimeofday, %eax
- int $0x80
+ ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
movl %ebp, %ebx
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
movl %eax, %edx
1:
leal 1(%eax), %edx /* account for the preceeded xadd. */
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
movl $1, %eax
#ifndef UP
movl %esp, %ebx
xorl %ecx, %ecx
movl $SYS_gettimeofday, %eax
- int $0x80
+ ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
movl %ebp, %ebx
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
movl $1, %esi
#ifndef UP
movl $0, (%ebx)
movl $1, %edx /* Wake one thread. */
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
popl %edx
popl %ecx
3: xorl %ecx, %ecx
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
movl $1, %eax
LOCK
7: movl %esp, %ebx
xorl %ecx, %ecx
movl $SYS_gettimeofday, %eax
- int $0x80
+ ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
movl %ebp, %ebx
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
movl %eax, %edx
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)
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)
1:
leal -1(%eax), %edx /* account for the preceeded xadd. */
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
orl $-1, %eax /* Load -1. */
LOCK
xorl %esi, %esi
movl %edx, (%ebx) /* Stores '$1'. */
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
popl %edx
popl %ecx
2: movl %esp, %ebx
xorl %ecx, %ecx
movl $SYS_gettimeofday, %eax
- int $0x80
+ ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
movl %ebp, %ebx
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
movl %eax, %edx
1:
leal 1(%eax), %edx /* account for the preceeded xadd. */
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
movl $1, %eax
LOCK
movl %esp, %ebx
xorl %ecx, %ecx
movl $SYS_gettimeofday, %eax
- int $0x80
+ ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
movl %ebp, %ebx
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
movl $1, %esi
LOCK
movl $0, (%ebx)
movl $1, %edx /* Wake one thread. */
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
popl %edx
popl %ecx
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
movl %esp, %ebx
xorl %ecx, %ecx
movl $SYS_gettimeofday, %eax
- int $0x80
+ ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
movl %ecx, %edx
leal READERS_WAKEUP(%ebp), %ebx
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
movl %eax, %edx
17:
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
movl %esp, %ebx
xorl %ecx, %ecx
movl $SYS_gettimeofday, %eax
- int $0x80
+ ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
movl %ecx, %edx
leal WRITERS_WAKEUP(%ebp), %ebx
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
movl %eax, %edx
17:
0:
#endif
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
6: LOCK
decl MUTEX(%edi)
movl $SYS_futex, %eax
movl %esi, %ecx
movl %esi, %edx
- int $0x80
+ ENTER_KERNEL
testl %eax, %eax
je 3b
movl %esp, %ebx
movl %ecx, %edx
movl $SYS_gettimeofday, %eax
- int $0x80
+ ENTER_KERNEL
/* Compute relative timeout. */
movl 4(%esp), %eax
xorl %ecx, %ecx
movl $SYS_futex, %eax
xorl %edx, %edx
- int $0x80
+ ENTER_KERNEL
testl %eax, %eax
je,pt 9f
movl $SYS_futex, %eax
movl $FUTEX_WAKE, %ecx
incl %edx
- int $0x80
+ ENTER_KERNEL
testl %eax, %eax
js 1f
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
movl $0x7fffffff, %edx
movl $FUTEX_WAKE, %ecx
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
/* Release the mutex. */
LOCK
# 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; \
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)
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)
#ifndef _LOWLEVELSEM_H
#define _LOWLEVELSEM_H 1
+#include <dl-sysdep.h>
+#include <tls.h>
+
#ifndef LOCK
# ifdef UP
# define LOCK /* nothing */
#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" \
"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" \
: "=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; })
"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 */
/* 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
movl $0x7fffffff, %edx
movl $FUTEX_WAKE, %ecx
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
4: popl %esi
popl %ebx
movl $0x7fffffff, %edx
movl $FUTEX_WAKE, %ecx
movl $SYS_futex, %eax
- int $0x80
+ ENTER_KERNEL
popl %ebx
popl %esi
/* 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. */
/* 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.
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. */
/* 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.
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. */
/* 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.
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. */