diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-27 04:16:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-27 11:44:49 -0500 |
commit | 8fdd6c6df7889dc89df3d9fe0f5bbe6733e39f48 (patch) | |
tree | e037a0eb7214818ad4ef177c618ef1e302c2aed9 /include/asm-x86_64/futex.h | |
parent | dfd4e3ec246355274c9cf62c6b04a1ee6fa3caba (diff) |
[PATCH] lightweight robust futexes: x86_64
x86_64: 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>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-x86_64/futex.h')
-rw-r--r-- | include/asm-x86_64/futex.h | 23 |
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) | |||
97 | static inline int | 97 | static inline int |
98 | futex_atomic_cmpxchg_inuser(int __user *uaddr, int oldval, int newval) | 98 | futex_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 |