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
,
38 __futex_atomic_op("mov %3,%1\n", ret
, oldval
, uaddr
, oparg
);
41 __futex_atomic_op("addl %0,%3,%1\n", ret
, oldval
, uaddr
, oparg
);
44 __futex_atomic_op("or %0,%3,%1\n", ret
, oldval
, uaddr
, oparg
);
47 __futex_atomic_op("andnot %0,%3,%1\n", ret
, oldval
, uaddr
, oparg
);
50 __futex_atomic_op("xor %0,%3,%1\n", ret
, oldval
, uaddr
, oparg
);
65 futex_atomic_cmpxchg_inatomic(u32
*uval
, u32 __user
*uaddr
,
66 u32 oldval
, u32 newval
)
71 if (!access_ok(uaddr
, sizeof(u32
)))
74 __asm__
__volatile__ (
87 : "+r"(ret
), "=&r"(prev
), "=&r"(cmp
)
88 : "r"(uaddr
), "r"((long)(int)oldval
), "r"(newval
)
95 #endif /* __KERNEL__ */
96 #endif /* _ASM_ALPHA_FUTEX_H */