patch-2.3.45 linux/include/asm-arm/proc-armv/semaphore.h
Next file: linux/include/asm-arm/semaphore.h
Previous file: linux/include/asm-arm/proc-armv/locks.h
Back to the patch index
Back to the overall index
- Lines: 118
- Date:
Wed Dec 31 16:00:00 1969
- Orig file:
v2.3.44/linux/include/asm-arm/proc-armv/semaphore.h
- Orig date:
Thu Jun 17 01:11:35 1999
diff -u --recursive --new-file v2.3.44/linux/include/asm-arm/proc-armv/semaphore.h linux/include/asm-arm/proc-armv/semaphore.h
@@ -1,117 +0,0 @@
-/*
- * linux/include/asm-arm/semaphore.h
- */
-#ifndef __ASM_PROC_SEMAPHORE_H
-#define __ASM_PROC_SEMAPHORE_H
-
-/*
- * This is ugly, but we want the default case to fall through.
- * "__down" is the actual routine that waits...
- */
-extern inline void down(struct semaphore * sem)
-{
- unsigned int cpsr, temp;
-
- __asm__ __volatile__ ("
- @ atomic down operation
- mrs %0, cpsr
- orr %1, %0, #128 @ disable IRQs
- msr cpsr, %1
- ldr %1, [%2]
- bic %0, %0, #0x80000000 @ clear N
- subs %1, %1, #1
- str %1, [%2]
- orrmi %0, %0, #0x80000000 @ set N
- msr cpsr, %0
- movmi r0, %2
- blmi " SYMBOL_NAME_STR(__down_failed)
- : "=&r" (cpsr), "=&r" (temp)
- : "r" (sem)
- : "r0", "lr", "cc");
-}
-
-/*
- * This is ugly, but we want the default case to fall through.
- * "__down_interruptible" is the actual routine that waits...
- */
-extern inline int down_interruptible (struct semaphore * sem)
-{
- unsigned int cpsr, temp;
-
- __asm__ __volatile__ ("
- @ atomic down interruptible operation
- mrs %0, cpsr
- orr %1, %0, #128 @ disable IRQs
- msr cpsr, %1
- ldr %1, [%2]
- bic %0, %0, #0x80000000 @ clear N
- subs %1, %1, #1
- str %1, [%2]
- orrmi %0, %0, #0x80000000 @ set N
- msr cpsr, %0
- movmi r0, %2
- movpl r0, #0
- blmi " SYMBOL_NAME_STR(__down_interruptible_failed) "
- mov %1, r0"
- : "=&r" (cpsr), "=&r" (temp)
- : "r" (sem)
- : "r0", "lr", "cc");
-
- return temp;
-}
-
-extern inline int down_trylock(struct semaphore *sem)
-{
- unsigned int cpsr, temp;
-
- __asm__ __volatile__ ("
- @ atomic down try lock operation
- mrs %0, cpsr
- orr %1, %0, #128 @ disable IRQs
- msr cpsr, %1
- ldr %1, [%2]
- bic %0, %0, #0x80000000 @ clear N
- subs %1, %1, #1
- str %1, [%2]
- orrmi %0, %0, #0x80000000 @ set N
- msr cpsr, %0
- movmi r0, %2
- movpl r0, #0
- blmi " SYMBOL_NAME_STR(__down_trylock_failed) "
- mov %1, r0"
- : "=&r" (cpsr), "=&r" (temp)
- : "r" (sem)
- : "r0", "lr", "cc");
-
- return temp;
-}
-
-/*
- * Note! This is subtle. We jump to wake people up only if
- * the semaphore was negative (== somebody was waiting on it).
- * The default case (no contention) will result in NO
- * jumps for both down() and up().
- */
-extern inline void up(struct semaphore * sem)
-{
- unsigned int cpsr, temp;
-
- __asm__ __volatile__ ("
- @ atomic up operation
- mrs %0, cpsr
- orr %1, %0, #128 @ disable IRQs
- msr cpsr, %1
- ldr %1, [%2]
- bic %0, %0, #0x80000000 @ clear N
- adds %1, %1, #1
- str %1, [%2]
- orrle %0, %0, #0x80000000 @ set N
- msr cpsr, %0
- movmi r0, %2
- blmi " SYMBOL_NAME_STR(__up_wakeup)
- : "=&r" (cpsr), "=&r" (temp)
- : "r" (sem)
- : "r0", "lr", "cc");
-}
-
-#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)