1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#include <linux/linkage.h>
16#include <asm/errno.h>
17#include <asm/cache.h>
18#include <arch/chip.h>
19
20
21
22
23
24
25
26
27STD_ENTRY(strnlen_user_asm)
28 { beqz r1, 2f; addi r3, r0, -1 }
291: { ld1u r4, r0; addi r1, r1, -1 }
30 beqz r4, 2f
31 { bnezt r1, 1b; addi r0, r0, 1 }
322: { sub r0, r0, r3; jrp lr }
33 STD_ENDPROC(strnlen_user_asm)
34 .pushsection .fixup,"ax"
35strnlen_user_fault:
36 { move r0, zero; jrp lr }
37 ENDPROC(strnlen_user_fault)
38 .section __ex_table,"a"
39 .align 8
40 .quad 1b, strnlen_user_fault
41 .popsection
42
43
44
45
46
47
48
49STD_ENTRY(strncpy_from_user_asm)
50 { beqz r2, 2f; move r3, r0 }
511: { ld1u r4, r1; addi r1, r1, 1; addi r2, r2, -1 }
52 { st1 r0, r4; addi r0, r0, 1 }
53 beqz r4, 2f
54 bnezt r2, 1b
55 { sub r0, r0, r3; jrp lr }
562: addi r0, r0, -1
57 { sub r0, r0, r3; jrp lr }
58 STD_ENDPROC(strncpy_from_user_asm)
59 .pushsection .fixup,"ax"
60strncpy_from_user_fault:
61 { movei r0, -EFAULT; jrp lr }
62 ENDPROC(strncpy_from_user_fault)
63 .section __ex_table,"a"
64 .align 8
65 .quad 1b, strncpy_from_user_fault
66 .popsection
67
68
69
70
71
72
73
74
75STD_ENTRY(clear_user_asm)
76 { beqz r1, 2f; or r2, r0, r1 }
77 andi r2, r2, 7
78 beqzt r2, .Lclear_aligned_user_asm
791: { st1 r0, zero; addi r0, r0, 1; addi r1, r1, -1 }
80 bnezt r1, 1b
812: { move r0, r1; jrp lr }
82 .pushsection __ex_table,"a"
83 .align 8
84 .quad 1b, 2b
85 .popsection
86
87.Lclear_aligned_user_asm:
881: { st r0, zero; addi r0, r0, 8; addi r1, r1, -8 }
89 bnezt r1, 1b
902: { move r0, r1; jrp lr }
91 STD_ENDPROC(clear_user_asm)
92 .pushsection __ex_table,"a"
93 .align 8
94 .quad 1b, 2b
95 .popsection
96
97
98
99
100
101
102STD_ENTRY(flush_user_asm)
103 beqz r1, 2f
104 { movei r2, L2_CACHE_BYTES; add r1, r0, r1 }
105 { sub r2, zero, r2; addi r1, r1, L2_CACHE_BYTES-1 }
106 { and r0, r0, r2; and r1, r1, r2 }
107 { sub r1, r1, r0 }
1081: { flush r0; addi r1, r1, -CHIP_FLUSH_STRIDE() }
109 { addi r0, r0, CHIP_FLUSH_STRIDE(); bnezt r1, 1b }
1102: { move r0, r1; jrp lr }
111 STD_ENDPROC(flush_user_asm)
112 .pushsection __ex_table,"a"
113 .align 8
114 .quad 1b, 2b
115 .popsection
116
117
118
119
120
121
122STD_ENTRY(finv_user_asm)
123 beqz r1, 2f
124 { movei r2, L2_CACHE_BYTES; add r1, r0, r1 }
125 { sub r2, zero, r2; addi r1, r1, L2_CACHE_BYTES-1 }
126 { and r0, r0, r2; and r1, r1, r2 }
127 { sub r1, r1, r0 }
1281: { finv r0; addi r1, r1, -CHIP_FINV_STRIDE() }
129 { addi r0, r0, CHIP_FINV_STRIDE(); bnezt r1, 1b }
1302: { move r0, r1; jrp lr }
131 STD_ENDPROC(finv_user_asm)
132 .pushsection __ex_table,"a"
133 .align 8
134 .quad 1b, 2b
135 .popsection
136