1
2
3
4
5
6
7 #include <asm/ppc_asm.h>
8 #include <asm/export.h>
9 #include <asm/cache.h>
10
11 .text
12
13
14
15 _GLOBAL(strncpy)
16 PPC_LCMPI 0,r5,0
17 beqlr
18 mtctr r5
19 addi r6,r3,-1
20 addi r4,r4,-1
21 .balign IFETCH_ALIGN_BYTES
22 1: lbzu r0,1(r4)
23 cmpwi 0,r0,0
24 stbu r0,1(r6)
25 bdnzf 2,1b
26 bnelr
27 mfctr r5
28 PPC_LCMPI 0,r5,0
29 beqlr
30 2: stbu r0,1(r6)
31 bdnz 2b
32 blr
33 EXPORT_SYMBOL(strncpy)
34
35 _GLOBAL(strncmp)
36 PPC_LCMPI 0,r5,0
37 beq- 2f
38 mtctr r5
39 addi r5,r3,-1
40 addi r4,r4,-1
41 .balign IFETCH_ALIGN_BYTES
42 1: lbzu r3,1(r5)
43 cmpwi 1,r3,0
44 lbzu r0,1(r4)
45 subf. r3,r0,r3
46 beqlr 1
47 bdnzt eq,1b
48 blr
49 2: li r3,0
50 blr
51 EXPORT_SYMBOL(strncmp)
52
53 _GLOBAL(memchr)
54 PPC_LCMPI 0,r5,0
55 beq- 2f
56 mtctr r5
57 addi r3,r3,-1
58 .balign IFETCH_ALIGN_BYTES
59 1: lbzu r0,1(r3)
60 cmpw 0,r0,r4
61 bdnzf 2,1b
62 beqlr
63 2: li r3,0
64 blr
65 EXPORT_SYMBOL(memchr)