1 #ifndef _ASM_X86_FUTEX_H
2 #define _ASM_X86_FUTEX_H
6 #include <linux/futex.h>
10 #include <asm/errno.h>
11 #include <asm/processor.h>
14 #define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \
15 asm volatile("\t" ASM_STAC "\n" \
17 "2:\t" ASM_CLAC "\n" \
18 "\t.section .fixup,\"ax\"\n" \
22 _ASM_EXTABLE(1b, 3b) \
23 : "=r" (oldval), "=r" (ret), "+m" (*uaddr) \
24 : "i" (-EFAULT), "0" (oparg), "1" (0))
26 #define __futex_atomic_op2(insn, ret, oldval, uaddr, oparg) \
27 asm volatile("\t" ASM_STAC "\n" \
31 "2:\t" LOCK_PREFIX "cmpxchgl %3, %2\n" \
33 "3:\t" ASM_CLAC "\n" \
34 "\t.section .fixup,\"ax\"\n" \
38 _ASM_EXTABLE(1b, 4b) \
39 _ASM_EXTABLE(2b, 4b) \
40 : "=&a" (oldval), "=&r" (ret), \
41 "+m" (*uaddr), "=&r" (tem) \
42 : "r" (oparg), "i" (-EFAULT), "1" (0))
46 int op = (encoded_op >> 28) & 7;
47 int cmp = (encoded_op >> 24) & 15;
48 int oparg = (encoded_op << 8) >> 20;
49 int cmparg = (encoded_op << 20) >> 20;
50 int oldval = 0,
ret, tem;
58 #if defined(CONFIG_X86_32) && !defined(CONFIG_X86_BSWAP)
92 ret = (oldval == cmparg);
95 ret = (oldval != cmparg);
98 ret = (oldval < cmparg);
101 ret = (oldval >= cmparg);
104 ret = (oldval <= cmparg);
107 ret = (oldval > cmparg);
116 static inline int futex_atomic_cmpxchg_inatomic(
u32 *uval,
u32 __user *uaddr,
121 #if defined(CONFIG_X86_32) && !defined(CONFIG_X86_BSWAP)
133 "\t.section .fixup, \"ax\"\n"
138 :
"+r" (ret),
"=a" (oldval),
"+m" (*uaddr)
139 :
"i" (-
EFAULT),
"r" (newval),
"1" (oldval)