summaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-05-27 04:24:31 +0000
committerUlrich Drepper <drepper@redhat.com>2003-05-27 04:24:31 +0000
commit7661d9f7838cedc4e35bf86b83cd4d27e41c8e4d (patch)
tree573208501c1e83b28b9492650e2a729724d6e1f2 /nptl
parent91ceedb37f9fda2460557cd61944e4d706caad3c (diff)
downloadglibc-7661d9f7838cedc4e35bf86b83cd4d27e41c8e4d.tar.gz
Update.
2003-05-26 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Fix typo in register name. * sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Use parameters correctly. Actually use requeue. Little optimization. * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Store mutex address early. Handle cancellation state as 32-bit value. * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise. Remove unnecessary label.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S18
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S12
4 files changed, 34 insertions, 17 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index f85d8b95fc..1b175fa8bb 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,14 @@
+2003-05-26 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Fix
+ typo in register name.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Use parameters
+ correctly. Actually use requeue. Little optimization.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Store
+ mutex address early. Handle cancellation state as 32-bit value.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
+ Remove unnecessary label.
+
2003-05-25 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread_cond_broadcast.c: Try using FUTEX_REQUEUE
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
index 709fcf4ca8..d62310148d 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
@@ -45,17 +45,18 @@
__pthread_cond_signal:
/* Get internal lock. */
+ movq %rdi, %r8
movl $1, %esi
LOCK
#if cond_lock == 0
- xaddl %esi, (%r8)
+ xaddl %esi, (%rdi)
#else
- xaddl %esi, cond_lock(%r8)
+ xaddl %esi, cond_lock(%rdi)
#endif
testl %esi, %esi
jne 1f
-2: leaq wakeup_seq(%r8), %rdi
+2: addq $wakeup_seq, %rdi
movq total_seq(%r8), %rcx
cmpq (%rdi), %rcx
jbe 4f
@@ -64,7 +65,7 @@ __pthread_cond_signal:
addq $1, (%rdi)
/* Wake up one thread. */
- movq $FUTEX_WAKE, %rsi
+ movq $FUTEX_REQUEUE, %rsi
movq $SYS_futex, %rax
xorq %rdx, %rdx
movq $1, %r10
@@ -81,7 +82,11 @@ __pthread_cond_signal:
/* Unlock. */
4: LOCK
+#if cond_lock == 0
+ decl (%r8)
+#else
decl cond_lock(%r8)
+#endif
jne 5f
6: xorl %eax, %eax
@@ -98,7 +103,7 @@ __pthread_cond_signal:
#endif
jmp 2b
- /* Unlock in loop requires waekup. */
+ /* Unlock in loop requires wakeup. */
5:
#if cond_lock != 0
addq $cond_lock-wakeup_seq, %rdi
@@ -111,10 +116,11 @@ __pthread_cond_signal:
#ifndef __ASSUME_FUTEX_REQUEUE
7: /* The futex requeue functionality is not available. */
movq $1, %rdx
- movq $FUTEX_WAKE, %esi
+ movq $FUTEX_WAKE, %rsi
movq $SYS_futex, %rax
syscall
jmp 4b
+#endif
.size __pthread_cond_signal, .-__pthread_cond_signal
versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
GLIBC_2_3_2)
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
index c8fd4ea129..b64953ba83 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
@@ -76,6 +76,8 @@ __pthread_cond_timedwait:
movq %rsi, 16(%rsp)
movq %rdx, %r13
+ movq %rsi, dep_mutex(%rdi)
+
/* Get internal lock. */
movl $1, %esi
LOCK
@@ -88,9 +90,7 @@ __pthread_cond_timedwait:
jne 1f
/* Unlock the mutex. */
-2: movq %rdi, %rax
- movq 16(%rsp), %rdi
- movq %rdi, dep_mutex(%rax)
+2: movq 16(%rsp), %rdi
callq __pthread_mutex_unlock_internal
testl %eax, %eax
@@ -124,7 +124,7 @@ __pthread_cond_timedwait:
jne 3f
4: callq __pthread_enable_asynccancel
- movq %rax, (%rsp)
+ movl %eax, (%rsp)
/* Get the current time. */
#ifdef __NR_clock_gettime
@@ -181,7 +181,7 @@ __pthread_cond_timedwait:
syscall
movq %rax, %r14
- movq (%rsp), %rdi
+ movl (%rsp), %edi
callq __pthread_disable_asynccancel
/* Lock. */
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
index 5189972fc7..2c6c6ce338 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
@@ -87,7 +87,7 @@ __condvar_cleanup:
movq 16(%r8), %rdi
callq __pthread_mutex_cond_lock
-3: retq
+ retq
.size __condvar_cleanup, .-__condvar_cleanup
@@ -121,6 +121,8 @@ __pthread_cond_wait:
movq %rdi, 8(%rsp)
movq %rsi, 16(%rsp)
+ movq %rsi, dep_mutex(%rdi)
+
/* Get internal lock. */
movl $1, %esi
LOCK
@@ -133,9 +135,7 @@ __pthread_cond_wait:
jne 1f
/* Unlock the mutex. */
-2: movq %rdi, %rax
- movq 16(%rsp), %rdi
- movq %rdi, dep_mutex(%rax)
+2: movq 16(%rsp), %rdi
callq __pthread_mutex_unlock_internal
testl %eax, %eax
@@ -169,7 +169,7 @@ __pthread_cond_wait:
jne 3f
4: callq __pthread_enable_asynccancel
- movq %rax, (%rsp)
+ movl %eax, (%rsp)
movq 8(%rsp), %rdi
xorq %r10, %r10
@@ -179,7 +179,7 @@ __pthread_cond_wait:
movq %r10, %rsi /* movq $FUTEX_WAIT, %rsi */
syscall
- movq (%rsp), %rdi
+ movl (%rsp), %edi
callq __pthread_disable_asynccancel
/* Lock. */