diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-27 04:16:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-27 11:44:49 -0500 |
commit | dfd4e3ec246355274c9cf62c6b04a1ee6fa3caba (patch) | |
tree | 9b745a5f4b5134c2a101280f6bbd1947c15800d8 /include/asm-i386 | |
parent | 34f192c6527f20c47ccec239e7d51a27691b93fc (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')
-rw-r--r-- | include/asm-i386/futex.h | 23 | ||||
-rw-r--r-- | include/asm-i386/unistd.h | 4 |
2 files changed, 25 insertions, 2 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) | |||
107 | static inline int | 107 | static inline int |
108 | futex_atomic_cmpxchg_inuser(int __user *uaddr, int oldval, int newval) | 108 | futex_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 |
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index d8afd0e3b81a..014e3562895b 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h | |||
@@ -316,8 +316,10 @@ | |||
316 | #define __NR_pselect6 308 | 316 | #define __NR_pselect6 308 |
317 | #define __NR_ppoll 309 | 317 | #define __NR_ppoll 309 |
318 | #define __NR_unshare 310 | 318 | #define __NR_unshare 310 |
319 | #define __NR_set_robust_list 311 | ||
320 | #define __NR_get_robust_list 312 | ||
319 | 321 | ||
320 | #define NR_syscalls 311 | 322 | #define NR_syscalls 313 |
321 | 323 | ||
322 | /* | 324 | /* |
323 | * user-visible error numbers are in the range -1 - -128: see | 325 | * user-visible error numbers are in the range -1 - -128: see |