Go to the documentation of this file.
11 #ifndef __ASM_SH_SPINLOCK_H
12 #define __ASM_SH_SPINLOCK_H
18 #ifndef CONFIG_CPU_SH4A
19 #error "Need movli.l/movco.l for spinlocks"
26 #define arch_spin_is_locked(x) ((x)->lock <= 0)
27 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
28 #define arch_spin_unlock_wait(x) \
29 do { while (arch_spin_is_locked(x)) cpu_relax(); } while (0)
44 "movli.l @%2, %0 ! arch_spin_lock \n\t"
47 "movco.l %0, @%2 \n\t"
51 :
"=&z" (tmp),
"=&r" (oldval)
62 "mov #1, %0 ! arch_spin_unlock \n\t"
72 unsigned long tmp, oldval;
76 "movli.l @%2, %0 ! arch_spin_trylock \n\t"
79 "movco.l %0, @%2 \n\t"
82 :
"=&z" (tmp),
"=&r" (oldval)
103 #define arch_read_can_lock(x) ((x)->lock > 0)
109 #define arch_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS)
117 "movli.l @%1, %0 ! arch_read_lock \n\t"
121 "movco.l %0, @%1 \n\t"
135 "movli.l @%1, %0 ! arch_read_unlock \n\t"
137 "movco.l %0, @%1 \n\t"
151 "movli.l @%1, %0 ! arch_write_lock \n\t"
155 "movco.l %0, @%1 \n\t"
166 "mov.l %1, @%0 ! arch_write_unlock \n\t"
175 unsigned long tmp, oldval;
179 "movli.l @%2, %0 ! arch_read_trylock \n\t"
184 "movco.l %0, @%2 \n\t"
188 :
"=&z" (tmp),
"=&r" (oldval)
198 unsigned long tmp, oldval;
202 "movli.l @%2, %0 ! arch_write_trylock \n\t"
208 "movco.l %0, @%2 \n\t"
211 :
"=&z" (tmp),
"=&r" (oldval)
219 #define arch_read_lock_flags(lock, flags) arch_read_lock(lock)
220 #define arch_write_lock_flags(lock, flags) arch_write_lock(lock)
222 #define arch_spin_relax(lock) cpu_relax()
223 #define arch_read_relax(lock) cpu_relax()
224 #define arch_write_relax(lock) cpu_relax()