diff options
author | Jakub Jelinek <jakub@redhat.com> | 2004-11-02 12:26:42 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2004-11-02 12:26:42 +0000 |
commit | 80c96e8e6f452d6d9803f5a2e17030658f30afc4 (patch) | |
tree | ef584f35ed7167c7a680783415a66799c3789233 /nptl/sysdeps | |
parent | 0b5cfa4e0b7c9dc2cd81635307613c86c0f5e200 (diff) | |
download | glibc-80c96e8e6f452d6d9803f5a2e17030658f30afc4.tar glibc-80c96e8e6f452d6d9803f5a2e17030658f30afc4.tar.gz glibc-80c96e8e6f452d6d9803f5a2e17030658f30afc4.tar.bz2 glibc-80c96e8e6f452d6d9803f5a2e17030658f30afc4.zip |
Updated to fedora-glibc-20041102T1153
Diffstat (limited to 'nptl/sysdeps')
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S | 16 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S | 49 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S | 10 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/smp.h | 7 |
4 files changed, 70 insertions, 12 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S index 320fe18fe8..bcb15615e5 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S @@ -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 @@ -127,13 +128,14 @@ __lll_mutex_timedlock_wait: extu.b r3, r3 trapa #0x14 SYSCALL_INST_PAD - mov r0, r4 + mov r0, r5 -8: +8: mov #0, r3 mov #2, r4 CMPXCHG (r3, @r8, r4, r2) - bf 7f + bf/s 7f + mov #0, r0 6: add #8, r15 @@ -144,8 +146,14 @@ __lll_mutex_timedlock_wait: 7: /* Check whether the time expired. */ mov #-ETIMEDOUT, r1 - cmp/eq r4, r1 + cmp/eq r5, r1 bt 5f + + /* Make sure the current holder knows we are going to sleep. */ + XCHG (r2, @r8, r3) + tst r3, r3 + bt/s 6b + mov #0, r0 bra 1b nop 3: 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 d0c55ecfef..74206a71ec 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S @@ -133,6 +133,34 @@ __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 @@ -143,11 +171,30 @@ __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 +0: +#else + 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 sub r0, r2 clrt subc r1, r3 diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S index 27a1bb019d..acb7d0f78b 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S @@ -42,8 +42,10 @@ sem_timedwait: mov #0xf9, r1 and r1, r0 cmp/eq #8, r0 - bt 10f - + bf 0f + bra 10f + stc gbr, r0 +0: mov.l @r4, r0 2: tst r0, r0 @@ -115,7 +117,8 @@ sem_timedwait: add #-1, r2 5: cmp/pz r2 - bf 6f /* Time is already up. */ + bf/s 6f /* Time is already up. */ + mov #ETIMEDOUT, r0 /* Store relative timeout. */ mov.l r2, @r15 @@ -196,7 +199,6 @@ sem_timedwait: 10: /* Canceled. */ - stc gbr, r0 mov.w .Lresult, r1 mov #-1, r2 mov.l r2, @(r0,r1) diff --git a/nptl/sysdeps/unix/sysv/linux/smp.h b/nptl/sysdeps/unix/sysv/linux/smp.h index 718fab683b..c1160a7939 100644 --- a/nptl/sysdeps/unix/sysv/linux/smp.h +++ b/nptl/sysdeps/unix/sysv/linux/smp.h @@ -20,6 +20,7 @@ #include <fcntl.h> #include <string.h> #include <sys/sysctl.h> +#include <not-cancel.h> /* Test whether the machine has more than one processor. This is not the best test but good enough. More complicated tests would require `malloc' @@ -37,13 +38,13 @@ is_smp_system (void) buf, &reslen, NULL, 0) < 0) { /* This was not successful. Now try reading the /proc filesystem. */ - int fd = __open ("/proc/sys/kernel/version", O_RDONLY); + int fd = open_not_cancel_2 ("/proc/sys/kernel/version", O_RDONLY); if (__builtin_expect (fd, 0) == -1 - || (reslen = __read (fd, buf, sizeof (buf))) <= 0) + || (reslen = read_not_cancel (fd, buf, sizeof (buf))) <= 0) /* This also didn't work. We give up and say it's a UP machine. */ buf[0] = '\0'; - __close (fd); + close_not_cancel_no_status (fd); } return strstr (buf, "SMP") != NULL; |