* [PATCH] SH: Fixup for NPTL
@ 2004-10-25 12:17 Kaz Kojima
2004-10-25 19:07 ` Ulrich Drepper
0 siblings, 1 reply; 2+ messages in thread
From: Kaz Kojima @ 2004-10-25 12:17 UTC (permalink / raw)
To: libc-hacker
The first hunk of the appended patch is to use clock_gettime syscall
in pthread_cond_timedwait.S as done for the other targets. The latter
is a yet another fixup of __lll_mutex_timedlock_wait.
Regards,
kaz
--
2004-10-25 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
(__pthread_cond_timedwait): Use clock_gettime syscall if exists.
* sysdeps/unix/sysv/linux/sh/lowlevellock.S
(__lll_mutex_timedlock_wait): Fix a bad branch condition.
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 Sep 20 09:31:30 2004
+++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S Sun Oct 24 09:39:11 2004
@@ -133,6 +133,52 @@ __pthread_cond_timedwait:
8:
/* Get current time. */
+#ifdef __NR_clock_gettime
+ /* Get the clock number. */
+ mov.l @(cond_nwaiters,r8), r4
+ mov #((1 << clock_bits) - 1), r0
+ and r0, r4
+ /* Only clocks 0 and 1 are allowed. Both are handled in the
+ kernel. */
+ mov r15, r5
+ add #16, r5
+ mov.w .L__NR_clock_gettime, r3
+ trapa #0x12
+ SYSCALL_INST_PAD
+# ifndef __ASSUME_POSIX_TIMERS
+ cmp/eq #-ENOSYS, r0
+ bt 19f
+# endif
+
+ /* Compute relative timeout. */
+ mov.l @r13, r2
+ mov.l @(4,r13), r3
+ mov.l @(16,r15), r0
+ bra 0f
+ mov.l @(20,r15), r1
+.L__NR_clock_gettime:
+ .word __NR_clock_gettime
+
+# ifndef __ASSUME_POSIX_TIMERS
+19:
+ mov r15, r4
+ add #16, r4
+ mov #0, r5
+ mov #SYS_gettimeofday, r3
+ trapa #0x12
+ SYSCALL_INST_PAD
+
+ /* Compute relative timeout. */
+ mov.l @(20,r15), r0
+ mov.w .L1k, r1
+ dmulu.l r0, r1 /* Micro seconds to nano seconds. */
+ mov.l @r13, r2
+ mov.l @(4,r13), r3
+ mov.l @(16,r15), r0
+ sts macl, r1
+#endif
+0:
+#else
mov r15, r4
add #16, r4
mov #0, r5
@@ -143,11 +189,12 @@ __pthread_cond_timedwait:
/* Compute relative timeout. */
mov.l @(20,r15), r0
mov.w .L1k, r1
- dmulu.l r0, r1 /* Milli seconds to nano seconds. */
+ dmulu.l r0, r1 /* Micro seconds to nano seconds. */
mov.l @r13, r2
mov.l @(4,r13), r3
mov.l @(16,r15), r0
sts macl, r1
+#endif
sub r0, r2
clrt
subc r1, r3
diff -u3prN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
--- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S Fri Oct 22 22:07:32 2004
+++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S Sat Oct 23 10:02:23 2004
@@ -117,6 +117,7 @@ __lll_mutex_timedlock_wait:
mov #1, r3
mov #2, r4
CMPXCHG (r3, @r8, r4, r2)
+ tst r2, r2
bt 8f
mov r8, r4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] SH: Fixup for NPTL
2004-10-25 12:17 [PATCH] SH: Fixup for NPTL Kaz Kojima
@ 2004-10-25 19:07 ` Ulrich Drepper
0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2004-10-25 19:07 UTC (permalink / raw)
To: Kaz Kojima; +Cc: libc-hacker
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Applied.
- --
⧠Ulrich Drepper ⧠Red Hat, Inc. ⧠444 Castro St ⧠Mountain View, CA â
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
iD8DBQFBfU7S2ijCOnn/RHQRAnpwAJ9g4TzvHKUmXV/xJY1jl7PdSWCoiQCgkyQe
CN1nosclEJHCjZPqhjQcSKE=
=Jp3Q
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-10-25 19:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-25 12:17 [PATCH] SH: Fixup for NPTL Kaz Kojima
2004-10-25 19:07 ` Ulrich Drepper
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).