Go to the documentation of this file. 1 #ifndef __ARCH_M68K_CMPXCHG__
2 #define __ARCH_M68K_CMPXCHG__
7 #define __xg(x) ((volatile struct __xchg_dummy *)(x))
11 #ifndef CONFIG_RMW_INSNS
12 static inline unsigned long __xchg(
unsigned long x,
volatile void *
ptr,
int size)
43 static inline unsigned long __xchg(
unsigned long x,
volatile void * ptr,
int size)
52 :
"=&d" (x) :
"d" (x),
"m" (*
__xg(ptr)) :
"memory");
60 :
"=&d" (x) :
"d" (x),
"m" (*
__xg(ptr)) :
"memory");
68 :
"=&d" (x) :
"d" (x),
"m" (*
__xg(ptr)) :
"memory");
78 #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
82 #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
85 unsigned long,
unsigned long,
int);
92 #ifdef CONFIG_RMW_INSNS
93 #define __HAVE_ARCH_CMPXCHG 1
95 static inline unsigned long __cmpxchg(
volatile void *
p,
unsigned long old,
96 unsigned long new,
int size)
100 __asm__ __volatile__ (
"casb %0,%2,%1"
101 :
"=d" (old),
"=m" (*(
char *)p)
102 :
"d" (
new),
"0" (old),
"m" (*(
char *)p));
105 __asm__ __volatile__ (
"casw %0,%2,%1"
106 :
"=d" (old),
"=m" (*(
short *)p)
107 :
"d" (
new),
"0" (old),
"m" (*(
short *)p));
110 __asm__ __volatile__ (
"casl %0,%2,%1"
111 :
"=d" (old),
"=m" (*(
int *)p)
112 :
"d" (
new),
"0" (old),
"m" (*(
int *)p));
121 #define cmpxchg(ptr, o, n) \
122 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
123 (unsigned long)(n), sizeof(*(ptr))))
124 #define cmpxchg_local(ptr, o, n) \
125 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
126 (unsigned long)(n), sizeof(*(ptr))))
133 #define cmpxchg_local(ptr, o, n) \
134 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
135 (unsigned long)(n), sizeof(*(ptr))))