aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/uaccess.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/uaccess.h')
-rw-r--r--include/asm-x86/uaccess.h50
1 files changed, 49 insertions, 1 deletions
diff --git a/include/asm-x86/uaccess.h b/include/asm-x86/uaccess.h
index bcda5d075921..4353b2267a02 100644
--- a/include/asm-x86/uaccess.h
+++ b/include/asm-x86/uaccess.h
@@ -233,6 +233,47 @@ do { \
233 233
234#endif 234#endif
235 235
236#ifdef CONFIG_X86_32
237#define __get_user_asm_u64(x, ptr, retval, errret) (x) = __get_user_bad()
238#else
239#define __get_user_asm_u64(x, ptr, retval, errret) \
240 __get_user_asm(x, ptr, retval, "q", "", "=r", errret)
241#endif
242
243#define __get_user_size(x, ptr, size, retval, errret) \
244do { \
245 retval = 0; \
246 __chk_user_ptr(ptr); \
247 switch (size) { \
248 case 1: \
249 __get_user_asm(x, ptr, retval, "b", "b", "=q", errret); \
250 break; \
251 case 2: \
252 __get_user_asm(x, ptr, retval, "w", "w", "=r", errret); \
253 break; \
254 case 4: \
255 __get_user_asm(x, ptr, retval, "l", "k", "=r", errret); \
256 break; \
257 case 8: \
258 __get_user_asm_u64(x, ptr, retval, errret); \
259 break; \
260 default: \
261 (x) = __get_user_bad(); \
262 } \
263} while (0)
264
265#define __get_user_asm(x, addr, err, itype, rtype, ltype, errret) \
266 asm volatile("1: mov"itype" %2,%"rtype"1\n" \
267 "2:\n" \
268 ".section .fixup,\"ax\"\n" \
269 "3: mov %3,%0\n" \
270 " xor"itype" %"rtype"1,%"rtype"1\n" \
271 " jmp 2b\n" \
272 ".previous\n" \
273 _ASM_EXTABLE(1b, 3b) \
274 : "=r" (err), ltype(x) \
275 : "m" (__m(addr)), "i" (errret), "0" (err))
276
236#define __put_user_nocheck(x, ptr, size) \ 277#define __put_user_nocheck(x, ptr, size) \
237({ \ 278({ \
238 long __pu_err; \ 279 long __pu_err; \
@@ -240,7 +281,14 @@ do { \
240 __pu_err; \ 281 __pu_err; \
241}) 282})
242 283
243 284#define __get_user_nocheck(x, ptr, size) \
285({ \
286 long __gu_err; \
287 unsigned long __gu_val; \
288 __get_user_size(__gu_val, (ptr), (size), __gu_err, -EFAULT); \
289 (x) = (__force __typeof__(*(ptr)))__gu_val; \
290 __gu_err; \
291})
244 292
245/* FIXME: this hack is definitely wrong -AK */ 293/* FIXME: this hack is definitely wrong -AK */
246struct __large_struct { unsigned long buf[100]; }; 294struct __large_struct { unsigned long buf[100]; };