1
2
3
4
5
6
7
8
9 #include <linux/linkage.h>
10 #include <asm/assembler.h>
11 #include <asm/errno.h>
12 #include <asm/asm-offsets.h>
13
14 .text
15
16 #ifdef CONFIG_CPU_SW_DOMAIN_PAN
17 .macro save_regs
18 mrc p15, 0, ip, c3, c0, 0
19 stmfd sp!, {r1, r2, r4 - r8, ip, lr}
20 uaccess_enable ip
21 .endm
22
23 .macro load_regs
24 ldmfd sp!, {r1, r2, r4 - r8, ip, lr}
25 mcr p15, 0, ip, c3, c0, 0
26 ret lr
27 .endm
28 #else
29 .macro save_regs
30 stmfd sp!, {r1, r2, r4 - r8, lr}
31 .endm
32
33 .macro load_regs
34 ldmfd sp!, {r1, r2, r4 - r8, pc}
35 .endm
36 #endif
37
38 .macro load1b, reg1
39 ldrusr \reg1, r0, 1
40 .endm
41
42 .macro load2b, reg1, reg2
43 ldrusr \reg1, r0, 1
44 ldrusr \reg2, r0, 1
45 .endm
46
47 .macro load1l, reg1
48 ldrusr \reg1, r0, 4
49 .endm
50
51 .macro load2l, reg1, reg2
52 ldrusr \reg1, r0, 4
53 ldrusr \reg2, r0, 4
54 .endm
55
56 .macro load4l, reg1, reg2, reg3, reg4
57 ldrusr \reg1, r0, 4
58 ldrusr \reg2, r0, 4
59 ldrusr \reg3, r0, 4
60 ldrusr \reg4, r0, 4
61 .endm
62
63
64
65
66
67
68
69
70 #define FN_ENTRY ENTRY(csum_partial_copy_from_user)
71 #define FN_EXIT ENDPROC(csum_partial_copy_from_user)
72
73 #include "csumpartialcopygeneric.S"
74
75
76
77
78
79
80
81 .pushsection .text.fixup,"ax"
82 .align 4
83 9001: mov r4, #-EFAULT
84 #ifdef CONFIG_CPU_SW_DOMAIN_PAN
85 ldr r5, [sp, #9*4] @ *err_ptr
86 #else
87 ldr r5, [sp, #8*4] @ *err_ptr
88 #endif
89 str r4, [r5]
90 ldmia sp, {r1, r2} @ retrieve dst, len
91 add r2, r2, r1
92 mov r0, #0 @ zero the buffer
93 9002: teq r2, r1
94 strbne r0, [r1], #1
95 bne 9002b
96 load_regs
97 .popsection