diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-09-05 00:53:14 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-09-13 04:28:41 -0400 |
commit | 69588298188b40ed7f75c98a6fd328d82f23ca21 (patch) | |
tree | 4b8f8846cc3f4a0f4ae9eb04e4b2de2c12da75fe /include/asm-powerpc | |
parent | 20fb96e2aa009ae9892fde9ef7ffa82f56eebd11 (diff) |
[POWERPC] Implement PowerPC futex_atomic_cmpxchg_inatomic().
The sys_[gs]et_robust_list() syscalls were wired up on PowerPC but
didn't work correctly because futex_atomic_cmpxchg_inatomic() wasn't
implemented. Implement it, based on __cmpxchg_u32().
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r-- | include/asm-powerpc/futex.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/include/asm-powerpc/futex.h b/include/asm-powerpc/futex.h index f1b3c00bc1ce..936422e54891 100644 --- a/include/asm-powerpc/futex.h +++ b/include/asm-powerpc/futex.h | |||
@@ -84,7 +84,33 @@ static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | |||
84 | static inline int | 84 | static inline int |
85 | futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | 85 | futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) |
86 | { | 86 | { |
87 | return -ENOSYS; | 87 | int prev; |
88 | |||
89 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) | ||
90 | return -EFAULT; | ||
91 | |||
92 | __asm__ __volatile__ ( | ||
93 | LWSYNC_ON_SMP | ||
94 | "1: lwarx %0,0,%2 # futex_atomic_cmpxchg_inatomic\n\ | ||
95 | cmpw 0,%0,%3\n\ | ||
96 | bne- 3f\n" | ||
97 | PPC405_ERR77(0,%2) | ||
98 | "2: stwcx. %4,0,%2\n\ | ||
99 | bne- 1b\n" | ||
100 | ISYNC_ON_SMP | ||
101 | "3: .section .fixup,\"ax\"\n\ | ||
102 | 4: li %0,%5\n\ | ||
103 | b 3b\n\ | ||
104 | .previous\n\ | ||
105 | .section __ex_table,\"a\"\n\ | ||
106 | .align 3\n\ | ||
107 | " PPC_LONG "1b,4b,2b,4b\n\ | ||
108 | .previous" \ | ||
109 | : "=&r" (prev), "+m" (*uaddr) | ||
110 | : "r" (uaddr), "r" (oldval), "r" (newval), "i" (-EFAULT) | ||
111 | : "cc", "memory"); | ||
112 | |||
113 | return prev; | ||
88 | } | 114 | } |
89 | 115 | ||
90 | #endif /* __KERNEL__ */ | 116 | #endif /* __KERNEL__ */ |