diff options
Diffstat (limited to 'arch/powerpc/include/asm/futex.h')
-rw-r--r-- | arch/powerpc/include/asm/futex.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/arch/powerpc/include/asm/futex.h b/arch/powerpc/include/asm/futex.h index 7c589ef81fb0..c94e4a3fe2ef 100644 --- a/arch/powerpc/include/asm/futex.h +++ b/arch/powerpc/include/asm/futex.h | |||
@@ -30,7 +30,7 @@ | |||
30 | : "b" (uaddr), "i" (-EFAULT), "r" (oparg) \ | 30 | : "b" (uaddr), "i" (-EFAULT), "r" (oparg) \ |
31 | : "cr0", "memory") | 31 | : "cr0", "memory") |
32 | 32 | ||
33 | static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | 33 | static inline int futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) |
34 | { | 34 | { |
35 | int op = (encoded_op >> 28) & 7; | 35 | int op = (encoded_op >> 28) & 7; |
36 | int cmp = (encoded_op >> 24) & 15; | 36 | int cmp = (encoded_op >> 24) & 15; |
@@ -40,7 +40,7 @@ static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | |||
40 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) | 40 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) |
41 | oparg = 1 << oparg; | 41 | oparg = 1 << oparg; |
42 | 42 | ||
43 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) | 43 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(u32))) |
44 | return -EFAULT; | 44 | return -EFAULT; |
45 | 45 | ||
46 | pagefault_disable(); | 46 | pagefault_disable(); |
@@ -82,35 +82,38 @@ static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | |||
82 | } | 82 | } |
83 | 83 | ||
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(u32 *uval, u32 __user *uaddr, |
86 | u32 oldval, u32 newval) | ||
86 | { | 87 | { |
87 | int prev; | 88 | int ret = 0; |
89 | u32 prev; | ||
88 | 90 | ||
89 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) | 91 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))) |
90 | return -EFAULT; | 92 | return -EFAULT; |
91 | 93 | ||
92 | __asm__ __volatile__ ( | 94 | __asm__ __volatile__ ( |
93 | PPC_RELEASE_BARRIER | 95 | PPC_RELEASE_BARRIER |
94 | "1: lwarx %0,0,%2 # futex_atomic_cmpxchg_inatomic\n\ | 96 | "1: lwarx %1,0,%3 # futex_atomic_cmpxchg_inatomic\n\ |
95 | cmpw 0,%0,%3\n\ | 97 | cmpw 0,%1,%4\n\ |
96 | bne- 3f\n" | 98 | bne- 3f\n" |
97 | PPC405_ERR77(0,%2) | 99 | PPC405_ERR77(0,%3) |
98 | "2: stwcx. %4,0,%2\n\ | 100 | "2: stwcx. %5,0,%3\n\ |
99 | bne- 1b\n" | 101 | bne- 1b\n" |
100 | PPC_ACQUIRE_BARRIER | 102 | PPC_ACQUIRE_BARRIER |
101 | "3: .section .fixup,\"ax\"\n\ | 103 | "3: .section .fixup,\"ax\"\n\ |
102 | 4: li %0,%5\n\ | 104 | 4: li %0,%6\n\ |
103 | b 3b\n\ | 105 | b 3b\n\ |
104 | .previous\n\ | 106 | .previous\n\ |
105 | .section __ex_table,\"a\"\n\ | 107 | .section __ex_table,\"a\"\n\ |
106 | .align 3\n\ | 108 | .align 3\n\ |
107 | " PPC_LONG "1b,4b,2b,4b\n\ | 109 | " PPC_LONG "1b,4b,2b,4b\n\ |
108 | .previous" \ | 110 | .previous" \ |
109 | : "=&r" (prev), "+m" (*uaddr) | 111 | : "+r" (ret), "=&r" (prev), "+m" (*uaddr) |
110 | : "r" (uaddr), "r" (oldval), "r" (newval), "i" (-EFAULT) | 112 | : "r" (uaddr), "r" (oldval), "r" (newval), "i" (-EFAULT) |
111 | : "cc", "memory"); | 113 | : "cc", "memory"); |
112 | 114 | ||
113 | return prev; | 115 | *uval = prev; |
116 | return ret; | ||
114 | } | 117 | } |
115 | 118 | ||
116 | #endif /* __KERNEL__ */ | 119 | #endif /* __KERNEL__ */ |