1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_ALPHA_FUTEX_H
3 #define _ASM_ALPHA_FUTEX_H
7 #include <linux/futex.h>
8 #include <linux/uaccess.h>
10 #include <asm/barrier.h>
12 #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
13 __asm__ __volatile__( \
15 "1: ldl_l %0,0(%2)\n" \
17 "2: stl_c %1,0(%2)\n" \
20 "3: .subsection 2\n" \
25 : "=&r" (oldval), "=&r"(ret) \
26 : "r" (uaddr), "r"(oparg) \
29 static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval,
34 if (!access_ok(uaddr, sizeof(u32)))
39 __futex_atomic_op("mov %3,%1\n", ret, oldval, uaddr, oparg);
42 __futex_atomic_op("addl %0,%3,%1\n", ret, oldval, uaddr, oparg);
45 __futex_atomic_op("or %0,%3,%1\n", ret, oldval, uaddr, oparg);
48 __futex_atomic_op("andnot %0,%3,%1\n", ret, oldval, uaddr, oparg);
51 __futex_atomic_op("xor %0,%3,%1\n", ret, oldval, uaddr, oparg);
64 futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
65 u32 oldval, u32 newval)
70 if (!access_ok(uaddr, sizeof(u32)))
73 __asm__ __volatile__ (
86 : "+r"(ret), "=&r"(prev), "=&r"(cmp)
87 : "r"(uaddr), "r"((long)(int)oldval), "r"(newval)
94 #endif /* __KERNEL__ */
95 #endif /* _ASM_ALPHA_FUTEX_H */