Lines Matching +full:x +full:- +full:size

2  * include/asm-xtensa/uaccess.h
13 * Copyright (C) 2001 - 2005 Tensilica Inc.
22 #include <asm-generic/access_ok.h>
25 * These are the main single-value transfer routines. They
26 * automatically use the right size if we just have the right pointer
35 * (a) re-use the arguments for side effects (sizeof is ok)
38 #define put_user(x, ptr) __put_user_check((x), (ptr), sizeof(*(ptr))) argument
39 #define get_user(x, ptr) __get_user_check((x), (ptr), sizeof(*(ptr))) argument
47 #define __put_user(x, ptr) __put_user_nocheck((x), (ptr), sizeof(*(ptr))) argument
48 #define __get_user(x, ptr) __get_user_nocheck((x), (ptr), sizeof(*(ptr))) argument
53 #define __put_user_nocheck(x, ptr, size) \ argument
56 __put_user_size((x), (ptr), (size), __pu_err); \
60 #define __put_user_check(x, ptr, size) \ argument
62 long __pu_err = -EFAULT; \
64 if (access_ok(__pu_addr, size)) \
65 __put_user_size((x), __pu_addr, (size), __pu_err); \
69 #define __put_user_size(x, ptr, size, retval) \ argument
73 switch (size) { \
74 case 1: __put_user_asm(x, ptr, retval, 1, "s8i", __cb); break; \
75 case 2: __put_user_asm(x, ptr, retval, 2, "s16i", __cb); break; \
76 case 4: __put_user_asm(x, ptr, retval, 4, "s32i", __cb); break; \
78 __typeof__(*ptr) __v64 = x; \
79 retval = __copy_to_user(ptr, &__v64, 8) ? -EFAULT : 0; \
89 * unaligned exception and an MMU-related exception (unaligned
96 * Double exception occurs for MMU-related cause (e.g., page not mapped).
104 * macro-specific labels such as 0f, 1f, %0, %2, and %3 must stay in
133 "1: "insn" %[x], %[mem] \n" \
147 :[x] "r"(x_), [efault] "i"(-EFAULT))
149 #define __get_user_nocheck(x, ptr, size) \ argument
152 __get_user_size((x), (ptr), (size), __gu_err); \
156 #define __get_user_check(x, ptr, size) \ argument
158 long __gu_err = -EFAULT; \
160 if (access_ok(__gu_addr, size)) \
161 __get_user_size((x), __gu_addr, (size), __gu_err); \
163 (x) = (__typeof__(*(ptr)))0; \
169 #define __get_user_size(x, ptr, size, retval) \ argument
173 switch (size) { \
174 case 1: __get_user_asm(x, ptr, retval, 1, "l8ui", __cb); break;\
175 case 2: __get_user_asm(x, ptr, retval, 2, "l16ui", __cb); break;\
176 case 4: __get_user_asm(x, ptr, retval, 4, "l32i", __cb); break;\
180 retval = -EFAULT; \
181 (x) = (__typeof__(*(ptr)))0; \
183 (x) = *(__force __typeof__(*(ptr)) *)&__x; \
188 (x) = (__typeof__(*(ptr)))0; \
203 "1: "insn" %[x], %[mem] \n" \
216 :[err] "+r"(err_), [tmp] "=r"(cb), [x] "+r"(__x) \
217 :[mem] "m"(*(addr_)), [efault] "i"(-EFAULT)); \
245 * returns zero if a problem occurs while accessing user-space memory.
251 __xtensa_clear_user(void __user *addr, unsigned long size) in __xtensa_clear_user() argument
253 if (!__memset((void __force *)addr, 0, size)) in __xtensa_clear_user()
254 return size; in __xtensa_clear_user()
259 clear_user(void __user *addr, unsigned long size) in clear_user() argument
261 if (access_ok(addr, size)) in clear_user()
262 return __xtensa_clear_user(addr, size); in clear_user()
263 return size ? -EFAULT : 0; in clear_user()
277 return -EFAULT; in strncpy_from_user()
284 * Return the size of a string (including the ending 0!)