summaryrefslogtreecommitdiff
path: root/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S97
1 files changed, 18 insertions, 79 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
index 394dec8d82..d5c9345558 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -43,25 +43,17 @@
.hidden __lll_mutex_lock_wait
.align 16
__lll_mutex_lock_wait:
- cfi_startproc
pushq %r10
- cfi_adjust_cfa_offset(8)
pushq %rdx
- cfi_adjust_cfa_offset(8)
- cfi_offset(%r10, -16)
- cfi_offset(%rdx, -24)
+
xorq %r10, %r10 /* No timeout. */
movl $2, %edx
-#if FUTEX_WAIT == 0
- xorl %esi, %esi
-#else
- movl $FUTEX_WAIT, %esi
-#endif
+ movq %r10, %rsi /* movq $FUTEX_WAIT, %rsi */
cmpl %edx, %eax /* NB: %edx == 2 */
jne 2f
-1: movl $SYS_futex, %eax
+1: movq $SYS_futex, %rax
syscall
2: movl %edx, %eax
@@ -71,13 +63,8 @@ __lll_mutex_lock_wait:
jnz 1b
popq %rdx
- cfi_adjust_cfa_offset(-8)
- cfi_restore(%rdx)
popq %r10
- cfi_adjust_cfa_offset(-8)
- cfi_restore(%r10)
retq
- cfi_endproc
.size __lll_mutex_lock_wait,.-__lll_mutex_lock_wait
@@ -87,30 +74,18 @@ __lll_mutex_lock_wait:
.hidden __lll_mutex_timedlock_wait
.align 16
__lll_mutex_timedlock_wait:
- cfi_startproc
/* Check for a valid timeout value. */
cmpq $1000000000, 8(%rdx)
jae 3f
pushq %r8
- cfi_adjust_cfa_offset(8)
pushq %r9
- cfi_adjust_cfa_offset(8)
pushq %r12
- cfi_adjust_cfa_offset(8)
pushq %r13
- cfi_adjust_cfa_offset(8)
pushq %r14
- cfi_adjust_cfa_offset(8)
- cfi_offset(%r8, -16)
- cfi_offset(%r9, -24)
- cfi_offset(%r12, -32)
- cfi_offset(%r13, -40)
- cfi_offset(%r14, -48)
/* Stack frame for the timespec and timeval structs. */
subq $16, %rsp
- cfi_adjust_cfa_offset(16)
movq %rdi, %r12
movq %rdx, %r13
@@ -118,7 +93,7 @@ __lll_mutex_timedlock_wait:
1:
/* Get current time. */
movq %rsp, %rdi
- xorl %esi, %esi
+ xorq %rsi, %rsi
movq $VSYSCALL_ADDR_vgettimeofday, %rax
/* This is a regular function call, all caller-save registers
might be clobbered. */
@@ -126,7 +101,7 @@ __lll_mutex_timedlock_wait:
/* Compute relative timeout. */
movq 8(%rsp), %rax
- movl $1000, %edi
+ movq $1000, %rdi
mul %rdi /* Milli seconds to nano seconds. */
movq (%r13), %rdi
movq 8(%r13), %rsi
@@ -151,50 +126,26 @@ __lll_mutex_timedlock_wait:
je 8f
movq %rsp, %r10
-#if FUTEX_WAIT == 0
- xorl %esi, %esi
-#else
- movl $FUTEX_WAIT, %esi
-#endif
+ xorq %rsi, %rsi /* movq $FUTEX_WAIT, %rsi */
movq %r12, %rdi
- movl $SYS_futex, %eax
+ movq $SYS_futex, %rax
syscall
movq %rax, %rcx
8: /* NB: %edx == 2 */
xorl %eax, %eax
LOCK
- cmpxchgl %edx, (%r12)
+ cmpxchgl %edx, (%rdi)
jnz 7f
6: addq $16, %rsp
- cfi_adjust_cfa_offset(-16)
popq %r14
- cfi_adjust_cfa_offset(-8)
- cfi_restore(%r14)
popq %r13
- cfi_adjust_cfa_offset(-8)
- cfi_restore(%r13)
popq %r12
- cfi_adjust_cfa_offset(-8)
- cfi_restore(%r12)
popq %r9
- cfi_adjust_cfa_offset(-8)
- cfi_restore(%r9)
popq %r8
- cfi_adjust_cfa_offset(-8)
- cfi_restore(%r8)
retq
-3: movl $EINVAL, %eax
- retq
-
- cfi_adjust_cfa_offset(56)
- cfi_offset(%r8, -16)
- cfi_offset(%r9, -24)
- cfi_offset(%r12, -32)
- cfi_offset(%r13, -40)
- cfi_offset(%r14, -48)
/* Check whether the time expired. */
7: cmpq $-ETIMEDOUT, %rcx
je 5f
@@ -206,9 +157,11 @@ __lll_mutex_timedlock_wait:
jz 6b
jmp 1b
+3: movl $EINVAL, %eax
+ retq
+
5: movl $ETIMEDOUT, %eax
jmp 6b
- cfi_endproc
.size __lll_mutex_timedlock_wait,.-__lll_mutex_timedlock_wait
#endif
@@ -238,28 +191,18 @@ lll_unlock_wake_cb:
.hidden __lll_mutex_unlock_wake
.align 16
__lll_mutex_unlock_wake:
- cfi_startproc
pushq %rsi
- cfi_adjust_cfa_offset(8)
pushq %rdx
- cfi_adjust_cfa_offset(8)
- cfi_offset(%rsi, -16)
- cfi_offset(%rdx, -24)
movl $0, (%rdi)
- movl $FUTEX_WAKE, %esi
+ movq $FUTEX_WAKE, %rsi
movl $1, %edx /* Wake one thread. */
- movl $SYS_futex, %eax
+ movq $SYS_futex, %rax
syscall
popq %rdx
- cfi_adjust_cfa_offset(-8)
- cfi_restore(%rdx)
popq %rsi
- cfi_adjust_cfa_offset(-8)
- cfi_restore(%rsi)
retq
- cfi_endproc
.size __lll_mutex_unlock_wake,.-__lll_mutex_unlock_wake
@@ -279,13 +222,13 @@ __lll_timedwait_tid:
/* Get current time. */
2: movq %rsp, %rdi
- xorl %esi, %esi
+ xorq %rsi, %rsi
movq $VSYSCALL_ADDR_vgettimeofday, %rax
callq *%rax
/* Compute relative timeout. */
movq 8(%rsp), %rax
- movl $1000, %edi
+ movq $1000, %rdi
mul %rdi /* Milli seconds to nano seconds. */
movq (%r13), %rdi
movq 8(%r13), %rsi
@@ -305,13 +248,9 @@ __lll_timedwait_tid:
jz 4f
movq %rsp, %r10
-#if FUTEX_WAIT == 0
- xorl %esi, %esi
-#else
- movl $FUTEX_WAIT, %esi
-#endif
+ xorq %rsi, %rsi /* movq $FUTEX_WAIT, %rsi */
movq %r12, %rdi
- movl $SYS_futex, %eax
+ movq $SYS_futex, %rax
syscall
cmpl $0, (%rdi)