diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-01-04 16:03:48 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-01-04 16:03:48 +0000 |
commit | 78c388aed2b7184182c08428db1de6c872d815f5 (patch) | |
tree | 4b2003b1b4ceb241a17faa995da8dd1004bb8e45 /include/asm-sparc64/semaphore.h | |
parent | eb7a5bf93aaa4be1d7c6181100ab7639e74d67f7 (diff) |
Merge with Linux 2.1.131 and more MIPS goodies.
(Did I mention that CVS is buggy ...)
Diffstat (limited to 'include/asm-sparc64/semaphore.h')
-rw-r--r-- | include/asm-sparc64/semaphore.h | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/include/asm-sparc64/semaphore.h b/include/asm-sparc64/semaphore.h index 4a5912bb9..b0eb13911 100644 --- a/include/asm-sparc64/semaphore.h +++ b/include/asm-sparc64/semaphore.h @@ -24,17 +24,24 @@ extern void __up(struct semaphore * sem); #define wake_one_more(sem) atomic_inc(&sem->waking); -#define waking_non_zero(sem) \ -({ unsigned long flags; \ - int ret = 0; \ - save_and_cli(flags); \ - if (atomic_read(&sem->waking) > 0) { \ - atomic_dec(&sem->waking); \ - ret = 1; \ - } \ - restore_flags(flags); \ - ret; \ -}) +static __inline__ int waking_non_zero(struct semaphore *sem) +{ + int ret; + + __asm__ __volatile__(" +1: ldsw [%1], %%g5 + brlez,pt %%g5, 2f + mov 0, %0 + sub %%g5, 1, %%g7 + cas [%1], %%g5, %%g7 + cmp %%g5, %%g7 + bne,pn %%icc, 1b + mov 1, %0 +2:" : "=r" (ret) + : "r" (&((sem)->waking)) + : "g5", "g7", "cc", "memory"); + return ret; +} extern __inline__ void down(struct semaphore * sem) { |