1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/compiler.h>
7 extern void *__user_addr_min, *__user_addr_max;
9 #define put_user(x, ptr) \
11 typeof(ptr) __pu_ptr = (ptr); \
12 __chk_user_ptr(__pu_ptr); \
13 WRITE_ONCE(*(__pu_ptr), x); \
17 #define get_user(x, ptr) \
19 typeof(ptr) __pu_ptr = (ptr); \
20 __chk_user_ptr(__pu_ptr); \
21 x = READ_ONCE(*(__pu_ptr)); \
25 static void volatile_memcpy(volatile char *to, const volatile char *from,
32 static inline int copy_from_user(void *to, const void __user volatile *from,
35 volatile_memcpy(to, from, n);
39 static inline int copy_to_user(void __user volatile *to, const void *from,
42 volatile_memcpy(to, from, n);
45 #endif /* UACCESS_H */