summaryrefslogtreecommitdiff
path: root/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
2.5-18.1
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, 79 insertions, 18 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
index d5c9345558..394dec8d82 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, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -43,17 +43,25 @@
.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
- movq %r10, %rsi /* movq $FUTEX_WAIT, %rsi */
+#if FUTEX_WAIT == 0
+ xorl %esi, %esi
+#else
+ movl $FUTEX_WAIT, %esi
+#endif
cmpl %edx, %eax /* NB: %edx == 2 */
jne 2f
-1: movq $SYS_futex, %rax
+1: movl $SYS_futex, %eax
syscall
2: movl %edx, %eax
@@ -63,8 +71,13 @@ __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
@@ -74,18 +87,30 @@ __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
@@ -93,7 +118,7 @@ __lll_mutex_timedlock_wait:
1:
/* Get current time. */
movq %rsp, %rdi
- xorq %rsi, %rsi
+ xorl %esi, %esi
movq $VSYSCALL_ADDR_vgettimeofday, %rax
/* This is a regular function call, all caller-save registers
might be clobbered. */
@@ -101,7 +126,7 @@ __lll_mutex_timedlock_wait:
/* Compute relative timeout. */
movq 8(%rsp), %rax
- movq $1000, %rdi
+ movl $1000, %edi
mul %rdi /* Milli seconds to nano seconds. */
movq (%r13), %rdi
movq 8(%r13), %rsi
@@ -126,26 +151,50 @@ __lll_mutex_timedlock_wait:
je 8f
movq %rsp, %r10
- xorq %rsi, %rsi /* movq $FUTEX_WAIT, %rsi */
+#if FUTEX_WAIT == 0
+ xorl %esi, %esi
+#else
+ movl $FUTEX_WAIT, %esi
+#endif
movq %r12, %rdi
- movq $SYS_futex, %rax
+ movl $SYS_futex, %eax
syscall
movq %rax, %rcx
8: /* NB: %edx == 2 */
xorl %eax, %eax
LOCK
- cmpxchgl %edx, (%rdi)
+ cmpxchgl %edx, (%r12)
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
@@ -157,11 +206,9 @@ __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
@@ -191,18 +238,28 @@ 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)
- movq $FUTEX_WAKE, %rsi
+ movl $FUTEX_WAKE, %esi
movl $1, %edx /* Wake one thread. */
- movq $SYS_futex, %rax
+ movl $SYS_futex, %eax
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
@@ -222,13 +279,13 @@ __lll_timedwait_tid:
/* Get current time. */
2: movq %rsp, %rdi
- xorq %rsi, %rsi
+ xorl %esi, %esi
movq $VSYSCALL_ADDR_vgettimeofday, %rax
callq *%rax
/* Compute relative timeout. */
movq 8(%rsp), %rax
- movq $1000, %rdi
+ movl $1000, %edi
mul %rdi /* Milli seconds to nano seconds. */
movq (%r13), %rdi
movq 8(%r13), %rsi
@@ -248,9 +305,13 @@ __lll_timedwait_tid:
jz 4f
movq %rsp, %r10
- xorq %rsi, %rsi /* movq $FUTEX_WAIT, %rsi */
+#if FUTEX_WAIT == 0
+ xorl %esi, %esi
+#else
+ movl $FUTEX_WAIT, %esi
+#endif
movq %r12, %rdi
- movq $SYS_futex, %rax
+ movl $SYS_futex, %eax
syscall
cmpl $0, (%rdi)