diff options
Diffstat (limited to 'arch/ppc/boot/common/string.S')
-rw-r--r-- | arch/ppc/boot/common/string.S | 150 |
1 files changed, 0 insertions, 150 deletions
diff --git a/arch/ppc/boot/common/string.S b/arch/ppc/boot/common/string.S deleted file mode 100644 index 8016e43c4771..000000000000 --- a/arch/ppc/boot/common/string.S +++ /dev/null | |||
@@ -1,150 +0,0 @@ | |||
1 | /* | ||
2 | * String handling functions for PowerPC. | ||
3 | * | ||
4 | * Copyright (C) 1996 Paul Mackerras. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | #define r0 0 | ||
12 | #define r3 3 | ||
13 | #define r4 4 | ||
14 | #define r5 5 | ||
15 | #define r6 6 | ||
16 | #define r7 7 | ||
17 | #define r8 8 | ||
18 | |||
19 | .globl strlen | ||
20 | strlen: | ||
21 | addi r4,r3,-1 | ||
22 | 1: lbzu r0,1(r4) | ||
23 | cmpwi 0,r0,0 | ||
24 | bne 1b | ||
25 | subf r3,r3,r4 | ||
26 | blr | ||
27 | |||
28 | .globl memset | ||
29 | memset: | ||
30 | rlwimi r4,r4,8,16,23 | ||
31 | rlwimi r4,r4,16,0,15 | ||
32 | addi r6,r3,-4 | ||
33 | cmplwi 0,r5,4 | ||
34 | blt 7f | ||
35 | stwu r4,4(r6) | ||
36 | beqlr | ||
37 | andi. r0,r6,3 | ||
38 | add r5,r0,r5 | ||
39 | subf r6,r0,r6 | ||
40 | rlwinm r0,r5,32-2,2,31 | ||
41 | mtctr r0 | ||
42 | bdz 6f | ||
43 | 1: stwu r4,4(r6) | ||
44 | bdnz 1b | ||
45 | 6: andi. r5,r5,3 | ||
46 | 7: cmpwi 0,r5,0 | ||
47 | beqlr | ||
48 | mtctr r5 | ||
49 | addi r6,r6,3 | ||
50 | 8: stbu r4,1(r6) | ||
51 | bdnz 8b | ||
52 | blr | ||
53 | |||
54 | .globl memmove | ||
55 | memmove: | ||
56 | cmplw 0,r3,r4 | ||
57 | bgt backwards_memcpy | ||
58 | /* fall through */ | ||
59 | |||
60 | .globl memcpy | ||
61 | memcpy: | ||
62 | rlwinm. r7,r5,32-3,3,31 /* r0 = r5 >> 3 */ | ||
63 | addi r6,r3,-4 | ||
64 | addi r4,r4,-4 | ||
65 | beq 2f /* if less than 8 bytes to do */ | ||
66 | andi. r0,r6,3 /* get dest word aligned */ | ||
67 | mtctr r7 | ||
68 | bne 5f | ||
69 | 1: lwz r7,4(r4) | ||
70 | lwzu r8,8(r4) | ||
71 | stw r7,4(r6) | ||
72 | stwu r8,8(r6) | ||
73 | bdnz 1b | ||
74 | andi. r5,r5,7 | ||
75 | 2: cmplwi 0,r5,4 | ||
76 | blt 3f | ||
77 | lwzu r0,4(r4) | ||
78 | addi r5,r5,-4 | ||
79 | stwu r0,4(r6) | ||
80 | 3: cmpwi 0,r5,0 | ||
81 | beqlr | ||
82 | mtctr r5 | ||
83 | addi r4,r4,3 | ||
84 | addi r6,r6,3 | ||
85 | 4: lbzu r0,1(r4) | ||
86 | stbu r0,1(r6) | ||
87 | bdnz 4b | ||
88 | blr | ||
89 | 5: subfic r0,r0,4 | ||
90 | mtctr r0 | ||
91 | 6: lbz r7,4(r4) | ||
92 | addi r4,r4,1 | ||
93 | stb r7,4(r6) | ||
94 | addi r6,r6,1 | ||
95 | bdnz 6b | ||
96 | subf r5,r0,r5 | ||
97 | rlwinm. r7,r5,32-3,3,31 | ||
98 | beq 2b | ||
99 | mtctr r7 | ||
100 | b 1b | ||
101 | |||
102 | .globl backwards_memcpy | ||
103 | backwards_memcpy: | ||
104 | rlwinm. r7,r5,32-3,3,31 /* r0 = r5 >> 3 */ | ||
105 | add r6,r3,r5 | ||
106 | add r4,r4,r5 | ||
107 | beq 2f | ||
108 | andi. r0,r6,3 | ||
109 | mtctr r7 | ||
110 | bne 5f | ||
111 | 1: lwz r7,-4(r4) | ||
112 | lwzu r8,-8(r4) | ||
113 | stw r7,-4(r6) | ||
114 | stwu r8,-8(r6) | ||
115 | bdnz 1b | ||
116 | andi. r5,r5,7 | ||
117 | 2: cmplwi 0,r5,4 | ||
118 | blt 3f | ||
119 | lwzu r0,-4(r4) | ||
120 | subi r5,r5,4 | ||
121 | stwu r0,-4(r6) | ||
122 | 3: cmpwi 0,r5,0 | ||
123 | beqlr | ||
124 | mtctr r5 | ||
125 | 4: lbzu r0,-1(r4) | ||
126 | stbu r0,-1(r6) | ||
127 | bdnz 4b | ||
128 | blr | ||
129 | 5: mtctr r0 | ||
130 | 6: lbzu r7,-1(r4) | ||
131 | stbu r7,-1(r6) | ||
132 | bdnz 6b | ||
133 | subf r5,r0,r5 | ||
134 | rlwinm. r7,r5,32-3,3,31 | ||
135 | beq 2b | ||
136 | mtctr r7 | ||
137 | b 1b | ||
138 | |||
139 | .globl memcmp | ||
140 | memcmp: | ||
141 | cmpwi 0,r5,0 | ||
142 | blelr | ||
143 | mtctr r5 | ||
144 | addi r6,r3,-1 | ||
145 | addi r4,r4,-1 | ||
146 | 1: lbzu r3,1(r6) | ||
147 | lbzu r0,1(r4) | ||
148 | subf. r3,r0,r3 | ||
149 | bdnzt 2,1b | ||
150 | blr | ||