aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386/futex.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-27 04:16:25 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-27 11:44:49 -0500
commitdfd4e3ec246355274c9cf62c6b04a1ee6fa3caba (patch)
tree9b745a5f4b5134c2a101280f6bbd1947c15800d8 /include/asm-i386/futex.h
parent34f192c6527f20c47ccec239e7d51a27691b93fc (diff)
[PATCH] lightweight robust futexes: i386
i386: add the futex_atomic_cmpxchg_inuser() assembly implementation, and wire up the new syscalls. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Arjan van de Ven <arjan@infradead.org> Acked-by: Ulrich Drepper <drepper@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
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