1 #ifndef _ASM_MICROBLAZE_CMPXCHG_H
2 #define _ASM_MICROBLAZE_CMPXCHG_H
4 #include <linux/irqflags.h>
6 void __bad_xchg(volatile void *ptr
, int size
);
8 static inline unsigned long __xchg(unsigned long x
, volatile void *ptr
,
16 local_irq_save(flags
);
17 ret
= *(volatile unsigned char *)ptr
;
18 *(volatile unsigned char *)ptr
= x
;
19 local_irq_restore(flags
);
23 local_irq_save(flags
);
24 ret
= *(volatile unsigned long *)ptr
;
25 *(volatile unsigned long *)ptr
= x
;
26 local_irq_restore(flags
);
29 __bad_xchg(ptr
, size
), ret
= 0;
36 #define xchg(ptr, x) \
37 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
39 #include <asm-generic/cmpxchg.h>
40 #include <asm-generic/cmpxchg-local.h>
42 #endif /* _ASM_MICROBLAZE_CMPXCHG_H */