aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86_64/futex.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86_64/futex.h')
-rw-r--r--include/asm-x86_64/futex.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/include/asm-x86_64/futex.h b/include/asm-x86_64/futex.h
index 4f4cb3410d06..7d9eb1a84546 100644
--- a/include/asm-x86_64/futex.h
+++ b/include/asm-x86_64/futex.h
@@ -97,7 +97,28 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
97static inline int 97static inline int
98futex_atomic_cmpxchg_inuser(int __user *uaddr, int oldval, int newval) 98futex_atomic_cmpxchg_inuser(int __user *uaddr, int oldval, int newval)
99{ 99{
100 return -ENOSYS; 100 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
101 return -EFAULT;
102
103 __asm__ __volatile__(
104 "1: " LOCK_PREFIX "cmpxchgl %3, %1 \n"
105
106 "2: .section .fixup, \"ax\" \n"
107 "3: mov %2, %0 \n"
108 " jmp 2b \n"
109 " .previous \n"
110
111 " .section __ex_table, \"a\" \n"
112 " .align 8 \n"
113 " .quad 1b,3b \n"
114 " .previous \n"
115
116 : "=a" (oldval), "=m" (*uaddr)
117 : "i" (-EFAULT), "r" (newval), "0" (oldval)
118 : "memory"
119 );
120
121 return oldval;
101} 122}
102 123
103#endif 124#endif