1 #ifndef _ASM_MICROBLAZE_FUTEX_H
2 #define _ASM_MICROBLAZE_FUTEX_H
6 #include <linux/futex.h>
7 #include <linux/uaccess.h>
10 #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
12 __asm__ __volatile__ ( \
13 "1: lwx %0, %2, r0; " \
19 .section .fixup,\"ax\"; \
23 .section __ex_table,\"a\"; \
26 : "=&r" (oldval), "=&r" (ret) \
27 : "r" (uaddr), "i" (-EFAULT), "r" (oparg) \
32 arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr)
40 __futex_atomic_op("or %1,%4,%4;", ret, oldval, uaddr, oparg);
43 __futex_atomic_op("add %1,%0,%4;", ret, oldval, uaddr, oparg);
46 __futex_atomic_op("or %1,%0,%4;", ret, oldval, uaddr, oparg);
49 __futex_atomic_op("andn %1,%0,%4;", ret, oldval, uaddr, oparg);
52 __futex_atomic_op("xor %1,%0,%4;", ret, oldval, uaddr, oparg);
67 futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
68 u32 oldval, u32 newval)
73 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
76 __asm__ __volatile__ ("1: lwx %1, %3, r0; \
83 .section .fixup,\"ax\"; \
87 .section __ex_table,\"a\"; \
90 : "+r" (ret), "=&r" (prev), "=&r"(cmp) \
91 : "r" (uaddr), "r" (oldval), "r" (newval), "i" (-EFAULT));
97 #endif /* __KERNEL__ */