Lines Matching +full:n +full:- +full:1
1 /* SPDX-License-Identifier: GPL-2.0
3 * include/asm-sh/spinlock-llsc.h
18 #define arch_spin_is_locked(x) ((x)->lock <= 0)
32 "1: \n\t" in arch_spin_lock()
33 "movli.l @%2, %0 ! arch_spin_lock \n\t" in arch_spin_lock()
34 "mov %0, %1 \n\t" in arch_spin_lock()
35 "mov #0, %0 \n\t" in arch_spin_lock()
36 "movco.l %0, @%2 \n\t" in arch_spin_lock()
37 "bf 1b \n\t" in arch_spin_lock()
38 "cmp/pl %1 \n\t" in arch_spin_lock()
39 "bf 1b \n\t" in arch_spin_lock()
41 : "r" (&lock->lock) in arch_spin_lock()
53 "mov #1, %0 ! arch_spin_unlock \n\t" in arch_spin_unlock()
54 "mov.l %0, @%1 \n\t" in arch_spin_unlock()
56 : "r" (&lock->lock) in arch_spin_unlock()
66 "1: \n\t" in arch_spin_trylock()
67 "movli.l @%2, %0 ! arch_spin_trylock \n\t" in arch_spin_trylock()
68 "mov %0, %1 \n\t" in arch_spin_trylock()
69 "mov #0, %0 \n\t" in arch_spin_trylock()
70 "movco.l %0, @%2 \n\t" in arch_spin_trylock()
71 "bf 1b \n\t" in arch_spin_trylock()
72 "synco \n\t" in arch_spin_trylock()
74 : "r" (&lock->lock) in arch_spin_trylock()
82 * Read-write spinlocks, allowing multiple readers but only one writer.
85 * writers. For those circumstances we can "mix" irq-safe locks - any writer
86 * needs to get a irq-safe write-lock, but readers can get non-irqsafe
87 * read-locks.
95 "1: \n\t" in arch_read_lock()
96 "movli.l @%1, %0 ! arch_read_lock \n\t" in arch_read_lock()
97 "cmp/pl %0 \n\t" in arch_read_lock()
98 "bf 1b \n\t" in arch_read_lock()
99 "add #-1, %0 \n\t" in arch_read_lock()
100 "movco.l %0, @%1 \n\t" in arch_read_lock()
101 "bf 1b \n\t" in arch_read_lock()
103 : "r" (&rw->lock) in arch_read_lock()
113 "1: \n\t" in arch_read_unlock()
114 "movli.l @%1, %0 ! arch_read_unlock \n\t" in arch_read_unlock()
115 "add #1, %0 \n\t" in arch_read_unlock()
116 "movco.l %0, @%1 \n\t" in arch_read_unlock()
117 "bf 1b \n\t" in arch_read_unlock()
119 : "r" (&rw->lock) in arch_read_unlock()
129 "1: \n\t" in arch_write_lock()
130 "movli.l @%1, %0 ! arch_write_lock \n\t" in arch_write_lock()
131 "cmp/hs %2, %0 \n\t" in arch_write_lock()
132 "bf 1b \n\t" in arch_write_lock()
133 "sub %2, %0 \n\t" in arch_write_lock()
134 "movco.l %0, @%1 \n\t" in arch_write_lock()
135 "bf 1b \n\t" in arch_write_lock()
137 : "r" (&rw->lock), "r" (RW_LOCK_BIAS) in arch_write_lock()
145 "mov.l %1, @%0 ! arch_write_unlock \n\t" in arch_write_unlock()
147 : "r" (&rw->lock), "r" (RW_LOCK_BIAS) in arch_write_unlock()
157 "1: \n\t" in arch_read_trylock()
158 "movli.l @%2, %0 ! arch_read_trylock \n\t" in arch_read_trylock()
159 "mov %0, %1 \n\t" in arch_read_trylock()
160 "cmp/pl %0 \n\t" in arch_read_trylock()
161 "bf 2f \n\t" in arch_read_trylock()
162 "add #-1, %0 \n\t" in arch_read_trylock()
163 "movco.l %0, @%2 \n\t" in arch_read_trylock()
164 "bf 1b \n\t" in arch_read_trylock()
165 "2: \n\t" in arch_read_trylock()
166 "synco \n\t" in arch_read_trylock()
168 : "r" (&rw->lock) in arch_read_trylock()
180 "1: \n\t" in arch_write_trylock()
181 "movli.l @%2, %0 ! arch_write_trylock \n\t" in arch_write_trylock()
182 "mov %0, %1 \n\t" in arch_write_trylock()
183 "cmp/hs %3, %0 \n\t" in arch_write_trylock()
184 "bf 2f \n\t" in arch_write_trylock()
185 "sub %3, %0 \n\t" in arch_write_trylock()
186 "2: \n\t" in arch_write_trylock()
187 "movco.l %0, @%2 \n\t" in arch_write_trylock()
188 "bf 1b \n\t" in arch_write_trylock()
189 "synco \n\t" in arch_write_trylock()
191 : "r" (&rw->lock), "r" (RW_LOCK_BIAS) in arch_write_trylock()
195 return (oldval > (RW_LOCK_BIAS - 1)); in arch_write_trylock()