about summary refs log tree commit diff
path: root/nptl/sysdeps/unix/sysv/linux/x86_64
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-05-30 17:49:37 +0000
committerUlrich Drepper <drepper@redhat.com>2003-05-30 17:49:37 +0000
commita14c918ddd41c66bc2163ee6c17bdc77bd1e67de (patch)
treee0ed38215fc20a2101eccdec5fb40c8856cb2516 /nptl/sysdeps/unix/sysv/linux/x86_64
parentd38145ff0bf53921ca125da89de54e27db722f15 (diff)
downloadglibc-a14c918ddd41c66bc2163ee6c17bdc77bd1e67de.tar.gz
glibc-a14c918ddd41c66bc2163ee6c17bdc77bd1e67de.tar.xz
glibc-a14c918ddd41c66bc2163ee6c17bdc77bd1e67de.zip
(__lll_mutex_lock_wait): Replace one memory operation with one register operation.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/x86_64')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S10
1 files changed, 6 insertions, 4 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S
index 1b2731a29e..2a2f847684 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S
@@ -46,22 +46,24 @@ __lll_mutex_lock_wait:
 	pushq	%r10
 	pushq	%rdx
 
+	/* In the loop we are going to add 2 instead of 1 which is what
+	   the caller did.  Account for that.  */
+	decq	%rsi
+
 	xorq	%r10, %r10	/* No timeout.  */
 
 1:
-	leaq	1(%rsi), %rdx	/* account for the preceeded xadd.  */
+	leaq	2(%rsi), %rdx	/* account for the preceeded xadd.  */
 	movq	%r10, %rsi	/* movq $FUTEX_WAIT, %rsi */
 	movq	$SYS_futex, %rax
 	syscall
 
-	movl	$1, %esi
+	movl	$2, %esi
 	LOCK
 	xaddl	%esi, (%rdi)
 	testl	%esi, %esi
 	jne	1b
 
-	movl	$2, (%rdi)
-
 	popq	%rdx
 	popq	%r10
 	retq