Go to the documentation of this file.
11 #ifndef __ARCH_SPARC_CMPXCHG__
12 #define __ARCH_SPARC_CMPXCHG__
14 static inline unsigned long xchg_u32(__volatile__
unsigned long *
m,
unsigned long val)
16 __asm__ __volatile__(
"swap [%2], %0"
25 static inline unsigned long __xchg(
unsigned long x, __volatile__
void *
ptr,
int size)
29 return xchg_u32(ptr, x);
35 #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
45 #define __HAVE_ARCH_CMPXCHG 1
53 static inline unsigned long
54 __cmpxchg(
volatile void *ptr,
unsigned long old,
unsigned long new_,
int size)
66 #define cmpxchg(ptr, o, n) \
68 __typeof__(*(ptr)) _o_ = (o); \
69 __typeof__(*(ptr)) _n_ = (n); \
70 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
71 (unsigned long)_n_, sizeof(*(ptr))); \
80 #define cmpxchg_local(ptr, o, n) \
81 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
82 (unsigned long)(n), sizeof(*(ptr))))
83 #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))