1 #ifndef _ASM_MICROBLAZE_CMPXCHG_H
2 #define _ASM_MICROBLAZE_CMPXCHG_H
4 void __bad_xchg(volatile void *ptr, int size);
6 static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
14 local_irq_save(flags);
15 ret = *(volatile unsigned char *)ptr;
16 *(volatile unsigned char *)ptr = x;
17 local_irq_restore(flags);
21 local_irq_save(flags);
22 ret = *(volatile unsigned long *)ptr;
23 *(volatile unsigned long *)ptr = x;
24 local_irq_restore(flags);
27 __bad_xchg(ptr, size), ret = 0;
34 #define xchg(ptr, x) \
35 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
37 #include <asm-generic/cmpxchg.h>
38 #include <asm-generic/cmpxchg-local.h>
40 #endif /* _ASM_MICROBLAZE_CMPXCHG_H */