Go to the documentation of this file. 1 #ifndef __ARCH_H8300_CMPXCHG__
2 #define __ARCH_H8300_CMPXCHG__
6 #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
9 #define __xg(x) ((volatile struct __xchg_dummy *)(x))
11 static inline unsigned long __xchg(
unsigned long x,
volatile void *
ptr,
int size)
22 :
"=&r" (tmp) :
"r" (x),
"m" (*
__xg(ptr)) :
"memory");
28 :
"=&r" (tmp) :
"r" (x),
"m" (*
__xg(ptr)) :
"memory");
34 :
"=&r" (tmp) :
"r" (x),
"m" (*
__xg(ptr)) :
"memory");
49 #define cmpxchg_local(ptr, o, n) \
50 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
51 (unsigned long)(n), sizeof(*(ptr))))
52 #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
58 #define atomic_xchg(v, new) (xchg(&((v)->counter), new))