Go to the documentation of this file.
16 #ifndef __ASM_SPINLOCK_H
17 #define __ASM_SPINLOCK_H
19 #include <asm/spinlock_types.h>
20 #include <asm/processor.h>
35 #define arch_spin_is_locked(x) ((x)->lock != 0)
36 #define arch_spin_unlock_wait(lock) \
37 do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0)
39 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
48 "2: ldaxr %w0, [%1]\n"
50 " stxr %w0, %w2, [%1]\n"
53 :
"r" (&lock->
lock),
"r" (1)
64 " stxr %w0, %w2, [%1]\n"
67 :
"r" (&lock->
lock),
"r" (1)
77 : :
"r" (&lock->
lock),
"r" (0) :
"memory");
97 "2: ldaxr %w0, [%1]\n"
99 " stxr %w0, %w2, [%1]\n"
102 :
"r" (&rw->
lock),
"r" (0x80000000)
113 " stxr %w0, %w2, [%1]\n"
116 :
"r" (&rw->
lock),
"r" (0x80000000)
126 : :
"r" (&rw->
lock),
"r" (0) :
"memory");
130 #define arch_write_can_lock(x) ((x)->lock == 0)
146 unsigned int tmp, tmp2;
151 "2: ldaxr %w0, [%2]\n"
152 " add %w0, %w0, #1\n"
153 " tbnz %w0, #31, 1b\n"
154 " stxr %w1, %w0, [%2]\n"
156 :
"=&r" (
tmp),
"=&r" (tmp2)
163 unsigned int tmp, tmp2;
166 "1: ldxr %w0, [%2]\n"
167 " sub %w0, %w0, #1\n"
168 " stlxr %w1, %w0, [%2]\n"
170 :
"=&r" (
tmp),
"=&r" (tmp2)
177 unsigned int tmp, tmp2 = 1;
181 " add %w0, %w0, #1\n"
182 " tbnz %w0, #31, 1f\n"
183 " stxr %w1, %w0, [%2]\n"
185 :
"=&r" (
tmp),
"+r" (tmp2)
193 #define arch_read_can_lock(x) ((x)->lock < 0x80000000)
195 #define arch_read_lock_flags(lock, flags) arch_read_lock(lock)
196 #define arch_write_lock_flags(lock, flags) arch_write_lock(lock)
198 #define arch_spin_relax(lock) cpu_relax()
199 #define arch_read_relax(lock) cpu_relax()
200 #define arch_write_relax(lock) cpu_relax()