Go to the documentation of this file. 1 #ifndef __ARCH_M68K_ATOMIC__
2 #define __ARCH_M68K_ATOMIC__
4 #include <linux/types.h>
6 #include <asm/cmpxchg.h>
17 #define ATOMIC_INIT(i) { (i) }
19 #define atomic_read(v) (*(volatile int *)&(v)->counter)
20 #define atomic_set(v, i) (((v)->counter) = i)
26 #ifdef CONFIG_COLDFIRE
44 __asm__ __volatile__(
"addql #1,%0" :
"+m" (*v));
49 __asm__ __volatile__(
"subql #1,%0" :
"+m" (*v));
55 __asm__ __volatile__(
"subql #1,%1; seq %0" :
"=d" (c),
"+m" (*v));
59 static inline int atomic_dec_and_test_lt(
atomic_t *v)
72 __asm__ __volatile__(
"addql #1,%1; seq %0" :
"=d" (c),
"+m" (*v));
76 #ifdef CONFIG_RMW_INSNS
87 :
"+m" (*v),
"=&d" (t),
"=&d" (tmp)
101 :
"+m" (*v),
"=&d" (t),
"=&d" (tmp)
106 #define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
107 #define atomic_xchg(v, new) (xchg(&((v)->counter), new))
166 #define atomic_dec_return(v) atomic_sub_return(1, (v))
167 #define atomic_inc_return(v) atomic_add_return(1, (v))
172 __asm__ __volatile__(
"subl %2,%1; seq %0"
173 :
"=d" (c),
"+m" (*v)
181 __asm__ __volatile__(
"addl %2,%1; smi %0"
182 :
"=d" (c),
"+m" (*v)
189 __asm__ __volatile__(
"andl %1,%0" :
"+m" (*v) :
ASM_DI (~(mask)));
192 static inline void atomic_set_mask(
unsigned long mask,
unsigned long *v)
194 __asm__ __volatile__(
"orl %1,%0" :
"+m" (*v) :
ASM_DI (mask));
214 #define smp_mb__before_atomic_dec() barrier()
215 #define smp_mb__after_atomic_dec() barrier()
216 #define smp_mb__before_atomic_inc() barrier()
217 #define smp_mb__after_atomic_inc() barrier()