Lines Matching +full:x +full:- +full:size
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
11 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
25 #include <asm-generic/access_ok.h>
28 * These are the main single-value transfer routines. They automatically
29 * use the right size if we just have the right pointer type.
45 #define get_user(x, ptr) \ argument
46 __get_user_check((x), (ptr), sizeof(*(ptr)))
47 #define put_user(x, ptr) \ argument
48 __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
50 #define __get_user(x, ptr) \ argument
51 __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
52 #define __put_user(x, ptr) \ argument
53 __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
57 #define __put_user_nocheck(x, ptr, size) \ argument
60 __put_user_size((x), (ptr), (size), __pu_err); \
64 #define __put_user_check(x, ptr, size) \ argument
66 long __pu_err = -EFAULT; \
68 if (access_ok(__pu_addr, size)) \
69 __put_user_size((x), __pu_addr, (size), __pu_err); \
73 #define __put_user_size(x, ptr, size, retval) \ argument
76 switch (size) { \
77 case 1: __put_user_asm(x, ptr, retval, "l.sb"); break; \
78 case 2: __put_user_asm(x, ptr, retval, "l.sh"); break; \
79 case 4: __put_user_asm(x, ptr, retval, "l.sw"); break; \
80 case 8: __put_user_asm2(x, ptr, retval); break; \
88 #define __m(x) (*(struct __large_struct *)(x)) argument
95 #define __put_user_asm(x, addr, err, op) \ argument
109 : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err))
111 #define __put_user_asm2(x, addr, err) \ argument
127 : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err))
129 #define __get_user_nocheck(x, ptr, size) \ argument
132 __get_user_size((x), (ptr), (size), __gu_err); \
136 #define __get_user_check(x, ptr, size) \ argument
138 long __gu_err = -EFAULT; \
140 if (access_ok(__gu_addr, size)) \
141 __get_user_size((x), __gu_addr, (size), __gu_err); \
143 (x) = (__typeof__(*(ptr))) 0; \
149 #define __get_user_size(x, ptr, size, retval) \ argument
152 switch (size) { \
153 case 1: __get_user_asm(x, ptr, retval, "l.lbz"); break; \
154 case 2: __get_user_asm(x, ptr, retval, "l.lhz"); break; \
155 case 4: __get_user_asm(x, ptr, retval, "l.lwz"); break; \
156 case 8: __get_user_asm2(x, ptr, retval); break; \
157 default: (x) = (__typeof__(*(ptr)))__get_user_bad(); \
161 #define __get_user_asm(x, addr, err, op) \ argument
178 : "r"(addr), "i"(-EFAULT), "0"(err)); \
179 (x) = (__typeof__(*(addr)))__gu_tmp; \
182 #define __get_user_asm2(x, addr, err) \ argument
202 : "r"(addr), "i"(-EFAULT), "0"(err)); \
203 (x) = (__typeof__(*(addr)))( \
204 (__typeof__((x)-(x)))__gu_tmp); \
210 __copy_tofrom_user(void *to, const void *from, unsigned long size);
212 raw_copy_from_user(void *to, const void __user *from, unsigned long size) in raw_copy_from_user() argument
214 return __copy_tofrom_user(to, (__force const void *)from, size); in raw_copy_from_user()
217 raw_copy_to_user(void __user *to, const void *from, unsigned long size) in raw_copy_to_user() argument
219 return __copy_tofrom_user((__force void *)to, from, size); in raw_copy_to_user()
224 extern unsigned long __clear_user(void __user *addr, unsigned long size);
227 clear_user(void __user *addr, unsigned long size) in clear_user() argument
229 if (likely(access_ok(addr, size))) in clear_user()
230 size = __clear_user(addr, size); in clear_user()
231 return size; in clear_user()