This source file includes following definitions.
- raw_copy_to_user
- raw_copy_from_user
- raw_copy_in_user
- memcpy
- probe_kernel_read
1
2
3
4
5
6
7
8
9
10
11
12 #include <linux/module.h>
13 #include <linux/compiler.h>
14 #include <linux/uaccess.h>
15
16 #define get_user_space() (uaccess_kernel() ? 0 : mfsp(3))
17 #define get_kernel_space() (0)
18
19
20 extern unsigned long pa_memcpy(void *dst, const void *src,
21 unsigned long len);
22
23 unsigned long raw_copy_to_user(void __user *dst, const void *src,
24 unsigned long len)
25 {
26 mtsp(get_kernel_space(), 1);
27 mtsp(get_user_space(), 2);
28 return pa_memcpy((void __force *)dst, src, len);
29 }
30 EXPORT_SYMBOL(raw_copy_to_user);
31
32 unsigned long raw_copy_from_user(void *dst, const void __user *src,
33 unsigned long len)
34 {
35 mtsp(get_user_space(), 1);
36 mtsp(get_kernel_space(), 2);
37 return pa_memcpy(dst, (void __force *)src, len);
38 }
39 EXPORT_SYMBOL(raw_copy_from_user);
40
41 unsigned long raw_copy_in_user(void __user *dst, const void __user *src, unsigned long len)
42 {
43 mtsp(get_user_space(), 1);
44 mtsp(get_user_space(), 2);
45 return pa_memcpy((void __force *)dst, (void __force *)src, len);
46 }
47
48
49 void * memcpy(void * dst,const void *src, size_t count)
50 {
51 mtsp(get_kernel_space(), 1);
52 mtsp(get_kernel_space(), 2);
53 pa_memcpy(dst, src, count);
54 return dst;
55 }
56
57 EXPORT_SYMBOL(raw_copy_in_user);
58 EXPORT_SYMBOL(memcpy);
59
60 long probe_kernel_read(void *dst, const void *src, size_t size)
61 {
62 unsigned long addr = (unsigned long)src;
63
64 if (addr < PAGE_SIZE)
65 return -EFAULT;
66
67
68
69 return __probe_kernel_read(dst, src, size);
70 }