Go to the documentation of this file. 1 #ifndef _ARCH_POWERPC_LOCAL_H
2 #define _ARCH_POWERPC_LOCAL_H
12 #define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }
14 #define local_read(l) atomic_long_read(&(l)->a)
15 #define local_set(l,i) atomic_long_set(&(l)->a, (i))
17 #define local_add(i,l) atomic_long_add((i),(&(l)->a))
18 #define local_sub(i,l) atomic_long_sub((i),(&(l)->a))
19 #define local_inc(l) atomic_long_inc(&(l)->a)
20 #define local_dec(l) atomic_long_dec(&(l)->a)
27 "1:" PPC_LLARX(%0,0,%2,0)
" # local_add_return\n\
39 #define local_add_negative(a, l) (local_add_return((a), (l)) < 0)
46 "1:" PPC_LLARX(%0,0,%2,0)
" # local_sub_return\n\
63 "1:" PPC_LLARX(%0,0,%1,0)
" # local_inc_return\n\
70 :
"cc",
"xer",
"memory");
83 #define local_inc_and_test(l) (local_inc_return(l) == 0)
90 "1:" PPC_LLARX(%0,0,%1,0)
" # local_dec_return\n\
97 :
"cc",
"xer",
"memory");
102 #define local_cmpxchg(l, o, n) \
103 (cmpxchg_local(&((l)->a.counter), (o), (n)))
104 #define local_xchg(l, n) (xchg_local(&((l)->a.counter), (n)))
120 "1:" PPC_LLARX(%0,0,%1,0)
" # local_add_unless\n\
130 :
"r" (&(l->
a.
counter)),
"r" (a),
"r" (u)
136 #define local_inc_not_zero(l) local_add_unless((l), 1, 0)
138 #define local_sub_and_test(a, l) (local_sub_return((a), (l)) == 0)
139 #define local_dec_and_test(l) (local_dec_return((l)) == 0)
150 "1:" PPC_LLARX(%0,0,%1,0)
" # local_dec_if_positive\n\
170 #define __local_inc(l) ((l)->a.counter++)
171 #define __local_dec(l) ((l)->a.counter++)
172 #define __local_add(i,l) ((l)->a.counter+=(i))
173 #define __local_sub(i,l) ((l)->a.counter-=(i))