diff options
Diffstat (limited to 'nptl/sysdeps')
12 files changed, 74 insertions, 45 deletions
diff --git a/nptl/sysdeps/i386/tls.h b/nptl/sysdeps/i386/tls.h index 3d535be083..984094c00e 100644 --- a/nptl/sysdeps/i386/tls.h +++ b/nptl/sysdeps/i386/tls.h @@ -20,6 +20,7 @@ #ifndef _TLS_H #define _TLS_H 1 +#include <dl-sysdep.h> #ifndef __ASSEMBLER__ # include <stddef.h> # include <stdint.h> diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S index 334866db6b..4d5f8fd62d 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S @@ -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 diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S index dac8f4a884..ccae01b84a 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S @@ -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 diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S index 9e2b9fec8d..e8c8d5d200 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S @@ -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) diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S index 400413d7c2..e79e65b21e 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S @@ -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 diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S index a48cd88fa8..e369c65592 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S @@ -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 diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelrwlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelrwlock.S index 8d682d94c0..4e021dca29 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelrwlock.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelrwlock.S @@ -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) diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S index 18fb16f6f6..bfec6fa155 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S @@ -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 diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S index a385adc5f9..b77c342a99 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S @@ -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 diff --git a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h index 7c516ee36a..a96eb57c93 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h +++ b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h @@ -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) diff --git a/nptl/sysdeps/unix/sysv/linux/i386/lowlevelsem.h b/nptl/sysdeps/unix/sysv/linux/i386/lowlevelsem.h index bd5f96402b..59c1602ddb 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/lowlevelsem.h +++ b/nptl/sysdeps/unix/sysv/linux/i386/lowlevelsem.h @@ -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 */ diff --git a/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S b/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S index 931e38bac3..f35ae27a33 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S @@ -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 |