diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2001-01-11 04:02:40 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2001-01-11 04:02:40 +0000 |
commit | e47f00743fc4776491344f2c618cc8dc2c23bcbc (patch) | |
tree | 13e03a113a82a184c51c19c209867cfd3a59b3b9 /include/asm-sparc/semaphore-helper.h | |
parent | b2ad5f821b1381492d792ca10b1eb7a107b48f14 (diff) |
Merge with Linux 2.4.0.
Diffstat (limited to 'include/asm-sparc/semaphore-helper.h')
-rw-r--r-- | include/asm-sparc/semaphore-helper.h | 169 |
1 files changed, 0 insertions, 169 deletions
diff --git a/include/asm-sparc/semaphore-helper.h b/include/asm-sparc/semaphore-helper.h deleted file mode 100644 index a4dd421be..000000000 --- a/include/asm-sparc/semaphore-helper.h +++ /dev/null @@ -1,169 +0,0 @@ -#ifndef _SPARC_SEMAPHORE_HELPER_H -#define _SPARC_SEMAPHORE_HELPER_H - -#include <linux/config.h> - -/* - * (barely) SMP- and interrupt-safe semaphore helper functions, sparc version. - * - * (C) Copyright 1999 David S. Miller (davem@redhat.com) - * (C) Copyright 1999 Jakub Jelinek (jj@ultra.linux.cz) - */ -#define wake_one_more(sem) atomic_inc(&(sem)->waking) -static __inline__ int waking_non_zero(struct semaphore *sem) -{ - int ret; - -#ifdef CONFIG_SMP - int tmp; - - __asm__ __volatile__(" - rd %%psr, %%g1 - or %%g1, %3, %0 - wr %0, 0x0, %%psr - nop; nop; nop; -1: ldstub [%2 + 3], %0 - tst %0 - bne 1b - ld [%2], %0 - andn %0, 0xff, %1 - subcc %0, 0x1ff, %0 - bl,a 1f - mov 0, %0 - mov %0, %1 - mov 1, %0 -1: st %1, [%2] - wr %%g1, 0x0, %%psr - nop; nop; nop\n" - : "=&r" (ret), "=&r" (tmp) - : "r" (&sem->waking), "i" (PSR_PIL) - : "g1", "memory", "cc"); -#else - __asm__ __volatile__(" - rd %%psr, %%g1 - or %%g1, %2, %0 - wr %0, 0x0, %%psr - nop; nop; nop; - ld [%1], %0 - subcc %0, 1, %0 - bl,a 1f - mov 0, %0 - st %0, [%1] - mov 1, %0 -1: wr %%g1, 0x0, %%psr - nop; nop; nop\n" - : "=&r" (ret) - : "r" (&sem->waking), "i" (PSR_PIL) - : "g1", "memory", "cc"); -#endif - return ret; -} - -static __inline__ int waking_non_zero_interruptible(struct semaphore *sem, - struct task_struct *tsk) -{ - int ret; - -#ifdef CONFIG_SMP - int tmp; - - __asm__ __volatile__(" - rd %%psr, %%g1 - or %%g1, %3, %0 - wr %0, 0x0, %%psr - nop; nop; nop; -1: ldstub [%2 + 3], %0 - tst %0 - bne 1b - ld [%2], %0 - andn %0, 0xff, %1 - subcc %0, 0x1ff, %0 - bl,a 1f - mov 0, %0 - mov %0, %1 - mov 1, %0 -1: st %1, [%2] - wr %%g1, 0x0, %%psr - nop; nop; nop\n" - : "=&r" (ret), "=&r" (tmp) - : "r" (&sem->waking), "i" (PSR_PIL) - : "g1", "memory", "cc"); -#else - __asm__ __volatile__(" - rd %%psr, %%g1 - or %%g1, %2, %0 - wr %0, 0x0, %%psr - nop; nop; nop; - ld [%1], %0 - subcc %0, 1, %0 - bl,a 1f - mov 0, %0 - st %0, [%1] - mov 1, %0 -1: wr %%g1, 0x0, %%psr - nop; nop; nop\n" - : "=&r" (ret) - : "r" (&sem->waking), "i" (PSR_PIL) - : "g1", "memory", "cc"); -#endif - if(ret == 0 && signal_pending(tsk)) { - atomic_inc(&sem->count); - ret = -EINTR; - } - return ret; -} - -static __inline__ int waking_non_zero_trylock(struct semaphore *sem) -{ - int ret; - -#ifdef CONFIG_SMP - int tmp; - - __asm__ __volatile__(" - rd %%psr, %%g1 - or %%g1, %3, %0 - wr %0, 0x0, %%psr - nop; nop; nop; -1: ldstub [%2 + 3], %0 - tst %0 - bne 1b - ld [%2], %0 - andn %0, 0xff, %1 - subcc %0, 0x1ff, %0 - bl,a 1f - mov 0, %0 - mov %0, %1 - mov 1, %0 -1: st %1, [%2] - wr %%g1, 0x0, %%psr - nop; nop; nop\n" - : "=&r" (ret), "=&r" (tmp) - : "r" (&sem->waking), "i" (PSR_PIL) - : "g1", "memory", "cc"); -#else - __asm__ __volatile__(" - rd %%psr, %%g1 - or %%g1, %2, %0 - wr %0, 0x0, %%psr - nop; nop; nop; - ld [%1], %0 - subcc %0, 1, %0 - bl,a 1f - mov 0, %0 - st %0, [%1] - mov 1, %0 -1: wr %%g1, 0x0, %%psr - nop; nop; nop\n" - : "=&r" (ret) - : "r" (&sem->waking), "i" (PSR_PIL) - : "g1", "memory", "cc"); -#endif - ret = !ret; - if(ret == 1) - atomic_inc(&sem->count); - return ret; -} - -#endif /* !(_SPARC_SEMAPHORE_HELPER_H) */ - |