1 #ifndef __ARCH_RX_CMPXCHG__
2 #define __ARCH_RX_CMPXCHG__
5 ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), \
8 struct __xchg_dummy { unsigned long a[100]; };
9 #define __xg(x) ((volatile struct __xchg_dummy *)(x))
11 extern void __bad_xchg_size(void);
13 static inline unsigned long __xchg(unsigned long x,
14 volatile void *ptr, int size)
20 : "+r" (x), "+Q" (*__xg(ptr)));
25 : "+r" (x), "+Q" (*__xg(ptr)));
30 : "+r" (x), "+Q" (*__xg(ptr)));
38 #include <asm-generic/cmpxchg-local.h>
41 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
44 #define cmpxchg_local(ptr, o, n) \
45 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), \
49 #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
52 #include <asm-generic/cmpxchg.h>
55 #define atomic_xchg(v, new) (xchg(&((v)->counter), new))
57 #endif /* __ARCH_RX_CMPXCHG__ */