[POWERPC] Add inatomic versions of __get_user and __put_user
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 11 Apr 2007 06:13:19 +0000 (16:13 +1000)
committerPaul Mackerras <paulus@samba.org>
Thu, 12 Apr 2007 18:09:38 +0000 (04:09 +1000)
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>
include/asm-powerpc/uaccess.h

index adbf16b8cfbbbf8e52ece9bf71a089845f8ca71a..8e798e3758bc38137ca15d2f0e23c954e0339c26 100644 (file)
@@ -110,12 +110,18 @@ struct exception_table_entry {
        __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
 #define __put_user(x, ptr) \
        __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
+
 #ifndef __powerpc64__
 #define __get_user64(x, ptr) \
        __get_user64_nocheck((x), (ptr), sizeof(*(ptr)))
 #define __put_user64(x, ptr) __put_user(x, ptr)
 #endif
 
+#define __get_user_inatomic(x, ptr) \
+       __get_user_nosleep((x), (ptr), sizeof(*(ptr)))
+#define __put_user_inatomic(x, ptr) \
+       __put_user_nosleep((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
+
 #define __get_user_unaligned __get_user
 #define __put_user_unaligned __put_user
 
@@ -198,6 +204,16 @@ do {                                                               \
        __pu_err;                                                       \
 })
 
+#define __put_user_nosleep(x, ptr, size)                       \
+({                                                             \
+       long __pu_err;                                          \
+       __typeof__(*(ptr)) __user *__pu_addr = (ptr);           \
+       __chk_user_ptr(ptr);                                    \
+       __put_user_size((x), __pu_addr, (size), __pu_err);      \
+       __pu_err;                                               \
+})
+
+
 extern long __get_user_bad(void);
 
 #define __get_user_asm(x, addr, err, op)               \
@@ -297,6 +313,18 @@ do {                                                               \
        __gu_err;                                                       \
 })
 
+#define __get_user_nosleep(x, ptr, size)                       \
+({                                                             \
+       long __gu_err;                                          \
+       unsigned long __gu_val;                                 \
+       const __typeof__(*(ptr)) __user *__gu_addr = (ptr);     \
+       __chk_user_ptr(ptr);                                    \
+       __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
+       (x) = (__typeof__(*(ptr)))__gu_val;                     \
+       __gu_err;                                               \
+})
+
+
 /* more complex routines */
 
 extern unsigned long __copy_tofrom_user(void __user *to,