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 | |
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')
-rw-r--r-- | include/asm-x86_64/futex.h | 23 | ||||
-rw-r--r-- | include/asm-x86_64/unistd.h | 6 |
2 files changed, 27 insertions, 2 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 |
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h index da0341c57949..fcc516353087 100644 --- a/include/asm-x86_64/unistd.h +++ b/include/asm-x86_64/unistd.h | |||
@@ -605,8 +605,12 @@ __SYSCALL(__NR_pselect6, sys_ni_syscall) /* for now */ | |||
605 | __SYSCALL(__NR_ppoll, sys_ni_syscall) /* for now */ | 605 | __SYSCALL(__NR_ppoll, sys_ni_syscall) /* for now */ |
606 | #define __NR_unshare 272 | 606 | #define __NR_unshare 272 |
607 | __SYSCALL(__NR_unshare, sys_unshare) | 607 | __SYSCALL(__NR_unshare, sys_unshare) |
608 | #define __NR_set_robust_list 273 | ||
609 | __SYSCALL(__NR_set_robust_list, sys_set_robust_list) | ||
610 | #define __NR_get_robust_list 274 | ||
611 | __SYSCALL(__NR_get_robust_list, sys_get_robust_list) | ||
608 | 612 | ||
609 | #define __NR_syscall_max __NR_unshare | 613 | #define __NR_syscall_max __NR_get_robust_list |
610 | 614 | ||
611 | #ifndef __NO_STUBS | 615 | #ifndef __NO_STUBS |
612 | 616 | ||