diff options
Diffstat (limited to 'arch/powerpc/boot')
-rw-r--r-- | arch/powerpc/boot/string.S | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/arch/powerpc/boot/string.S b/arch/powerpc/boot/string.S index b1eeaed7db17..ac3d43b6a324 100644 --- a/arch/powerpc/boot/string.S +++ b/arch/powerpc/boot/string.S | |||
@@ -107,10 +107,12 @@ memcpy: | |||
107 | rlwinm. r7,r5,32-3,3,31 /* r7 = r5 >> 3 */ | 107 | rlwinm. r7,r5,32-3,3,31 /* r7 = r5 >> 3 */ |
108 | addi r6,r3,-4 | 108 | addi r6,r3,-4 |
109 | addi r4,r4,-4 | 109 | addi r4,r4,-4 |
110 | beq 2f /* if less than 8 bytes to do */ | 110 | beq 3f /* if less than 8 bytes to do */ |
111 | andi. r0,r6,3 /* get dest word aligned */ | 111 | andi. r0,r6,3 /* get dest word aligned */ |
112 | mtctr r7 | 112 | mtctr r7 |
113 | bne 5f | 113 | bne 5f |
114 | andi. r0,r4,3 /* check src word aligned too */ | ||
115 | bne 3f | ||
114 | 1: lwz r7,4(r4) | 116 | 1: lwz r7,4(r4) |
115 | lwzu r8,8(r4) | 117 | lwzu r8,8(r4) |
116 | stw r7,4(r6) | 118 | stw r7,4(r6) |
@@ -132,6 +134,11 @@ memcpy: | |||
132 | bdnz 4b | 134 | bdnz 4b |
133 | blr | 135 | blr |
134 | 5: subfic r0,r0,4 | 136 | 5: subfic r0,r0,4 |
137 | cmpw cr1,r0,r5 | ||
138 | add r7,r0,r4 | ||
139 | andi. r7,r7,3 /* will source be word-aligned too? */ | ||
140 | ble cr1,3b | ||
141 | bne 3b /* do byte-by-byte if not */ | ||
135 | mtctr r0 | 142 | mtctr r0 |
136 | 6: lbz r7,4(r4) | 143 | 6: lbz r7,4(r4) |
137 | addi r4,r4,1 | 144 | addi r4,r4,1 |
@@ -149,10 +156,12 @@ backwards_memcpy: | |||
149 | rlwinm. r7,r5,32-3,3,31 /* r7 = r5 >> 3 */ | 156 | rlwinm. r7,r5,32-3,3,31 /* r7 = r5 >> 3 */ |
150 | add r6,r3,r5 | 157 | add r6,r3,r5 |
151 | add r4,r4,r5 | 158 | add r4,r4,r5 |
152 | beq 2f | 159 | beq 3f |
153 | andi. r0,r6,3 | 160 | andi. r0,r6,3 |
154 | mtctr r7 | 161 | mtctr r7 |
155 | bne 5f | 162 | bne 5f |
163 | andi. r0,r4,3 | ||
164 | bne 3f | ||
156 | 1: lwz r7,-4(r4) | 165 | 1: lwz r7,-4(r4) |
157 | lwzu r8,-8(r4) | 166 | lwzu r8,-8(r4) |
158 | stw r7,-4(r6) | 167 | stw r7,-4(r6) |
@@ -171,7 +180,12 @@ backwards_memcpy: | |||
171 | stbu r0,-1(r6) | 180 | stbu r0,-1(r6) |
172 | bdnz 4b | 181 | bdnz 4b |
173 | blr | 182 | blr |
174 | 5: mtctr r0 | 183 | 5: cmpw cr1,r0,r5 |
184 | subf r7,r0,r4 | ||
185 | andi. r7,r7,3 | ||
186 | ble cr1,3b | ||
187 | bne 3b | ||
188 | mtctr r0 | ||
175 | 6: lbzu r7,-1(r4) | 189 | 6: lbzu r7,-1(r4) |
176 | stbu r7,-1(r6) | 190 | stbu r7,-1(r6) |
177 | bdnz 6b | 191 | bdnz 6b |