diff options
Diffstat (limited to 'arch/mn10300/include/asm/uaccess.h')
-rw-r--r-- | arch/mn10300/include/asm/uaccess.h | 73 |
1 files changed, 39 insertions, 34 deletions
diff --git a/arch/mn10300/include/asm/uaccess.h b/arch/mn10300/include/asm/uaccess.h index 8a3a4dd55763..167e10ff06d9 100644 --- a/arch/mn10300/include/asm/uaccess.h +++ b/arch/mn10300/include/asm/uaccess.h | |||
@@ -129,42 +129,47 @@ extern int fixup_exception(struct pt_regs *regs); | |||
129 | struct __large_struct { unsigned long buf[100]; }; | 129 | struct __large_struct { unsigned long buf[100]; }; |
130 | #define __m(x) (*(struct __large_struct *)(x)) | 130 | #define __m(x) (*(struct __large_struct *)(x)) |
131 | 131 | ||
132 | #define __get_user_nocheck(x, ptr, size) \ | 132 | #define __get_user_nocheck(x, ptr, size) \ |
133 | ({ \ | 133 | ({ \ |
134 | __typeof(*(ptr)) __gu_val; \ | 134 | unsigned long __gu_addr; \ |
135 | unsigned long __gu_addr; \ | 135 | int __gu_err; \ |
136 | int __gu_err; \ | 136 | __gu_addr = (unsigned long) (ptr); \ |
137 | __gu_addr = (unsigned long) (ptr); \ | 137 | switch (size) { \ |
138 | switch (size) { \ | 138 | case 1: { \ |
139 | case 1: __get_user_asm("bu"); break; \ | 139 | unsigned char __gu_val; \ |
140 | case 2: __get_user_asm("hu"); break; \ | 140 | __get_user_asm("bu"); \ |
141 | case 4: __get_user_asm("" ); break; \ | 141 | (x) = *(__force __typeof__(*(ptr))*) &__gu_val; \ |
142 | default: __get_user_unknown(); break; \ | 142 | break; \ |
143 | } \ | 143 | } \ |
144 | x = (__typeof__(*(ptr))) __gu_val; \ | 144 | case 2: { \ |
145 | __gu_err; \ | 145 | unsigned short __gu_val; \ |
146 | __get_user_asm("hu"); \ | ||
147 | (x) = *(__force __typeof__(*(ptr))*) &__gu_val; \ | ||
148 | break; \ | ||
149 | } \ | ||
150 | case 4: { \ | ||
151 | unsigned int __gu_val; \ | ||
152 | __get_user_asm(""); \ | ||
153 | (x) = *(__force __typeof__(*(ptr))*) &__gu_val; \ | ||
154 | break; \ | ||
155 | } \ | ||
156 | default: \ | ||
157 | __get_user_unknown(); \ | ||
158 | break; \ | ||
159 | } \ | ||
160 | __gu_err; \ | ||
146 | }) | 161 | }) |
147 | 162 | ||
148 | #define __get_user_check(x, ptr, size) \ | 163 | #define __get_user_check(x, ptr, size) \ |
149 | ({ \ | 164 | ({ \ |
150 | __typeof__(*(ptr)) __gu_val; \ | 165 | int _e; \ |
151 | unsigned long __gu_addr; \ | 166 | if (likely(__access_ok((unsigned long) (ptr), (size)))) \ |
152 | int __gu_err; \ | 167 | _e = __get_user_nocheck((x), (ptr), (size)); \ |
153 | __gu_addr = (unsigned long) (ptr); \ | 168 | else { \ |
154 | if (likely(__access_ok(__gu_addr,size))) { \ | 169 | _e = -EFAULT; \ |
155 | switch (size) { \ | 170 | (x) = (__typeof__(x))0; \ |
156 | case 1: __get_user_asm("bu"); break; \ | 171 | } \ |
157 | case 2: __get_user_asm("hu"); break; \ | 172 | _e; \ |
158 | case 4: __get_user_asm("" ); break; \ | ||
159 | default: __get_user_unknown(); break; \ | ||
160 | } \ | ||
161 | } \ | ||
162 | else { \ | ||
163 | __gu_err = -EFAULT; \ | ||
164 | __gu_val = 0; \ | ||
165 | } \ | ||
166 | x = (__typeof__(*(ptr))) __gu_val; \ | ||
167 | __gu_err; \ | ||
168 | }) | 173 | }) |
169 | 174 | ||
170 | #define __get_user_asm(INSN) \ | 175 | #define __get_user_asm(INSN) \ |