aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386/futex.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-i386/futex.h')
-rw-r--r--include/asm-i386/futex.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/include/asm-i386/futex.h b/include/asm-i386/futex.h
index 1f39ad9d52a1..41184a31885c 100644
--- a/include/asm-i386/futex.h
+++ b/include/asm-i386/futex.h
@@ -107,7 +107,28 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
107static inline int 107static inline int
108futex_atomic_cmpxchg_inuser(int __user *uaddr, int oldval, int newval) 108futex_atomic_cmpxchg_inuser(int __user *uaddr, int oldval, int newval)
109{ 109{
110 return -ENOSYS; 110 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
111 return -EFAULT;
112
113 __asm__ __volatile__(
114 "1: " LOCK_PREFIX "cmpxchgl %3, %1 \n"
115
116 "2: .section .fixup, \"ax\" \n"
117 "3: mov %2, %0 \n"
118 " jmp 2b \n"
119 " .previous \n"
120
121 " .section __ex_table, \"a\" \n"
122 " .align 8 \n"
123 " .long 1b,3b \n"
124 " .previous \n"
125
126 : "=a" (oldval), "=m" (*uaddr)
127 : "i" (-EFAULT), "r" (newval), "0" (oldval)
128 : "memory"
129 );
130
131 return oldval;
111} 132}
112 133
113#endif 134#endif