]>
Commit | Line | Data |
---|---|---|
1965aae3 PA |
1 | #ifndef _ASM_X86_UACCESS_32_H |
2 | #define _ASM_X86_UACCESS_32_H | |
1da177e4 LT |
3 | |
4 | /* | |
5 | * User space memory access functions | |
6 | */ | |
1da177e4 | 7 | #include <linux/string.h> |
14e6d17d | 8 | #include <asm/asm.h> |
1da177e4 LT |
9 | #include <asm/page.h> |
10 | ||
beba3a20 AV |
11 | unsigned long __must_check __copy_user_ll |
12 | (void *to, const void *from, unsigned long n); | |
b1fcec7f JP |
13 | unsigned long __must_check __copy_from_user_ll_nocache_nozero |
14 | (void *to, const void __user *from, unsigned long n); | |
1da177e4 | 15 | |
652050ae | 16 | static __always_inline unsigned long __must_check |
beba3a20 | 17 | raw_copy_to_user(void __user *to, const void *from, unsigned long n) |
1da177e4 | 18 | { |
beba3a20 | 19 | return __copy_user_ll((__force void *)to, from, n); |
1da177e4 LT |
20 | } |
21 | ||
7c12d811 | 22 | static __always_inline unsigned long |
beba3a20 | 23 | raw_copy_from_user(void *to, const void __user *from, unsigned long n) |
7c12d811 | 24 | { |
1da177e4 LT |
25 | if (__builtin_constant_p(n)) { |
26 | unsigned long ret; | |
27 | ||
28 | switch (n) { | |
29 | case 1: | |
beba3a20 | 30 | ret = 0; |
de9e478b | 31 | __uaccess_begin(); |
beba3a20 AV |
32 | __get_user_asm_nozero(*(u8 *)to, from, ret, |
33 | "b", "b", "=q", 1); | |
de9e478b | 34 | __uaccess_end(); |
1da177e4 LT |
35 | return ret; |
36 | case 2: | |
beba3a20 | 37 | ret = 0; |
de9e478b | 38 | __uaccess_begin(); |
beba3a20 AV |
39 | __get_user_asm_nozero(*(u16 *)to, from, ret, |
40 | "w", "w", "=r", 2); | |
de9e478b | 41 | __uaccess_end(); |
1da177e4 LT |
42 | return ret; |
43 | case 4: | |
beba3a20 | 44 | ret = 0; |
de9e478b | 45 | __uaccess_begin(); |
beba3a20 AV |
46 | __get_user_asm_nozero(*(u32 *)to, from, ret, |
47 | "l", "k", "=r", 4); | |
de9e478b | 48 | __uaccess_end(); |
1da177e4 LT |
49 | return ret; |
50 | } | |
51 | } | |
beba3a20 | 52 | return __copy_user_ll(to, (__force const void *)from, n); |
1da177e4 LT |
53 | } |
54 | ||
652050ae | 55 | static __always_inline unsigned long |
b1fcec7f JP |
56 | __copy_from_user_inatomic_nocache(void *to, const void __user *from, |
57 | unsigned long n) | |
1da177e4 | 58 | { |
7c12d811 | 59 | return __copy_from_user_ll_nocache_nozero(to, from, n); |
c22ce143 HY |
60 | } |
61 | ||
1965aae3 | 62 | #endif /* _ASM_X86_UACCESS_32_H */ |