Go to the documentation of this file.
6 #ifndef __SPARC_SPINLOCK_H
7 #define __SPARC_SPINLOCK_H
12 #include <asm/processor.h>
14 #define arch_spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0)
16 #define arch_spin_unlock_wait(lock) \
17 do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0)
23 "ldstub [%0], %%g2\n\t"
24 "orcc %%g2, 0x0, %%g0\n\t"
26 " ldub [%0], %%g2\n\t"
29 "orcc %%g2, 0x0, %%g0\n\t"
31 " ldub [%0], %%g2\n\t"
36 :
"g2",
"memory",
"cc");
42 __asm__ __volatile__(
"ldstub [%1], %0"
51 __asm__ __volatile__(
"stb %%g0, [%0]" : :
"r" (lock) :
"memory");
86 "call ___rw_read_enter\n\t"
87 " ldstub [%%g1 + 3], %%g2\n"
90 :
"g2",
"g4",
"memory",
"cc");
93 #define arch_read_lock(lock) \
94 do { unsigned long flags; \
95 local_irq_save(flags); \
96 __arch_read_lock(lock); \
97 local_irq_restore(flags); \
106 "call ___rw_read_exit\n\t"
107 " ldstub [%%g1 + 3], %%g2\n"
110 :
"g2",
"g4",
"memory",
"cc");
113 #define arch_read_unlock(lock) \
114 do { unsigned long flags; \
115 local_irq_save(flags); \
116 __arch_read_unlock(lock); \
117 local_irq_restore(flags); \
126 "call ___rw_write_enter\n\t"
127 " ldstub [%%g1 + 3], %%g2\n"
130 :
"g2",
"g4",
"memory",
"cc");
131 *(
volatile __u32 *)&lp->lock = ~0
U;
147 __asm__ __volatile__(
"ldstub [%1 + 3], %0"
153 val = rw->
lock & ~0xff;
155 ((
volatile u8*)&rw->
lock)[3] = 0;
166 register int res asm(
"o0");
170 "call ___rw_read_try\n\t"
171 " ldstub [%%g1 + 3], %%g2\n"
174 :
"g2",
"g4",
"memory",
"cc");
178 #define arch_read_trylock(lock) \
179 ({ unsigned long flags; \
181 local_irq_save(flags); \
182 res = __arch_read_trylock(lock); \
183 local_irq_restore(flags); \
187 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
188 #define arch_read_lock_flags(rw, flags) arch_read_lock(rw)
189 #define arch_write_lock_flags(rw, flags) arch_write_lock(rw)
191 #define arch_spin_relax(lock) cpu_relax()
192 #define arch_read_relax(lock) cpu_relax()
193 #define arch_write_relax(lock) cpu_relax()
195 #define arch_read_can_lock(rw) (!((rw)->lock & 0xff))
196 #define arch_write_can_lock(rw) (!(rw)->lock)