aboutsummaryrefslogtreecommitdiff
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
parentd38145ff0bf53921ca125da89de54e27db722f15 (diff)
downloadglibc-a14c918ddd41c66bc2163ee6c17bdc77bd1e67de.tar
glibc-a14c918ddd41c66bc2163ee6c17bdc77bd1e67de.tar.gz
glibc-a14c918ddd41c66bc2163ee6c17bdc77bd1e67de.tar.bz2
glibc-a14c918ddd41c66bc2163ee6c17bdc77bd1e67de.zip
(__lll_mutex_lock_wait): Replace one memory operation with one register operation.
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S21
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S10
2 files changed, 19 insertions, 12 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S
index 484beafca9..a54e48c9e6 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S
@@ -45,21 +45,23 @@ __lll_mutex_lock_wait:
pushl %ebx
pushl %edx
+ /* In the loop we are going to add 2 instead of 1 which is what
+ the caller did. Account for that. */
+ subl $1, %eax
+
movl %ecx, %ebx
xorl %esi, %esi /* No timeout. */
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
1:
- leal 1(%eax), %edx /* account for the preceeded xadd. */
+ leal 2(%eax), %edx /* account for the preceeded xadd. */
movl $SYS_futex, %eax
ENTER_KERNEL
- movl $1, %eax
+ movl $2, %eax
LOCK
xaddl %eax, (%ebx)
testl %eax, %eax
- jne 1b
-
- movl $2, (%ebx)
+ jne,pn 1b
popl %edx
popl %ebx
@@ -83,13 +85,17 @@ __lll_mutex_timedlock_wait:
pushl %ebx
pushl %ebp
+ /* In the loop we are going to add 2 instead of 1 which is what
+ the caller did. Account for that. */
+ subl $1, %eax
+
/* Stack frame for the timespec and timeval structs. */
subl $8, %esp
movl %ecx, %ebp
movl %edx, %edi
-1: leal 1(%eax), %esi
+1: leal 2(%eax), %esi
/* Get current time. */
movl %esp, %ebx
@@ -122,13 +128,12 @@ __lll_mutex_timedlock_wait:
ENTER_KERNEL
movl %eax, %ecx
- movl $1, %eax
+ movl $2, %eax
LOCK
xaddl %eax, (%ebx)
testl %eax, %eax
jne 7f
- movl $2, (%ebx)
xorl %eax, %eax
6: addl $8, %esp
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