diff options
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S')
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S | 75 |
1 files changed, 39 insertions, 36 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S index 69243950d7..fa7516ef71 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S @@ -1,4 +1,5 @@ -/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -19,33 +20,40 @@ #include <sysdep.h> #include <pthread-errnos.h> +#include <lowlevellock.h> #include <lowlevelrobustlock.h> +#include <kernel-features.h> .text -#ifndef LOCK -# ifdef UP -# define LOCK +#define FUTEX_WAITERS 0x80000000 +#define FUTEX_OWNER_DIED 0x40000000 + +#ifdef __ASSUME_PRIVATE_FUTEX +# define LOAD_FUTEX_WAIT(reg) \ + xorl $(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), reg +#else +# if FUTEX_WAIT == 0 +# define LOAD_FUTEX_WAIT(reg) \ + xorl $FUTEX_PRIVATE_FLAG, reg ; \ + andl %fs:PRIVATE_FUTEX, reg # else -# define LOCK lock +# define LOAD_FUTEX_WAIT(reg) \ + xorl $FUTEX_PRIVATE_FLAG, reg ; \ + andl %fs:PRIVATE_FUTEX, reg ; \ + orl $FUTEX_WAIT, reg # endif #endif -#define SYS_futex 202 -#define FUTEX_WAIT 0 -#define FUTEX_WAKE 1 -#define FUTEX_WAITERS 0x80000000 -#define FUTEX_OWNER_DIED 0x40000000 - /* For the calculation see asm/vsyscall.h. */ #define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000 - .globl __lll_robust_mutex_lock_wait - .type __lll_robust_mutex_lock_wait,@function - .hidden __lll_robust_mutex_lock_wait + .globl __lll_robust_lock_wait + .type __lll_robust_lock_wait,@function + .hidden __lll_robust_lock_wait .align 16 -__lll_robust_mutex_lock_wait: +__lll_robust_lock_wait: cfi_startproc pushq %r10 cfi_adjust_cfa_offset(8) @@ -55,11 +63,7 @@ __lll_robust_mutex_lock_wait: cfi_offset(%rdx, -24) xorq %r10, %r10 /* No timeout. */ -#if FUTEX_WAIT == 0 - xorl %esi, %esi -#else - movl $FUTEX_WAIT, %esi -#endif + LOAD_FUTEX_WAIT (%esi) 4: movl %eax, %edx orl $FUTEX_WAITERS, %edx @@ -97,14 +101,14 @@ __lll_robust_mutex_lock_wait: cfi_restore(%r10) retq cfi_endproc - .size __lll_robust_mutex_lock_wait,.-__lll_robust_mutex_lock_wait + .size __lll_robust_lock_wait,.-__lll_robust_lock_wait - .globl __lll_robust_mutex_timedlock_wait - .type __lll_robust_mutex_timedlock_wait,@function - .hidden __lll_robust_mutex_timedlock_wait + .globl __lll_robust_timedlock_wait + .type __lll_robust_timedlock_wait,@function + .hidden __lll_robust_timedlock_wait .align 16 -__lll_robust_mutex_timedlock_wait: +__lll_robust_timedlock_wait: cfi_startproc /* Check for a valid timeout value. */ cmpq $1000000000, 8(%rdx) @@ -122,10 +126,12 @@ __lll_robust_mutex_timedlock_wait: cfi_offset(%r9, -24) cfi_offset(%r12, -32) cfi_offset(%r13, -40) + pushq %rsi + cfi_adjust_cfa_offset(8) /* Stack frame for the timespec and timeval structs. */ - subq $24, %rsp - cfi_adjust_cfa_offset(24) + subq $32, %rsp + cfi_adjust_cfa_offset(32) movq %rdi, %r12 movq %rdx, %r13 @@ -174,11 +180,8 @@ __lll_robust_mutex_timedlock_wait: jnz 5f 2: movq %rsp, %r10 -#if FUTEX_WAIT == 0 - xorl %esi, %esi -#else - movl $FUTEX_WAIT, %esi -#endif + movl 32(%rsp), %esi + LOAD_FUTEX_WAIT (%esi) movq %r12, %rdi movl $SYS_futex, %eax syscall @@ -195,8 +198,8 @@ __lll_robust_mutex_timedlock_wait: cmpxchgl %edx, (%r12) jnz 7f -6: addq $24, %rsp - cfi_adjust_cfa_offset(-24) +6: addq $40, %rsp + cfi_adjust_cfa_offset(-40) popq %r13 cfi_adjust_cfa_offset(-8) cfi_restore(%r13) @@ -214,7 +217,7 @@ __lll_robust_mutex_timedlock_wait: 3: movl $EINVAL, %eax retq - cfi_adjust_cfa_offset(56) + cfi_adjust_cfa_offset(72) cfi_offset(%r8, -16) cfi_offset(%r9, -24) cfi_offset(%r12, -32) @@ -226,4 +229,4 @@ __lll_robust_mutex_timedlock_wait: 8: movl $ETIMEDOUT, %eax jmp 6b cfi_endproc - .size __lll_robust_mutex_timedlock_wait,.-__lll_robust_mutex_timedlock_wait + .size __lll_robust_timedlock_wait,.-__lll_robust_timedlock_wait |