summaryrefslogtreecommitdiff
path: root/nptl/sysdeps/unix/sysv/linux/i386/i486
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-11-24 01:16:53 +0000
committerUlrich Drepper <drepper@redhat.com>2007-11-24 01:16:53 +0000
commitc012be6f99bd335830c9b620f184749f9f72fea5 (patch)
tree2b21ded2cc4e8aa30ebcac43ba798322b214819b /nptl/sysdeps/unix/sysv/linux/i386/i486
parent37143323d822ef3fb2711a7b4b4ad2475110af64 (diff)
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S (__lll_timedlock_wait):
Store 2 before returning ETIMEDOUT. * sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Likewise * sysdeps/unix/sysv/linux/lowlevellock.c: Likewise. (__lll_lock_wait_private): Optimize. (__lll_lock_wait): Likewise.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/i386/i486')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S56
1 files changed, 17 insertions, 39 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
index 6d3943b0eb..9c8a68f5b2 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
@@ -184,6 +184,12 @@ __lll_timedlock_wait:
movl %ecx, %ebp
movl %edx, %edi
+ movl $2, %edx
+ xchgl %edx, (%ebp)
+
+ test %edx, %edx
+ je 6f
+
1:
/* Get current time. */
movl %esp, %ebx
@@ -203,36 +209,30 @@ __lll_timedlock_wait:
addl $1000000000, %edx
subl $1, %ecx
4: testl %ecx, %ecx
- js 9f /* Time is already up. */
+ js 2f /* Time is already up. */
/* Store relative timeout. */
movl %ecx, (%esp)
movl %edx, 4(%esp)
+ /* Futex call. */
movl %ebp, %ebx
-
- movl $1, %eax
movl $2, %edx
- LOCK
- cmpxchgl %edx, (%ebx)
-
- testl %eax, %eax
- je 8f
-
- /* Futex call. */
movl %esp, %esi
movl 16(%esp), %ecx
LOAD_FUTEX_WAIT (%ecx)
movl $SYS_futex, %eax
ENTER_KERNEL
- movl %eax, %ecx
-8: /* NB: %edx == 2 */
- xorl %eax, %eax
- LOCK
- cmpxchgl %edx, (%ebx)
+ /* NB: %edx == 2 */
+ xchgl %edx, (%ebp)
- jnz 7f
+ testl %edx, %edx
+ je 6f
+
+ cmpl $-ETIMEDOUT, %eax
+ jne 1b
+2: movl $ETIMEDOUT, %edx
6: addl $8, %esp
cfi_adjust_cfa_offset(-8)
@@ -248,33 +248,11 @@ __lll_timedlock_wait:
popl %edi
cfi_adjust_cfa_offset(-4)
cfi_restore(%edi)
+ movl %edx, %eax
ret
3: movl $EINVAL, %eax
ret
-
- cfi_adjust_cfa_offset(24)
- cfi_offset(%edi, -8)
- cfi_offset(%esi, -12)
- cfi_offset(%ebx, -16)
- cfi_offset(%ebp, -20)
- /* Check whether the time expired. */
-7: cmpl $-ETIMEDOUT, %ecx
- je 5f
-
- /* Make sure the current holder knows we are going to sleep. */
- movl %edx, %eax
- xchgl %eax, (%ebx)
- testl %eax, %eax
- jz 6b
- jmp 1b
-
-5: movl $ETIMEDOUT, %eax
- jmp 6b
-
-9: movl $-ETIMEDOUT, %ecx
- movl $2, %edx
- jmp 8b
cfi_endproc
.size __lll_timedlock_wait,.-__lll_timedlock_wait
#endif