Go to the documentation of this file. 1 #ifndef _ASM_IA64_CMPXCHG_H
2 #define _ASM_IA64_CMPXCHG_H
14 #include <linux/types.h>
17 #ifdef __INTEL_COMPILER
20 # include <asm/gcc_intrin.h>
29 #define __xchg(x, ptr, size) \
31 unsigned long __xchg_result; \
35 __xchg_result = ia64_xchg1((__u8 *)ptr, x); \
39 __xchg_result = ia64_xchg2((__u16 *)ptr, x); \
43 __xchg_result = ia64_xchg4((__u32 *)ptr, x); \
47 __xchg_result = ia64_xchg8((__u64 *)ptr, x); \
50 ia64_xchg_called_with_bad_pointer(); \
55 #define xchg(ptr, x) \
56 ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
64 #define __HAVE_ARCH_CMPXCHG 1
72 #define ia64_cmpxchg(sem, ptr, old, new, size) \
78 _o_ = (__u8) (long) (old); \
81 _o_ = (__u16) (long) (old); \
84 _o_ = (__u32) (long) (old); \
87 _o_ = (__u64) (long) (old); \
94 _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \
98 _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \
102 _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \
106 _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \
110 _r_ = ia64_cmpxchg_called_with_bad_pointer(); \
113 (__typeof__(old)) _r_; \
116 #define cmpxchg_acq(ptr, o, n) \
117 ia64_cmpxchg(acq, (ptr), (o), (n), sizeof(*(ptr)))
118 #define cmpxchg_rel(ptr, o, n) \
119 ia64_cmpxchg(rel, (ptr), (o), (n), sizeof(*(ptr)))
122 #define cmpxchg(ptr, o, n) cmpxchg_acq((ptr), (o), (n))
123 #define cmpxchg64(ptr, o, n) cmpxchg_acq((ptr), (o), (n))
125 #define cmpxchg_local cmpxchg
126 #define cmpxchg64_local cmpxchg64
128 #ifdef CONFIG_IA64_DEBUG_CMPXCHG
129 # define CMPXCHG_BUGCHECK_DECL int _cmpxchg_bugcheck_count = 128;
130 # define CMPXCHG_BUGCHECK(v) \
132 if (_cmpxchg_bugcheck_count-- <= 0) { \
134 extern int printk(const char *fmt, ...); \
135 ip = (void *) ia64_getreg(_IA64_REG_IP); \
136 printk("CMPXCHG_BUGCHECK: stuck at %p on word %p\n", ip, (v));\
141 # define CMPXCHG_BUGCHECK_DECL
142 # define CMPXCHG_BUGCHECK(v)