aboutsummaryrefslogtreecommitdiff
path: root/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-03-29 01:24:20 +0000
committerUlrich Drepper <drepper@redhat.com>2003-03-29 01:24:20 +0000
commitdd731d53dcdbb24cd2a3f299a2ba4362505d3f55 (patch)
tree9db2cc09616d8073cc8c2888036e01cc60970d5b /nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
parent10e717a20778341a2e8c7d11e3cb1cc90e943602 (diff)
downloadglibc-dd731d53dcdbb24cd2a3f299a2ba4362505d3f55.tar
glibc-dd731d53dcdbb24cd2a3f299a2ba4362505d3f55.tar.gz
glibc-dd731d53dcdbb24cd2a3f299a2ba4362505d3f55.tar.bz2
glibc-dd731d53dcdbb24cd2a3f299a2ba4362505d3f55.zip
Update.
2003-03-28 Kaz Kojima <kkojima@rr.iij4u.or.jp> * sysdeps/sh/bits/atomic.h (__arch_compare_and_exchange_val_8_acq): Return old value. Make asm output reg constraint earlyclobber. Renamed from... (__arch_compare_and_exchange_8_acq): ... this. (__arch_compare_and_exchange_val_16_acq): Return old value. Make asm output reg constraint earlyclobber. Renamed from... (__arch_compare_and_exchange_16_acq): ... this. (__arch_compare_and_exchange_val_32_acq): Return old value. Make asm output reg constraint earlyclobber. Renamed from... (__arch_compare_and_exchange_32_acq): ... this. (__arch_compare_and_exchange_val_64_acq): Renamed from... (__arch_compare_and_exchange_64_acq): ... this. (atomic_exchange_and_add): Use local variables and __arch_compare_and_exchange_val_64_acq. (atomic_add): Likewise. (atomic_add_negative, atomic_add_zero): Use local variables. * Makefile: Remove libmd5crypt goal.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S94
1 files changed, 64 insertions, 30 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
index 59aeff70fb..6ad987d005 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
@@ -41,7 +41,7 @@ __pthread_cond_timedwait:
mov.l r9, @-r15
mov.l r8, @-r15
sts.l pr, @-r15
- add #-48, r15
+ add #-64, r15
mov r4, r8
mov r5, r9
mov r6, r10
@@ -64,6 +64,9 @@ __pthread_cond_timedwait:
mov r9, r4
.Lmunlock1b:
+ tst r0, r0
+ bf 16f
+
mov #1, r2
mov #0, r3
@@ -86,18 +89,21 @@ __pthread_cond_timedwait:
mov.l .Lccleanup1, r5
#endif
mov r15, r4
- add #28, r4
+ add #36, r4
mov.l .Lccpush1, r1
bsrf r1
- mov r8, r6
+ mov r15, r6
.Lccpush1b:
/* Get and store current wakeup_seq value. */
mov.l @(wakeup_seq,r8), r0
mov.l @(wakeup_seq+4,r8), r1
- mov.l r0, @(12,r15)
- mov.l r1, @(16,r15)
+ mov.l r0, @(20,r15)
+ mov.l r1, @(24,r15)
+ /* Prepare structure passed to cancellation handler. */
+ mov.l r9, @r15
+ mov.l r8, @(4,r15)
/* Unlock. */
8:
@@ -111,27 +117,28 @@ __pthread_cond_timedwait:
bra 3f
nop
4:
+ mov r15, r4
mov.l .Lenable1, r1
bsrf r1
- nop
+ add #8, r4
+
.Lenable1b:
- mov.l r0, @r15
/* Get current time. */
mov r15, r4
- add #4, r4
+ add #12, r4
mov #0, r5
mov #SYS_gettimeofday, r3
trapa #0x12
SYSCALL_INST_PAD
/* Compute relative timeout. */
- mov.l @(8,r15), r0
+ mov.l @(16,r15), r0
mov.w .L1k, r1
dmulu.l r0, r1 /* Milli seconds to nano seconds. */
mov.l @r10, r2
mov.l @(4,r10), r3
- mov.l @(4,r15), r0
+ mov.l @(12,r15), r0
sts macl, r1
sub r0, r2
clrt
@@ -145,24 +152,24 @@ __pthread_cond_timedwait:
bf 13f /* Time is already up. */
/* Store relative timeout. */
- mov.l r2, @(4,r15)
- mov.l r3, @(8,r15)
+ mov.l r2, @(12,r15)
+ mov.l r3, @(16,r15)
mov r15, r7
- add #4, r7
+ add #12, r7
mov #FUTEX_WAIT, r5
- mov.l @(12,r15), r6
+ mov.l @(20,r15), r6
mov r8, r4
add #wakeup_seq, r4
mov #SYS_futex, r3
extu.b r3, r3
trapa #0x14
SYSCALL_INST_PAD
- mov.l r0, @(20,r15)
+ mov.l r0, @(28,r15)
mov.l .Ldisable1, r1
bsrf r1
- mov.l @r15, r4
+ mov.l @(8,r15), r4
.Ldisable1b:
/* Lock. */
@@ -181,14 +188,14 @@ __pthread_cond_timedwait:
mov.l @(wakeup_seq,r8), r2
mov.l @(wakeup_seq+4,r8), r3
- mov.l @(16,r15), r5
- cmp/hi r5, r1
+ mov.l @(24,r15), r5
+ cmp/hi r5, r3
bt 7f
- cmp/hi r1, r5
+ cmp/hi r3, r5
bt 15f
- mov.l @(12,r15), r5
- cmp/hi r0, r5
+ mov.l @(20,r15), r5
+ cmp/hs r2, r5
bt 15f
7:
cmp/hi r1, r3
@@ -198,7 +205,7 @@ __pthread_cond_timedwait:
cmp/hi r0, r2
bt 9f
15:
- mov.l @(20,r15),r0
+ mov.l @(28,r15),r0
cmp/eq #-ETIMEDOUT, r0
bf 8b
13:
@@ -214,11 +221,11 @@ __pthread_cond_timedwait:
mov.l r1,@(wakeup_seq+4,r8)
mov #ETIMEDOUT, r0
bra 14f
- mov.l r0, @(24,r15)
+ mov.l r0, @(32,r15)
9:
mov #0, r0
- mov.l r0, @(24,r15)
+ mov.l r0, @(32,r15)
14:
mov #1, r2
mov #0, r3
@@ -242,7 +249,7 @@ __pthread_cond_timedwait:
11:
/* Remove cancellation handler. */
mov r15, r4
- add #28, r4
+ add #36, r4
mov.l .Lcpop1, r1
bsrf r1
mov #0, r5
@@ -254,11 +261,13 @@ __pthread_cond_timedwait:
mov #0, r5
.Lmlocki1b:
- mov.l @(24,r15), r0
+ /* We return the result of the mutex_lock operation if it failed. */
+ tst r0, r0
+ bf 18f
+ mov.l @(32,r15), r0
- add #48, r15
-
- /* We return the result of the mutex_lock operation. */
+18:
+ add #64, r15
lds.l @r15+, pr
mov.l @r15+, r8
mov.l @r15+, r9
@@ -284,7 +293,7 @@ __pthread_cond_timedwait:
.Lccpush1:
.long __pthread_cleanup_push-.Lccpush1b
.Lenable1:
- .long __pthread_enable_asynccancel-.Lenable1b
+ .long __pthread_enable_asynccancel_2-.Lenable1b
.Ldisable1:
.long __pthread_disable_asynccancel-.Ldisable1b
.Lcpop1:
@@ -346,6 +355,29 @@ __pthread_cond_timedwait:
bra 11b
nop
+16:
+ /* The initial unlocking of the mutex failed. */
+ mov.l r0, @(32,r15)
+#if cond_lock != 0
+ DEC (@(cond_lock,r8), r2)
+#else
+ DEC (@r8, r2)
+#endif
+ tst r2, r2
+ bf 17f
+
+ mov r8, r4
+#if cond_lock != 0
+ add #cond_lock, r4
+#endif
+ mov.l .Lmwake4, r1
+ bsrf r1
+ nop
+.Lmwake4b:
+17:
+ bra 18b
+ mov.l @(32,r15), r0
+
.align 2
.Lmwait2:
.long __lll_mutex_lock_wait-.Lmwait2b
@@ -355,6 +387,8 @@ __pthread_cond_timedwait:
.long __lll_mutex_lock_wait-.Lmwait3b
.Lmwake3:
.long __lll_mutex_unlock_wake-.Lmwake3b
+.Lmwake4:
+ .long __lll_mutex_unlock_wake-.Lmwake4b
.size __pthread_cond_timedwait, .-__pthread_cond_timedwait
versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
GLIBC_2_3_2)