From: Kaz Kojima <kkojima@rr.iij4u.or.jp>
To: libc-hacker@sources.redhat.com
Subject: [PATCH] SH: nptl fixups
Date: Tue, 01 Jun 2004 05:33:00 -0000 [thread overview]
Message-ID: <20040601.143123.122597557.kkojima@rr.iij4u.or.jp> (raw)
Hi,
The appended patch updates the SH specific part of NPTL.
BTW, in translating recent i386 change into sh one, I've found
that __broadcast_seq field is stored into 20(%esp):
movl broadcast_seq(%ebx), %eax
movl %edi, 12(%esp)
movl %edx, 16(%esp)
movl %eax, 20(%esp)
in pthread_cond_timedwait.S:__pthread_cond_timedwait, while
it's compared with 12(%esp) in __condvar_tw_cleanup:
1: movl broadcast_seq(%ebx), %eax
cmpl 12(%esp), %eax
jne 3f
It should be "cmpl 20(%esp), %eax", shouldn't it?
Regards,
kaz
--
2004-06-01 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h (pthread_cond_t):
Add __broadcast_seq field.
* sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S: Mark
all waiters as woken with woken_seq and bump broadcast counter.
* sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S: Use new
__broadcast_seq. Increment __woken_seq correctly when cleanuped.
* sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S: Likewise.
Comment typo fixes. Avoid returning -ETIMEDOUT.
diff -u3prN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h
--- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h Tue Mar 30 10:41:09 2004
+++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h Mon May 31 09:42:26 2004
@@ -82,6 +82,7 @@ typedef union
unsigned long long int __wakeup_seq;
unsigned long long int __woken_seq;
void *__mutex;
+ unsigned int __broadcast_seq;
} __data;
char __size[__SIZEOF_PTHREAD_COND_T];
long long int __align;
diff -u3prN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S
--- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S Sat Mar 20 15:24:28 2004
+++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S Mon May 31 12:24:57 2004
@@ -67,6 +67,11 @@ __pthread_cond_broadcast:
woken up. */
mov.l r1, @(wakeup_seq,r8)
mov.l r0, @(wakeup_seq+4,r8)
+ mov.l r1, @(woken_seq,r8)
+ mov.l r0, @(woken_seq+4,r8)
+ mov.l @(broadcast_seq,r8), r2
+ add #1, r2
+ mov.l r2, @(broadcast_seq,r8)
/* Get the address of the mutex used. */
mov.l @(dep_mutex,r8), r9
diff -u3prN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
--- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S Mon Apr 19 09:16:40 2004
+++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S Tue Jun 1 13:40:34 2004
@@ -114,6 +114,8 @@ __pthread_cond_timedwait:
/* Get and store current wakeup_seq value. */
mov.l @(wakeup_seq,r8), r10
mov.l @(wakeup_seq+4,r8), r11
+ mov.l @(broadcast_seq,r8), r0
+ mov.l r0, @(4,r15)
8:
/* Get current time. */
@@ -140,8 +142,10 @@ __pthread_cond_timedwait:
add r1, r3
add #-1, r2
12:
+ mov #-ETIMEDOUT, r1
+ mov.l r1, @(12,r15)
cmp/pz r2
- bf 13f /* Time is already up. */
+ bf 6f /* Time is already up. */
/* Store relative timeout. */
mov.l r2, @(16,r15)
@@ -193,6 +197,11 @@ __pthread_cond_timedwait:
#endif
bf 5f
6:
+ mov.l @(broadcast_seq,r8), r0
+ mov.l @(4,r15), r1
+ cmp/eq r0, r1
+ bf 23f
+
mov.l @(woken_seq,r8), r0
mov.l @(woken_seq+4,r8), r1
@@ -212,7 +221,7 @@ __pthread_cond_timedwait:
mov.l @(12,r15),r0
cmp/eq #-ETIMEDOUT, r0
bf 8b
-13:
+
mov #1, r2
mov #0, r3
@@ -227,6 +236,11 @@ __pthread_cond_timedwait:
bra 14f
mov.l r0, @(24,r15)
+23:
+ mov #0, r0
+ bra 24f
+ mov.l r0, @(24,r15)
+
9:
mov #0, r0
mov.l r0, @(24,r15)
@@ -242,6 +256,7 @@ __pthread_cond_timedwait:
mov.l r0,@(woken_seq,r8)
mov.l r1,@(woken_seq+4,r8)
+24:
#if cond_lock != 0
DEC (@(cond_lock,r8), r2)
#else
@@ -301,7 +316,7 @@ __pthread_cond_timedwait:
nop
3:
- /* Unlock in loop requires waekup. */
+ /* Unlock in loop requires wakeup. */
mov r8, r4
#if cond_lock != 0
add #cond_lock, r4
@@ -327,7 +342,7 @@ __pthread_cond_timedwait:
nop
10:
- /* Unlock after loop requires waekup. */
+ /* Unlock after loop requires wakeup. */
mov r8, r4
#if cond_lock != 0
add #cond_lock, r4
@@ -403,6 +418,11 @@ __condvar_tw_cleanup:
.Lmwait5b:
1:
+ mov.l @(broadcast_seq,r8), r0
+ mov.l @(4,r15), r1
+ cmp/eq r0, r1
+ bf 3f
+
mov #1, r2
mov #0, r3
@@ -414,6 +434,15 @@ __condvar_tw_cleanup:
mov.l r0,@(wakeup_seq,r8)
mov.l r1,@(wakeup_seq+4,r8)
+ clrt
+ mov.l @(woken_seq,r8),r0
+ mov.l @(woken_seq+4,r8),r1
+ addc r2, r0
+ addc r3, r1
+ mov.l r0,@(woken_seq,r8)
+ mov.l r1,@(woken_seq+4,r8)
+
+3:
#if cond_lock != 0
DEC (@(cond_lock,r8), r2)
#else
diff -u3prN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S
--- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S Mon Apr 19 09:16:40 2004
+++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S Tue Jun 1 13:40:38 2004
@@ -108,6 +108,8 @@ __pthread_cond_wait:
/* Get and store current wakeup_seq value. */
mov.l @(wakeup_seq,r8), r10
mov.l @(wakeup_seq+4,r8), r11
+ mov.l @(broadcast_seq,r8), r0
+ mov.l r0, @(4,r15)
8:
/* Unlock. */
@@ -152,6 +154,11 @@ __pthread_cond_wait:
#endif
bf 5f
6:
+ mov.l @(broadcast_seq,r8), r0
+ mov.l @(4,r15), r1
+ cmp/eq r0, r1
+ bf 16f
+
mov.l @(woken_seq,r8), r0
mov.l @(woken_seq+4,r8), r1
@@ -179,6 +186,7 @@ __pthread_cond_wait:
mov.l r0,@(woken_seq,r8)
mov.l r1,@(woken_seq+4,r8)
+16:
#if cond_lock != 0
DEC (@(cond_lock,r8), r2)
#else
@@ -330,6 +338,11 @@ __condvar_w_cleanup:
.Lmwait3b:
1:
+ mov.l @(broadcast_seq,r8), r0
+ mov.l @(4,r15), r1
+ cmp/eq r0, r1
+ bf 3f
+
mov #1, r2
mov #0, r3
@@ -341,6 +354,15 @@ __condvar_w_cleanup:
mov.l r0,@(wakeup_seq,r8)
mov.l r1,@(wakeup_seq+4,r8)
+ clrt
+ mov.l @(woken_seq,r8),r0
+ mov.l @(woken_seq+4,r8),r1
+ addc r2, r0
+ addc r3, r1
+ mov.l r0,@(woken_seq,r8)
+ mov.l r1,@(woken_seq+4,r8)
+
+3:
#if cond_lock != 0
DEC (@(cond_lock,r8), r2)
#else
next reply other threads:[~2004-06-01 5:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-01 5:33 Kaz Kojima [this message]
2004-06-01 18:17 ` Ulrich Drepper
2004-06-13 6:16 Kaz Kojima
2004-06-17 23:58 ` Ulrich Drepper
2006-09-12 22:28 Kaz Kojima
2006-09-17 6:02 ` Ulrich Drepper
2008-01-21 14:27 Kaz Kojima
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040601.143123.122597557.kkojima@rr.iij4u.or.jp \
--to=kkojima@rr.iij4u.or.jp \
--cc=libc-hacker@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).