1 #ifndef __ARCH_H8300_CMPXCHG__
2 #define __ARCH_H8300_CMPXCHG__
4 #include <linux/irqflags.h>
7 ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), \
10 struct __xchg_dummy
{ unsigned long a
[100]; };
11 #define __xg(x) ((volatile struct __xchg_dummy *)(x))
13 static inline unsigned long __xchg(unsigned long x
,
14 volatile void *ptr
, int size
)
16 unsigned long tmp
, flags
;
18 local_irq_save(flags
);
25 : "=&r" (tmp
) : "r" (x
), "m" (*__xg(ptr
)));
31 : "=&r" (tmp
) : "r" (x
), "m" (*__xg(ptr
)));
37 : "=&r" (tmp
) : "r" (x
), "m" (*__xg(ptr
)));
42 local_irq_restore(flags
);
46 #include <asm-generic/cmpxchg-local.h>
49 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
52 #define cmpxchg_local(ptr, o, n) \
53 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), \
57 #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
60 #include <asm-generic/cmpxchg.h>
63 #define atomic_xchg(v, new) (xchg(&((v)->counter), new))
65 #endif /* __ARCH_H8300_CMPXCHG__ */