1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 .text
39
40#include <asm/assembly.h>
41#include <asm/errno.h>
42#include <linux/linkage.h>
43
44
45
46
47
48
49
50 .macro get_sr
51 mfctl %cr30,%r1
52 ldw TI_SEGMENT(%r1),%r22
53 mfsp %sr3,%r1
54 or,<> %r22,%r0,%r0
55 copy %r0,%r1
56 mtsp %r1,%sr1
57 .endm
58
59
60
61
62
63
64
65
66ENTRY_CFI(lclear_user)
67 .proc
68 .callinfo NO_CALLS
69 .entry
70 comib,=,n 0,%r25,$lclu_done
71 get_sr
72$lclu_loop:
73 addib,<> -1,%r25,$lclu_loop
741: stbs,ma %r0,1(%sr1,%r26)
75
76$lclu_done:
77 bv %r0(%r2)
78 copy %r25,%r28
79
802: b $lclu_done
81 ldo 1(%r25),%r25
82
83 ASM_EXCEPTIONTABLE_ENTRY(1b,2b)
84
85 .exit
86ENDPROC_CFI(lclear_user)
87
88
89 .procend
90
91
92
93
94
95
96
97
98
99ENTRY_CFI(lstrnlen_user)
100 .proc
101 .callinfo NO_CALLS
102 .entry
103 comib,= 0,%r25,$lslen_nzero
104 copy %r26,%r24
105 get_sr
1061: ldbs,ma 1(%sr1,%r26),%r1
107$lslen_loop:
108 comib,=,n 0,%r1,$lslen_done
109 addib,<> -1,%r25,$lslen_loop
1102: ldbs,ma 1(%sr1,%r26),%r1
111$lslen_done:
112 bv %r0(%r2)
113 sub %r26,%r24,%r28
114 .exit
115
116$lslen_nzero:
117 b $lslen_done
118 ldo 1(%r26),%r26
119
1203: b $lslen_done
121 copy %r24,%r26
122
123 ASM_EXCEPTIONTABLE_ENTRY(1b,3b)
124 ASM_EXCEPTIONTABLE_ENTRY(2b,3b)
125
126ENDPROC_CFI(lstrnlen_user)
127
128 .procend
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167 dst = arg0
168 src = arg1
169 len = arg2
170 end = arg3
171 t1 = r19
172 t2 = r20
173 t3 = r21
174 t4 = r22
175 srcspc = sr1
176 dstspc = sr2
177
178 t0 = r1
179 a1 = t1
180 a2 = t2
181 a3 = t3
182 a0 = t4
183
184 save_src = ret0
185 save_dst = ret1
186 save_len = r31
187
188ENTRY_CFI(pa_memcpy)
189 .proc
190 .callinfo NO_CALLS
191 .entry
192
193
194 add dst,len,end
195
196
197 cmpib,COND(>>=),n 15,len,.Lbyte_loop
198
199
200 xor src,dst,t0
201 extru t0,31,2,t1
202 cmpib,<>,n 0,t1,.Lunaligned_copy
203
204#ifdef CONFIG_64BIT
205
206 extru t0,31,3,t1
207 cmpib,<>,n 0,t1,.Lalign_loop32
208
209
210.Lalign_loop64:
211 extru dst,31,3,t1
212 cmpib,=,n 0,t1,.Lcopy_loop_16_start
21320: ldb,ma 1(srcspc,src),t1
21421: stb,ma t1,1(dstspc,dst)
215 b .Lalign_loop64
216 ldo -1(len),len
217
218 ASM_EXCEPTIONTABLE_ENTRY(20b,.Lcopy_done)
219 ASM_EXCEPTIONTABLE_ENTRY(21b,.Lcopy_done)
220
221.Lcopy_loop_16_start:
222 ldi 31,t0
223.Lcopy_loop_16:
224 cmpb,COND(>>=),n t0,len,.Lword_loop
225
22610: ldd 0(srcspc,src),t1
22711: ldd 8(srcspc,src),t2
228 ldo 16(src),src
22912: std,ma t1,8(dstspc,dst)
23013: std,ma t2,8(dstspc,dst)
23114: ldd 0(srcspc,src),t1
23215: ldd 8(srcspc,src),t2
233 ldo 16(src),src
23416: std,ma t1,8(dstspc,dst)
23517: std,ma t2,8(dstspc,dst)
236
237 ASM_EXCEPTIONTABLE_ENTRY(10b,.Lcopy_done)
238 ASM_EXCEPTIONTABLE_ENTRY(11b,.Lcopy16_fault)
239 ASM_EXCEPTIONTABLE_ENTRY(12b,.Lcopy_done)
240 ASM_EXCEPTIONTABLE_ENTRY(13b,.Lcopy_done)
241 ASM_EXCEPTIONTABLE_ENTRY(14b,.Lcopy_done)
242 ASM_EXCEPTIONTABLE_ENTRY(15b,.Lcopy16_fault)
243 ASM_EXCEPTIONTABLE_ENTRY(16b,.Lcopy_done)
244 ASM_EXCEPTIONTABLE_ENTRY(17b,.Lcopy_done)
245
246 b .Lcopy_loop_16
247 ldo -32(len),len
248
249.Lword_loop:
250 cmpib,COND(>>=),n 3,len,.Lbyte_loop
25120: ldw,ma 4(srcspc,src),t1
25221: stw,ma t1,4(dstspc,dst)
253 b .Lword_loop
254 ldo -4(len),len
255
256 ASM_EXCEPTIONTABLE_ENTRY(20b,.Lcopy_done)
257 ASM_EXCEPTIONTABLE_ENTRY(21b,.Lcopy_done)
258
259#endif
260
261
262.Lalign_loop32:
263 extru dst,31,2,t1
264 cmpib,=,n 0,t1,.Lcopy_loop_8
26520: ldb,ma 1(srcspc,src),t1
26621: stb,ma t1,1(dstspc,dst)
267 b .Lalign_loop32
268 ldo -1(len),len
269
270 ASM_EXCEPTIONTABLE_ENTRY(20b,.Lcopy_done)
271 ASM_EXCEPTIONTABLE_ENTRY(21b,.Lcopy_done)
272
273
274.Lcopy_loop_8:
275 cmpib,COND(>>=),n 15,len,.Lbyte_loop
276
27710: ldw 0(srcspc,src),t1
27811: ldw 4(srcspc,src),t2
27912: stw,ma t1,4(dstspc,dst)
28013: stw,ma t2,4(dstspc,dst)
28114: ldw 8(srcspc,src),t1
28215: ldw 12(srcspc,src),t2
283 ldo 16(src),src
28416: stw,ma t1,4(dstspc,dst)
28517: stw,ma t2,4(dstspc,dst)
286
287 ASM_EXCEPTIONTABLE_ENTRY(10b,.Lcopy_done)
288 ASM_EXCEPTIONTABLE_ENTRY(11b,.Lcopy8_fault)
289 ASM_EXCEPTIONTABLE_ENTRY(12b,.Lcopy_done)
290 ASM_EXCEPTIONTABLE_ENTRY(13b,.Lcopy_done)
291 ASM_EXCEPTIONTABLE_ENTRY(14b,.Lcopy_done)
292 ASM_EXCEPTIONTABLE_ENTRY(15b,.Lcopy8_fault)
293 ASM_EXCEPTIONTABLE_ENTRY(16b,.Lcopy_done)
294 ASM_EXCEPTIONTABLE_ENTRY(17b,.Lcopy_done)
295
296 b .Lcopy_loop_8
297 ldo -16(len),len
298
299.Lbyte_loop:
300 cmpclr,COND(<>) len,%r0,%r0
301 b,n .Lcopy_done
30220: ldb 0(srcspc,src),t1
303 ldo 1(src),src
30421: stb,ma t1,1(dstspc,dst)
305 b .Lbyte_loop
306 ldo -1(len),len
307
308 ASM_EXCEPTIONTABLE_ENTRY(20b,.Lcopy_done)
309 ASM_EXCEPTIONTABLE_ENTRY(21b,.Lcopy_done)
310
311.Lcopy_done:
312 bv %r0(%r2)
313 sub end,dst,ret0
314
315
316
317
318.Lunaligned_copy:
319
320 extru dst,31,2,t1
321 cmpib,=,n 0,t1,.Lcopy_dstaligned
32220: ldb 0(srcspc,src),t1
323 ldo 1(src),src
32421: stb,ma t1,1(dstspc,dst)
325 b .Lunaligned_copy
326 ldo -1(len),len
327
328 ASM_EXCEPTIONTABLE_ENTRY(20b,.Lcopy_done)
329 ASM_EXCEPTIONTABLE_ENTRY(21b,.Lcopy_done)
330
331.Lcopy_dstaligned:
332
333
334 copy src,save_src
335 copy dst,save_dst
336 copy len,save_len
337
338
339 SHRREG len,2,len
340
341
342
343
344
345
346 depw,z src,28,2,t0
347 subi 32,t0,t0
348 mtsar t0
349 extru len,31,2,t0
350 cmpib,= 2,t0,.Lcase2
351
352 depi 0,31,2,src
353
354 cmpiclr,<> 3,t0,%r0
355 b,n .Lcase3
356 cmpiclr,<> 1,t0,%r0
357 b,n .Lcase1
358.Lcase0:
359 cmpb,COND(=) %r0,len,.Lcda_finish
360 nop
361
3621: ldw,ma 4(srcspc,src), a3
363 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)
3641: ldw,ma 4(srcspc,src), a0
365 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)
366 b,n .Ldo3
367.Lcase1:
3681: ldw,ma 4(srcspc,src), a2
369 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)
3701: ldw,ma 4(srcspc,src), a3
371 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)
372 ldo -1(len),len
373 cmpb,COND(=),n %r0,len,.Ldo0
374.Ldo4:
3751: ldw,ma 4(srcspc,src), a0
376 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)
377 shrpw a2, a3, %sar, t0
3781: stw,ma t0, 4(dstspc,dst)
379 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcopy_done)
380.Ldo3:
3811: ldw,ma 4(srcspc,src), a1
382 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)
383 shrpw a3, a0, %sar, t0
3841: stw,ma t0, 4(dstspc,dst)
385 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcopy_done)
386.Ldo2:
3871: ldw,ma 4(srcspc,src), a2
388 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)
389 shrpw a0, a1, %sar, t0
3901: stw,ma t0, 4(dstspc,dst)
391 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcopy_done)
392.Ldo1:
3931: ldw,ma 4(srcspc,src), a3
394 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)
395 shrpw a1, a2, %sar, t0
3961: stw,ma t0, 4(dstspc,dst)
397 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcopy_done)
398 ldo -4(len),len
399 cmpb,COND(<>) %r0,len,.Ldo4
400 nop
401.Ldo0:
402 shrpw a2, a3, %sar, t0
4031: stw,ma t0, 4(dstspc,dst)
404 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcopy_done)
405
406.Lcda_rdfault:
407.Lcda_finish:
408
409 sub dst,save_dst,t0
410 add save_src,t0,src
411 b .Lbyte_loop
412 sub save_len,t0,len
413
414.Lcase3:
4151: ldw,ma 4(srcspc,src), a0
416 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)
4171: ldw,ma 4(srcspc,src), a1
418 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)
419 b .Ldo2
420 ldo 1(len),len
421.Lcase2:
4221: ldw,ma 4(srcspc,src), a1
423 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)
4241: ldw,ma 4(srcspc,src), a2
425 ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)
426 b .Ldo1
427 ldo 2(len),len
428
429
430
431#ifdef CONFIG_64BIT
432.Lcopy16_fault:
433 b .Lcopy_done
43410: std,ma t1,8(dstspc,dst)
435 ASM_EXCEPTIONTABLE_ENTRY(10b,.Lcopy_done)
436#endif
437
438.Lcopy8_fault:
439 b .Lcopy_done
44010: stw,ma t1,4(dstspc,dst)
441 ASM_EXCEPTIONTABLE_ENTRY(10b,.Lcopy_done)
442
443 .exit
444ENDPROC_CFI(pa_memcpy)
445 .procend
446
447 .end
448