Go to the documentation of this file. 1 #ifndef _ASM_X86_LOCAL_H
2 #define _ASM_X86_LOCAL_H
13 #define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }
15 #define local_read(l) atomic_long_read(&(l)->a)
16 #define local_set(l, i) atomic_long_set(&(l)->a, (i))
57 asm volatile(
_ASM_SUB "%2,%0; sete %1"
59 :
"ir" (
i) :
"memory");
112 asm volatile(
_ASM_ADD "%2,%0; sets %1"
114 :
"ir" (
i) :
"memory");
155 #define local_inc_return(l) (local_add_return(1, l))
156 #define local_dec_return(l) (local_sub_return(1, l))
158 #define local_cmpxchg(l, o, n) \
159 (cmpxchg_local(&((l)->a.counter), (o), (n)))
161 #define local_xchg(l, n) (xchg(&((l)->a.counter), (n)))
172 #define local_add_unless(l, a, u) \
175 c = local_read((l)); \
177 if (unlikely(c == (u))) \
179 old = local_cmpxchg((l), c, c + (a)); \
180 if (likely(old == c)) \
186 #define local_inc_not_zero(l) local_add_unless((l), 1, 0)
192 #define __local_inc(l) local_inc(l)
193 #define __local_dec(l) local_dec(l)
194 #define __local_add(i, l) local_add((i), (l))
195 #define __local_sub(i, l) local_sub((i), (l))