1111#include <asm/cpu.h>
1212#include <asm/regdef.h>
1313
14- .irp to, 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7
15- .L_fixup_handle_ \to\():
16- sub .d a0 , a2 , a0
17- addi .d a0 , a0 , (\to) * (-8)
18- jr ra
19- .endr
20-
21- .irp to, 0 , 2 , 4
22- .L_fixup_handle_s \to\():
23- addi .d a0 , a2 , -\to
24- jr ra
25- .endr
26-
2714SYM_FUNC_START (__copy_user)
2815 /*
2916 * Some CPUs support hardware unaligned access
@@ -54,8 +41,8 @@ SYM_FUNC_START(__copy_user_generic)
54413 : move a0 , a2
5542 jr ra
5643
57- _asm_extable 1b, .L_fixup_handle_s0
58- _asm_extable 2b, .L_fixup_handle_s0
44+ _asm_extable 1b, 3b
45+ _asm_extable 2b, 3b
5946SYM_FUNC_END (__copy_user_generic)
6047
6148/*
@@ -69,10 +56,10 @@ SYM_FUNC_START(__copy_user_fast)
6956 sltui t0, a2 , 9
7057 bnez t0, .Lsmall
7158
72- add .d a3 , a1 , a2
73- add .d a2 , a0 , a2
74590 : ld.d t0, a1 , 0
75601 : st .d t0, a0 , 0
61+ add .d a3 , a1 , a2
62+ add .d a2 , a0 , a2
7663
7764 /* align up destination address */
7865 andi t1, a0 , 7
@@ -94,7 +81,6 @@ SYM_FUNC_START(__copy_user_fast)
94817 : ld.d t5, a1 , 40
95828 : ld.d t6, a1 , 48
96839 : ld.d t7, a1 , 56
97- addi .d a1 , a1 , 64
988410 : st .d t0, a0 , 0
998511 : st .d t1, a0 , 8
1008612 : st .d t2, a0 , 16
@@ -103,6 +89,7 @@ SYM_FUNC_START(__copy_user_fast)
1038915 : st .d t5, a0 , 40
1049016 : st .d t6, a0 , 48
1059117 : st .d t7, a0 , 56
92+ addi .d a1 , a1 , 64
10693 addi .d a0 , a0 , 64
10794 bltu a1 , a4 , .Lloop64
10895
@@ -114,28 +101,29 @@ SYM_FUNC_START(__copy_user_fast)
11410119 : ld.d t1, a1 , 8
11510220 : ld.d t2, a1 , 16
11610321 : ld.d t3, a1 , 24
117- addi .d a1 , a1 , 32
11810422 : st .d t0, a0 , 0
11910523 : st .d t1, a0 , 8
12010624 : st .d t2, a0 , 16
12110725 : st .d t3, a0 , 24
108+ addi .d a1 , a1 , 32
122109 addi .d a0 , a0 , 32
123110
124111.Llt32:
125112 addi .d a4 , a3 , -16
126113 bgeu a1 , a4 , .Llt16
12711426 : ld.d t0, a1 , 0
12811527 : ld.d t1, a1 , 8
129- addi .d a1 , a1 , 16
13011628 : st .d t0, a0 , 0
13111729 : st .d t1, a0 , 8
118+ addi .d a1 , a1 , 16
132119 addi .d a0 , a0 , 16
133120
134121.Llt16:
135122 addi .d a4 , a3 , -8
136123 bgeu a1 , a4 , .Llt8
13712430 : ld.d t0, a1 , 0
13812531 : st .d t0, a0 , 0
126+ addi .d a1 , a1 , 8
139127 addi .d a0 , a0 , 8
140128
141129.Llt8:
@@ -214,62 +202,79 @@ SYM_FUNC_START(__copy_user_fast)
214202 jr ra
215203
216204 /* fixup and ex_table */
217- _asm_extable 0b, .L_fixup_handle_0
218- _asm_extable 1b, .L_fixup_handle_0
219- _asm_extable 2b, .L_fixup_handle_0
220- _asm_extable 3b, .L_fixup_handle_0
221- _asm_extable 4b, .L_fixup_handle_0
222- _asm_extable 5b, .L_fixup_handle_0
223- _asm_extable 6b, .L_fixup_handle_0
224- _asm_extable 7b, .L_fixup_handle_0
225- _asm_extable 8b, .L_fixup_handle_0
226- _asm_extable 9b, .L_fixup_handle_0
227- _asm_extable 10b, .L_fixup_handle_0
228- _asm_extable 11b, .L_fixup_handle_1
229- _asm_extable 12b, .L_fixup_handle_2
230- _asm_extable 13b, .L_fixup_handle_3
231- _asm_extable 14b, .L_fixup_handle_4
232- _asm_extable 15b, .L_fixup_handle_5
233- _asm_extable 16b, .L_fixup_handle_6
234- _asm_extable 17b, .L_fixup_handle_7
235- _asm_extable 18b, .L_fixup_handle_0
236- _asm_extable 19b, .L_fixup_handle_0
237- _asm_extable 20b, .L_fixup_handle_0
238- _asm_extable 21b, .L_fixup_handle_0
239- _asm_extable 22b, .L_fixup_handle_0
240- _asm_extable 23b, .L_fixup_handle_1
241- _asm_extable 24b, .L_fixup_handle_2
242- _asm_extable 25b, .L_fixup_handle_3
243- _asm_extable 26b, .L_fixup_handle_0
244- _asm_extable 27b, .L_fixup_handle_0
245- _asm_extable 28b, .L_fixup_handle_0
246- _asm_extable 29b, .L_fixup_handle_1
247- _asm_extable 30b, .L_fixup_handle_0
248- _asm_extable 31b, .L_fixup_handle_0
249- _asm_extable 32b, .L_fixup_handle_0
250- _asm_extable 33b, .L_fixup_handle_0
251- _asm_extable 34b, .L_fixup_handle_s0
252- _asm_extable 35b, .L_fixup_handle_s0
253- _asm_extable 36b, .L_fixup_handle_s0
254- _asm_extable 37b, .L_fixup_handle_s0
255- _asm_extable 38b, .L_fixup_handle_s0
256- _asm_extable 39b, .L_fixup_handle_s0
257- _asm_extable 40b, .L_fixup_handle_s0
258- _asm_extable 41b, .L_fixup_handle_s2
259- _asm_extable 42b, .L_fixup_handle_s0
260- _asm_extable 43b, .L_fixup_handle_s0
261- _asm_extable 44b, .L_fixup_handle_s0
262- _asm_extable 45b, .L_fixup_handle_s0
263- _asm_extable 46b, .L_fixup_handle_s0
264- _asm_extable 47b, .L_fixup_handle_s4
265- _asm_extable 48b, .L_fixup_handle_s0
266- _asm_extable 49b, .L_fixup_handle_s0
267- _asm_extable 50b, .L_fixup_handle_s0
268- _asm_extable 51b, .L_fixup_handle_s4
269- _asm_extable 52b, .L_fixup_handle_s0
270- _asm_extable 53b, .L_fixup_handle_s0
271- _asm_extable 54b, .L_fixup_handle_s0
272- _asm_extable 55b, .L_fixup_handle_s4
273- _asm_extable 56b, .L_fixup_handle_s0
274- _asm_extable 57b, .L_fixup_handle_s0
205+ .Llarge_fixup:
206+ sub .d a2 , a2 , a0
207+
208+ .Lsmall_fixup:
209+ 58 : ld.b t0, a1 , 0
210+ 59 : st.b t0, a0 , 0
211+ addi .d a0 , a0 , 1
212+ addi .d a1 , a1 , 1
213+ addi .d a2 , a2 , -1
214+ bgt a2 , zero, 58b
215+
216+ .Lexit:
217+ move a0 , a2
218+ jr ra
219+
220+ _asm_extable 0b, .Lsmall_fixup
221+ _asm_extable 1b, .Lsmall_fixup
222+ _asm_extable 2b, .Llarge_fixup
223+ _asm_extable 3b, .Llarge_fixup
224+ _asm_extable 4b, .Llarge_fixup
225+ _asm_extable 5b, .Llarge_fixup
226+ _asm_extable 6b, .Llarge_fixup
227+ _asm_extable 7b, .Llarge_fixup
228+ _asm_extable 8b, .Llarge_fixup
229+ _asm_extable 9b, .Llarge_fixup
230+ _asm_extable 10b, .Llarge_fixup
231+ _asm_extable 11b, .Llarge_fixup
232+ _asm_extable 12b, .Llarge_fixup
233+ _asm_extable 13b, .Llarge_fixup
234+ _asm_extable 14b, .Llarge_fixup
235+ _asm_extable 15b, .Llarge_fixup
236+ _asm_extable 16b, .Llarge_fixup
237+ _asm_extable 17b, .Llarge_fixup
238+ _asm_extable 18b, .Llarge_fixup
239+ _asm_extable 19b, .Llarge_fixup
240+ _asm_extable 20b, .Llarge_fixup
241+ _asm_extable 21b, .Llarge_fixup
242+ _asm_extable 22b, .Llarge_fixup
243+ _asm_extable 23b, .Llarge_fixup
244+ _asm_extable 24b, .Llarge_fixup
245+ _asm_extable 25b, .Llarge_fixup
246+ _asm_extable 26b, .Llarge_fixup
247+ _asm_extable 27b, .Llarge_fixup
248+ _asm_extable 28b, .Llarge_fixup
249+ _asm_extable 29b, .Llarge_fixup
250+ _asm_extable 30b, .Llarge_fixup
251+ _asm_extable 31b, .Llarge_fixup
252+ _asm_extable 32b, .Llarge_fixup
253+ _asm_extable 33b, .Llarge_fixup
254+ _asm_extable 34b, .Lexit
255+ _asm_extable 35b, .Lexit
256+ _asm_extable 36b, .Lsmall_fixup
257+ _asm_extable 37b, .Lsmall_fixup
258+ _asm_extable 38b, .Lsmall_fixup
259+ _asm_extable 39b, .Lsmall_fixup
260+ _asm_extable 40b, .Lsmall_fixup
261+ _asm_extable 41b, .Lsmall_fixup
262+ _asm_extable 42b, .Lsmall_fixup
263+ _asm_extable 43b, .Lsmall_fixup
264+ _asm_extable 44b, .Lsmall_fixup
265+ _asm_extable 45b, .Lsmall_fixup
266+ _asm_extable 46b, .Lsmall_fixup
267+ _asm_extable 47b, .Lsmall_fixup
268+ _asm_extable 48b, .Lsmall_fixup
269+ _asm_extable 49b, .Lsmall_fixup
270+ _asm_extable 50b, .Lsmall_fixup
271+ _asm_extable 51b, .Lsmall_fixup
272+ _asm_extable 52b, .Lsmall_fixup
273+ _asm_extable 53b, .Lsmall_fixup
274+ _asm_extable 54b, .Lsmall_fixup
275+ _asm_extable 55b, .Lsmall_fixup
276+ _asm_extable 56b, .Lsmall_fixup
277+ _asm_extable 57b, .Lsmall_fixup
278+ _asm_extable 58b, .Lexit
279+ _asm_extable 59b, .Lexit
275280SYM_FUNC_END (__copy_user_fast)
0 commit comments