patch-2.4.2 linux/include/asm-s390/spinlock.h
Next file: linux/include/asm-s390/stat.h
Previous file: linux/include/asm-s390/socket.h
Back to the patch index
Back to the overall index
- Lines: 113
- Date:
Tue Feb 13 14:13:44 2001
- Orig file:
v2.4.1/linux/include/asm-s390/spinlock.h
- Orig date:
Fri May 12 11:41:44 2000
diff -u --recursive --new-file v2.4.1/linux/include/asm-s390/spinlock.h linux/include/asm-s390/spinlock.h
@@ -24,37 +24,36 @@
#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
#define spin_lock_init(lp) do { (lp)->lock = 0; } while(0)
-#define spin_unlock_wait(lp) do { barrier(); } while((volatile spinlock_t *)(lp)->lock)
+#define spin_unlock_wait(lp) do { barrier(); } while(((volatile spinlock_t *)(lp))->lock)
#define spin_is_locked(x) ((x)->lock != 0)
extern inline void spin_lock(spinlock_t *lp)
{
- __asm__ __volatile(" lhi 1,-1\n"
- "0: slr 0,0\n"
- " cs 0,1,%1\n"
- " jl 0b"
- : "=m" (lp->lock)
- : "0" (lp->lock) : "0", "1");
+ __asm__ __volatile(" bras 1,1f\n"
+ "0: diag 0,0,68\n"
+ "1: slr 0,0\n"
+ " cs 0,1,%1\n"
+ " jl 0b\n"
+ : "=m" (lp->lock)
+ : "0" (lp->lock) : "0", "1", "cc" );
}
extern inline int spin_trylock(spinlock_t *lp)
{
unsigned long result;
__asm__ __volatile(" slr %1,%1\n"
- " lhi 0,-1\n"
- "0: cs %1,0,%0"
+ " basr 1,0\n"
+ "0: cs %1,1,%0"
: "=m" (lp->lock), "=&d" (result)
- : "0" (lp->lock) : "0");
+ : "0" (lp->lock) : "1", "cc" );
return !result;
}
-
-
extern inline void spin_unlock(spinlock_t *lp)
{
__asm__ __volatile(" xc 0(4,%0),0(%0)\n"
" bcr 15,0"
- : /* no output */ : "a" (lp) );
+ : /* no output */ : "a" (lp) : "memory", "cc" );
}
/*
@@ -76,45 +75,42 @@
#define read_lock(rw) \
asm volatile(" l 2,%0\n" \
- "0: sll 2,1\n" \
- " srl 2,1\n" /* clear high (=write) bit */ \
- " lr 3,2\n" \
- " ahi 3,1\n" /* one more reader */ \
+ " j 1f\n" \
+ "0: diag 0,0,68\n" \
+ "1: la 2,0(2)\n" /* clear high (=write) bit */ \
+ " la 3,1(2)\n" /* one more reader */ \
" cs 2,3,%0\n" /* try to write new value */ \
" jl 0b" \
- : "+m" ((rw)->lock) : : "2", "3" );
+ : "+m" ((rw)->lock) : : "2", "3", "cc" );
#define read_unlock(rw) \
asm volatile(" l 2,%0\n" \
- "0: lr 3,2\n" \
+ " j 1f\n" \
+ "0: diag 0,0,68\n" \
+ "1: lr 3,2\n" \
" ahi 3,-1\n" /* one less reader */ \
" cs 2,3,%0\n" \
" jl 0b" \
- : "+m" ((rw)->lock) : : "2", "3" );
+ : "+m" ((rw)->lock) : : "2", "3", "cc" );
#define write_lock(rw) \
asm volatile(" lhi 3,1\n" \
" sll 3,31\n" /* new lock value = 0x80000000 */ \
- "0: slr 2,2\n" /* old lock value must be 0 */ \
+ " j 1f\n" \
+ "0: diag 0,0,68\n" \
+ "1: slr 2,2\n" /* old lock value must be 0 */ \
" cs 2,3,%0\n" \
" jl 0b" \
- : "+m" ((rw)->lock) : : "2", "3" );
+ : "+m" ((rw)->lock) : : "2", "3", "cc" );
#define write_unlock(rw) \
asm volatile(" slr 3,3\n" /* new lock value = 0 */ \
- "0: lhi 2,1\n" \
+ " j 1f\n" \
+ "0: diag 0,0,68\n" \
+ "1: lhi 2,1\n" \
" sll 2,31\n" /* old lock value must be 0x80000000 */ \
" cs 2,3,%0\n" \
" jl 0b" \
- : "+m" ((rw)->lock) : : "2", "3" );
+ : "+m" ((rw)->lock) : : "2", "3", "cc" );
#endif /* __ASM_SPINLOCK_H */
-
-
-
-
-
-
-
-
-
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)