patch-2.1.127 linux/include/asm-sparc64/semaphore.h
Next file: linux/include/asm-sparc64/sigcontext.h
Previous file: linux/include/asm-sparc64/sab82532.h
Back to the patch index
Back to the overall index
- Lines: 36
- Date:
Tue Oct 27 09:52:21 1998
- Orig file:
v2.1.126/linux/include/asm-sparc64/semaphore.h
- Orig date:
Sat Aug 16 09:51:10 1997
diff -u --recursive --new-file v2.1.126/linux/include/asm-sparc64/semaphore.h linux/include/asm-sparc64/semaphore.h
@@ -24,17 +24,24 @@
#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)
{
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov