diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2007-04-11 02:13:19 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-04-12 14:09:38 -0400 |
commit | e68c825bb016703eda94aac99be96de73b482d61 (patch) | |
tree | dc6296684daa47cb17e8e1d772fb9d7487a7b1cf | |
parent | 06533e28c9e8b252fbfb6858647afe48b5147e16 (diff) |
[POWERPC] Add inatomic versions of __get_user and __put_user
Those are needed by things like alignment exception fixup handlers
since those can now be triggered by copy_tofrom_user_inatomic.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | include/asm-powerpc/uaccess.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/asm-powerpc/uaccess.h b/include/asm-powerpc/uaccess.h index adbf16b8cfbb..8e798e3758bc 100644 --- a/include/asm-powerpc/uaccess.h +++ b/include/asm-powerpc/uaccess.h | |||
@@ -110,12 +110,18 @@ struct exception_table_entry { | |||
110 | __get_user_nocheck((x), (ptr), sizeof(*(ptr))) | 110 | __get_user_nocheck((x), (ptr), sizeof(*(ptr))) |
111 | #define __put_user(x, ptr) \ | 111 | #define __put_user(x, ptr) \ |
112 | __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) | 112 | __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) |
113 | |||
113 | #ifndef __powerpc64__ | 114 | #ifndef __powerpc64__ |
114 | #define __get_user64(x, ptr) \ | 115 | #define __get_user64(x, ptr) \ |
115 | __get_user64_nocheck((x), (ptr), sizeof(*(ptr))) | 116 | __get_user64_nocheck((x), (ptr), sizeof(*(ptr))) |
116 | #define __put_user64(x, ptr) __put_user(x, ptr) | 117 | #define __put_user64(x, ptr) __put_user(x, ptr) |
117 | #endif | 118 | #endif |
118 | 119 | ||
120 | #define __get_user_inatomic(x, ptr) \ | ||
121 | __get_user_nosleep((x), (ptr), sizeof(*(ptr))) | ||
122 | #define __put_user_inatomic(x, ptr) \ | ||
123 | __put_user_nosleep((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) | ||
124 | |||
119 | #define __get_user_unaligned __get_user | 125 | #define __get_user_unaligned __get_user |
120 | #define __put_user_unaligned __put_user | 126 | #define __put_user_unaligned __put_user |
121 | 127 | ||
@@ -198,6 +204,16 @@ do { \ | |||
198 | __pu_err; \ | 204 | __pu_err; \ |
199 | }) | 205 | }) |
200 | 206 | ||
207 | #define __put_user_nosleep(x, ptr, size) \ | ||
208 | ({ \ | ||
209 | long __pu_err; \ | ||
210 | __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ | ||
211 | __chk_user_ptr(ptr); \ | ||
212 | __put_user_size((x), __pu_addr, (size), __pu_err); \ | ||
213 | __pu_err; \ | ||
214 | }) | ||
215 | |||
216 | |||
201 | extern long __get_user_bad(void); | 217 | extern long __get_user_bad(void); |
202 | 218 | ||
203 | #define __get_user_asm(x, addr, err, op) \ | 219 | #define __get_user_asm(x, addr, err, op) \ |
@@ -297,6 +313,18 @@ do { \ | |||
297 | __gu_err; \ | 313 | __gu_err; \ |
298 | }) | 314 | }) |
299 | 315 | ||
316 | #define __get_user_nosleep(x, ptr, size) \ | ||
317 | ({ \ | ||
318 | long __gu_err; \ | ||
319 | unsigned long __gu_val; \ | ||
320 | const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ | ||
321 | __chk_user_ptr(ptr); \ | ||
322 | __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \ | ||
323 | (x) = (__typeof__(*(ptr)))__gu_val; \ | ||
324 | __gu_err; \ | ||
325 | }) | ||
326 | |||
327 | |||
300 | /* more complex routines */ | 328 | /* more complex routines */ |
301 | 329 | ||
302 | extern unsigned long __copy_tofrom_user(void __user *to, | 330 | extern unsigned long __copy_tofrom_user(void __user *to, |