Go to the documentation of this file.
17 #include <linux/types.h>
19 #include <asm/cmpxchg.h>
33 #define smp_mb__before_atomic_dec() barrier()
34 #define smp_mb__after_atomic_dec() barrier()
35 #define smp_mb__before_atomic_inc() barrier()
36 #define smp_mb__after_atomic_inc() barrier()
38 #define ATOMIC_INIT(i) { (i) }
39 #define atomic_read(v) (*(volatile int *)&(v)->counter)
40 #define atomic_set(v, i) (((v)->counter) = (i))
42 #ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS
48 " orcc gr0,gr0,gr0,icc3 \n"
51 " orcr cc7,cc7,cc3 \n"
53 " cst.p %1,%M0 ,cc3,#1 \n"
54 " corcc gr29,gr29,gr0 ,cc3,#1 \n"
58 :
"memory",
"cc7",
"cc3",
"icc3"
69 " orcc gr0,gr0,gr0,icc3 \n"
72 " orcr cc7,cc7,cc3 \n"
74 " cst.p %1,%M0 ,cc3,#1 \n"
75 " corcc gr29,gr29,gr0 ,cc3,#1 \n"
79 :
"memory",
"cc7",
"cc3",
"icc3"
117 #define atomic_dec_return(v) atomic_sub_return(1, (v))
118 #define atomic_inc_return(v) atomic_add_return(1, (v))
120 #define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
121 #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
122 #define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
131 #define ATOMIC64_INIT(i) { (i) }
145 asm volatile(
"std%I0 %1,%M0"
180 #define atomic64_sub_and_test(i,v) (atomic64_sub_return((i), (v)) == 0)
181 #define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0)
182 #define atomic64_inc_and_test(v) (atomic64_inc_return((v)) == 0)
184 #define atomic_cmpxchg(v, old, new) (cmpxchg(&(v)->counter, old, new))
185 #define atomic_xchg(v, new) (xchg(&(v)->counter, new))
186 #define atomic64_cmpxchg(v, old, new) (__cmpxchg_64(old, new, &(v)->counter))
187 #define atomic64_xchg(v, new) (__xchg_64(new, &(v)->counter))