diff options
Diffstat (limited to 'include/asm-i386/futex.h')
-rw-r--r-- | include/asm-i386/futex.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/asm-i386/futex.h b/include/asm-i386/futex.h index 44b9db806474..7b8ceefd010f 100644 --- a/include/asm-i386/futex.h +++ b/include/asm-i386/futex.h | |||
@@ -104,5 +104,32 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | |||
104 | return ret; | 104 | return ret; |
105 | } | 105 | } |
106 | 106 | ||
107 | static inline int | ||
108 | futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | ||
109 | { | ||
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; | ||
132 | } | ||
133 | |||
107 | #endif | 134 | #endif |
108 | #endif | 135 | #endif |