aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2009-04-27 10:46:21 -0400
committerRalf Baechle <ralf@linux-mips.org>2009-05-14 08:50:28 -0400
commited01b3d240b76dc1b93d08833832f9ce51a11f02 (patch)
tree192aac142aedd2c8489221acefda8ee5d95c9c85 /arch
parentd0aab922b19aaaef13c946236cc71ab9b7f895ee (diff)
MIPS: Make uaccess.h slightly more sparse friendly.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/include/asm/uaccess.h39
1 files changed, 27 insertions, 12 deletions
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h
index 42b9cec2ee96..5c0876073f13 100644
--- a/arch/mips/include/asm/uaccess.h
+++ b/arch/mips/include/asm/uaccess.h
@@ -104,17 +104,17 @@
104 104
105#define __access_mask get_fs().seg 105#define __access_mask get_fs().seg
106 106
107#define __access_ok(addr, size, mask) \ 107#define __access_ok(addr, size, mask) \
108({ \ 108({ \
109 const volatile void __user *__up = addr; \ 109 unsigned long __addr = (unsigned long) (addr); \
110 unsigned long __addr = (unsigned long) __up; \ 110 unsigned long __size = size; \
111 unsigned long __size = size; \ 111 unsigned long __mask = mask; \
112 unsigned long __mask = mask; \ 112 unsigned long __ok; \
113 unsigned long __ok; \ 113 \
114 \ 114 __chk_user_ptr(addr); \
115 __ok = (signed long)(__mask & (__addr | (__addr + __size) | \ 115 __ok = (signed long)(__mask & (__addr | (__addr + __size) | \
116 __ua_size(__size))); \ 116 __ua_size(__size))); \
117 __ok == 0; \ 117 __ok == 0; \
118}) 118})
119 119
120#define access_ok(type, addr, size) \ 120#define access_ok(type, addr, size) \
@@ -235,6 +235,7 @@ do { \
235({ \ 235({ \
236 int __gu_err; \ 236 int __gu_err; \
237 \ 237 \
238 __chk_user_ptr(ptr); \
238 __get_user_common((x), size, ptr); \ 239 __get_user_common((x), size, ptr); \
239 __gu_err; \ 240 __gu_err; \
240}) 241})
@@ -315,6 +316,7 @@ do { \
315 __typeof__(*(ptr)) __pu_val; \ 316 __typeof__(*(ptr)) __pu_val; \
316 int __pu_err = 0; \ 317 int __pu_err = 0; \
317 \ 318 \
319 __chk_user_ptr(ptr); \
318 __pu_val = (x); \ 320 __pu_val = (x); \
319 switch (size) { \ 321 switch (size) { \
320 case 1: __put_user_asm("sb", ptr); break; \ 322 case 1: __put_user_asm("sb", ptr); break; \
@@ -882,7 +884,20 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
882 __cu_len; \ 884 __cu_len; \
883}) 885})
884 886
885#define __copy_in_user(to, from, n) __copy_from_user(to, from, n) 887#define __copy_in_user(to, from, n) \
888({ \
889 void __user *__cu_to; \
890 const void __user *__cu_from; \
891 long __cu_len; \
892 \
893 might_sleep(); \
894 __cu_to = (to); \
895 __cu_from = (from); \
896 __cu_len = (n); \
897 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \
898 __cu_len); \
899 __cu_len; \
900})
886 901
887#define copy_in_user(to, from, n) \ 902#define copy_in_user(to, from, n) \
888({ \ 903({ \