aboutsummaryrefslogtreecommitdiff
path: root/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-06-17 16:42:55 +0000
committerUlrich Drepper <drepper@redhat.com>2007-06-17 16:42:55 +0000
commit339dbf0e392567a5f14acc81cf94f997b8262b98 (patch)
tree1edba81b692119c53a53c5963f40eb0781681ecc /nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
parente0d4a4e53c831995fbb5ab4a17ea07ddc9b5ab52 (diff)
downloadglibc-339dbf0e392567a5f14acc81cf94f997b8262b98.tar
glibc-339dbf0e392567a5f14acc81cf94f997b8262b98.tar.gz
glibc-339dbf0e392567a5f14acc81cf94f997b8262b98.tar.bz2
glibc-339dbf0e392567a5f14acc81cf94f997b8262b98.zip
* sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S:
(__pthread_rwlock_rdlock): Don't use non SH-3/4 instruction. * sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S: (__pthread_rwlock_wrlock): Likewise. * sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S: (pthread_rwlock_timedrdlock): Likewise. * sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S: (pthread_rwlock_timedwrlock): Likewise. * sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S: (__pthread_rwlock_unlock): Likewise. 2007-06-10 Kaz Kojima <kkojima@rr.iij4u.or.jp> * sysdeps/sh/tcb-offsets.sym: Add PRIVATE_FUTEX. * sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h: Include endian.h. Split __flags into __flags, __shared, __pad1 and __pad2. * sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S: Use private futexes if they are available. * sysdeps/unix/sysv/linux/sh/lowlevellock.S: Adjust so that change in libc-lowlevellock.S allow using private futexes. * sysdeps/unix/sysv/linux/sh/lowlevellock.h: Define FUTEX_PRIVATE_FLAG. Add additional parameter to lll_futex_wait, lll_futex_timed_wait and lll_futex_wake. Change lll_futex_wait to call lll_futex_timed_wait. Add lll_private_futex_wait, lll_private_futex_timed_wait and lll_private_futex_wake. (lll_robust_mutex_unlock): Fix typo. * sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S: Use private field in futex command setup. * sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S: Use COND_NWAITERS_SHIFT instead of COND_CLOCK_BITS. * sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S: Likewise. * sysdeps/unix/sysv/linux/sh/pthread_once.S: Use private futexes if they are available. Remove clear_once_control. * sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S: Use private futexes if they are available. * sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S: Likewise. * sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S: Likewise. * sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S: Likewise. * sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S: Likewise. * sysdeps/unix/sysv/linux/sh/sem_post.S: Add private futex support. Wake only when there are waiters. * sysdeps/unix/sysv/linux/sh/sem_wait.S: Add private futex support. Indicate that there are waiters. Remove unnecessary extra cancellation test. * sysdeps/unix/sysv/linux/sh/sem_timedwait.S: Likewise. Removed left-over duplication of __sem_wait_cleanup.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S31
1 files changed, 25 insertions, 6 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
index 3b0b66d436..b10903bcd7 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
@@ -24,8 +24,24 @@
#define SYS_gettimeofday __NR_gettimeofday
#define SYS_futex 240
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
+#ifndef FUTEX_WAIT
+# define FUTEX_WAIT 0
+# define FUTEX_WAKE 1
+#endif
+
+#ifndef LOAD_FUTEX_WAIT
+# if FUTEX_WAIT == 0
+# define LOAD_FUTEX_WAIT(reg,tmp) \
+ xor reg, reg
+# else
+# define LOAD_FUTEX_WAIT(reg,tmp) \
+ mov #FUTEX_WAIT, reg; \
+ extu.b reg, reg
+# endif
+# define LOAD_FUTEX_WAKE(reg,tmp) \
+ mov #FUTEX_WAKE, reg; \
+ extu.b reg, reg
+#endif
.globl __lll_mutex_lock_wait
@@ -40,7 +56,7 @@ __lll_mutex_lock_wait:
mov r4, r6
mov r5, r8
mov #0, r7 /* No timeout. */
- mov #FUTEX_WAIT, r5
+ LOAD_FUTEX_WAIT (r5, r0)
mov #2, r4
cmp/eq r4, r6
@@ -133,7 +149,7 @@ __lll_mutex_timedlock_wait:
bt 8f
mov r8, r4
- mov #FUTEX_WAIT, r5
+ LOAD_FUTEX_WAIT (r5, r0)
mov r10, r6
mov r15, r7
mov #SYS_futex, r3
@@ -192,7 +208,7 @@ __lll_mutex_timedlock_wait:
.align 5
cfi_startproc
__lll_mutex_unlock_wake:
- mov #FUTEX_WAKE, r5
+ LOAD_FUTEX_WAKE (r5, r0)
mov #1, r6 /* Wake one thread. */
mov #0, r7
mov.l r7, @r4 /* Stores 0. */
@@ -261,7 +277,10 @@ __lll_timedwait_tid:
bt 4f
mov r8, r4
- mov #FUTEX_WAIT, r5
+ /* XXX The kernel so far uses global futex for the wakeup at
+ all times. */
+ mov #0, r5
+ extu.b r5, r5
mov r2, r6
mov r15, r7
mov #SYS_futex, r3