diff options
author | Jens Arnold <amiconn@rockbox.org> | 2009-07-11 23:43:44 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2009-07-11 23:43:44 +0000 |
commit | 47d4c4739bafcb9864dc8d1c2b44903ad4f75b68 (patch) | |
tree | 7a9f510c72a0df2ddacb0f6ec393658cf676b8d4 /firmware/target/arm/ata-as-arm.S | |
parent | fa59ed6ae724b3f75c8ba35efcf7ce18f21e3ed2 (diff) | |
download | rockbox-47d4c4739bafcb9864dc8d1c2b44903ad4f75b68.tar.gz rockbox-47d4c4739bafcb9864dc8d1c2b44903ad4f75b68.zip |
ARM asm LCD and ATA driver functions: Don't save r12 as it is a scratch reg. Saves a bit of stack and execution time.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21795 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/ata-as-arm.S')
-rw-r--r-- | firmware/target/arm/ata-as-arm.S | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/firmware/target/arm/ata-as-arm.S b/firmware/target/arm/ata-as-arm.S index 31b753c421..c1475c0a5a 100644 --- a/firmware/target/arm/ata-as-arm.S +++ b/firmware/target/arm/ata-as-arm.S | |||
@@ -56,11 +56,11 @@ | |||
56 | * r0 - current address | 56 | * r0 - current address |
57 | * r1 - word count | 57 | * r1 - word count |
58 | * r2 - ata port | 58 | * r2 - ata port |
59 | * r3..r6, lr - read buffers | 59 | * r3..r5, r12, lr - read buffers |
60 | */ | 60 | */ |
61 | 61 | ||
62 | copy_read_sectors: | 62 | copy_read_sectors: |
63 | stmfd sp!, {r4, r5, r6, lr} | 63 | stmfd sp!, {r4, r5, lr} |
64 | ldr r2, =.ata_port | 64 | ldr r2, =.ata_port |
65 | tst r0, #1 /* 16 bit aligned? */ | 65 | tst r0, #1 /* 16 bit aligned? */ |
66 | beq .r_aligned | 66 | beq .r_aligned |
@@ -92,16 +92,16 @@ copy_read_sectors: | |||
92 | ldrh r5, [r2] | 92 | ldrh r5, [r2] |
93 | orr r4, r4, r5, lsl #24 | 93 | orr r4, r4, r5, lsl #24 |
94 | mov r5, r5, lsr #8 | 94 | mov r5, r5, lsr #8 |
95 | ldrh r6, [r2] | 95 | ldrh r12, [r2] |
96 | orr r5, r5, r6, lsl #8 | 96 | orr r5, r5, r12, lsl #8 |
97 | ldrh r6, [r2] | 97 | ldrh r12, [r2] |
98 | orr r5, r5, r6, lsl #24 | 98 | orr r5, r5, r12, lsl #24 |
99 | mov r6, r6, lsr #8 | 99 | mov r12, r12, lsr #8 |
100 | ldrh lr, [r2] | 100 | ldrh lr, [r2] |
101 | orr r6, r6, lr, lsl #8 | 101 | orr r12, r12, lr, lsl #8 |
102 | ldrh lr, [r2] | 102 | ldrh lr, [r2] |
103 | orr r6, r6, lr, lsl #24 | 103 | orr r12, r12, lr, lsl #24 |
104 | stmia r0!, {r3, r4, r5, r6} | 104 | stmia r0!, {r3, r4, r5, r12} |
105 | mov r3, lr, lsr #8 | 105 | mov r3, lr, lsr #8 |
106 | subs r1, r1, #8 /* 8 or more halfwords left? */ | 106 | subs r1, r1, #8 /* 8 or more halfwords left? */ |
107 | bge .r_loop_u | 107 | bge .r_loop_u |
@@ -140,7 +140,7 @@ copy_read_sectors: | |||
140 | 140 | ||
141 | strb r3, [r0], #1 /* store final byte */ | 141 | strb r3, [r0], #1 /* store final byte */ |
142 | 142 | ||
143 | ldmfd sp!, {r4, r5, r6, pc} | 143 | ldmfd sp!, {r4, r5, pc} |
144 | 144 | ||
145 | /* 16-bit aligned */ | 145 | /* 16-bit aligned */ |
146 | .r_aligned: | 146 | .r_aligned: |
@@ -158,12 +158,12 @@ copy_read_sectors: | |||
158 | ldrh r5, [r2] | 158 | ldrh r5, [r2] |
159 | orr r4, r4, r5, lsl #16 | 159 | orr r4, r4, r5, lsl #16 |
160 | ldrh r5, [r2] | 160 | ldrh r5, [r2] |
161 | ldrh r6, [r2] | 161 | ldrh r12, [r2] |
162 | orr r5, r5, r6, lsl #16 | 162 | orr r5, r5, r12, lsl #16 |
163 | ldrh r6, [r2] | 163 | ldrh r12, [r2] |
164 | ldrh lr, [r2] | 164 | ldrh lr, [r2] |
165 | orr r6, r6, lr, lsl #16 | 165 | orr r12, r12, lr, lsl #16 |
166 | stmia r0!, {r3, r4, r5, r6} | 166 | stmia r0!, {r3, r4, r5, r12} |
167 | subs r1, r1, #8 /* 8 or more halfwords left? */ | 167 | subs r1, r1, #8 /* 8 or more halfwords left? */ |
168 | bge .r_loop_a | 168 | bge .r_loop_a |
169 | 169 | ||
@@ -189,7 +189,7 @@ copy_read_sectors: | |||
189 | ldrneh r3, [r2] | 189 | ldrneh r3, [r2] |
190 | strneh r3, [r0], #2 | 190 | strneh r3, [r0], #2 |
191 | 191 | ||
192 | ldmfd sp!, {r4, r5, r6, pc} | 192 | ldmfd sp!, {r4, r5, pc} |
193 | 193 | ||
194 | .r_end: | 194 | .r_end: |
195 | .size copy_read_sectors,.r_end-copy_read_sectors | 195 | .size copy_read_sectors,.r_end-copy_read_sectors |
@@ -210,11 +210,11 @@ copy_read_sectors: | |||
210 | * r0 - current address | 210 | * r0 - current address |
211 | * r1 - word count | 211 | * r1 - word count |
212 | * r2 - ata port | 212 | * r2 - ata port |
213 | * r3..r6, lr - read buffers | 213 | * r3..r5, r12, lr - read buffers |
214 | */ | 214 | */ |
215 | 215 | ||
216 | copy_write_sectors: | 216 | copy_write_sectors: |
217 | stmfd sp!, {r4, r5, r6, lr} | 217 | stmfd sp!, {r4, r5, lr} |
218 | ldr r2, =.ata_port | 218 | ldr r2, =.ata_port |
219 | tst r0, #1 /* 16 bit aligned? */ | 219 | tst r0, #1 /* 16 bit aligned? */ |
220 | beq .w_aligned | 220 | beq .w_aligned |
@@ -234,7 +234,7 @@ copy_write_sectors: | |||
234 | 234 | ||
235 | sub r1, r1, #8 /* adjust for zero-check and doing 8 halfwords/loop */ | 235 | sub r1, r1, #8 /* adjust for zero-check and doing 8 halfwords/loop */ |
236 | .w_loop_u: | 236 | .w_loop_u: |
237 | ldmia r0!, {r4, r5, r6, lr} | 237 | ldmia r0!, {r4, r5, r12, lr} |
238 | orr r3, r3, r4, lsl #8 /* Load 4 words at once and decompose them */ | 238 | orr r3, r3, r4, lsl #8 /* Load 4 words at once and decompose them */ |
239 | strh r3, [r2] /* into 8 halfwords in a way that the words */ | 239 | strh r3, [r2] /* into 8 halfwords in a way that the words */ |
240 | mov r3, r3, lsr #16 /* are shifted by 8 bits, putting the high */ | 240 | mov r3, r3, lsr #16 /* are shifted by 8 bits, putting the high */ |
@@ -245,15 +245,15 @@ copy_write_sectors: | |||
245 | mov r4, r4, lsr #16 | 245 | mov r4, r4, lsr #16 |
246 | strh r4, [r2] | 246 | strh r4, [r2] |
247 | mov r5, r5, lsr #24 | 247 | mov r5, r5, lsr #24 |
248 | orr r5, r5, r6, lsl #8 | 248 | orr r5, r5, r12, lsl #8 |
249 | strh r5, [r2] | 249 | strh r5, [r2] |
250 | mov r5, r5, lsr #16 | 250 | mov r5, r5, lsr #16 |
251 | strh r5, [r2] | 251 | strh r5, [r2] |
252 | mov r6, r6, lsr #24 | 252 | mov r12, r12, lsr #24 |
253 | orr r6, r6, lr, lsl #8 | 253 | orr r12, r12, lr, lsl #8 |
254 | strh r6, [r2] | 254 | strh r12, [r2] |
255 | mov r6, r6, lsr #16 | 255 | mov r12, r12, lsr #16 |
256 | strh r6, [r2] | 256 | strh r12, [r2] |
257 | mov r3, lr, lsr #24 | 257 | mov r3, lr, lsr #24 |
258 | subs r1, r1, #8 /* 8 or more halfwords left? */ | 258 | subs r1, r1, #8 /* 8 or more halfwords left? */ |
259 | bge .w_loop_u | 259 | bge .w_loop_u |
@@ -294,7 +294,7 @@ copy_write_sectors: | |||
294 | orr r3, r3, r4, lsl #8 | 294 | orr r3, r3, r4, lsl #8 |
295 | strh r3, [r2] /* write final halfword */ | 295 | strh r3, [r2] /* write final halfword */ |
296 | 296 | ||
297 | ldmfd sp!, {r4, r5, r6, pc} | 297 | ldmfd sp!, {r4, r5, pc} |
298 | 298 | ||
299 | /* 16-bit aligned */ | 299 | /* 16-bit aligned */ |
300 | .w_aligned: | 300 | .w_aligned: |
@@ -305,7 +305,7 @@ copy_write_sectors: | |||
305 | 305 | ||
306 | sub r1, r1, #8 /* adjust for zero-check and doing 8 halfwords/loop */ | 306 | sub r1, r1, #8 /* adjust for zero-check and doing 8 halfwords/loop */ |
307 | .w_loop_a: | 307 | .w_loop_a: |
308 | ldmia r0!, {r3, r4, r5, r6} | 308 | ldmia r0!, {r3, r4, r5, r12} |
309 | strh r3, [r2] /* Load 4 words and decompose them into */ | 309 | strh r3, [r2] /* Load 4 words and decompose them into */ |
310 | mov r3, r3, lsr #16 /* 2 halfwords each, and write those. */ | 310 | mov r3, r3, lsr #16 /* 2 halfwords each, and write those. */ |
311 | strh r3, [r2] | 311 | strh r3, [r2] |
@@ -315,9 +315,9 @@ copy_write_sectors: | |||
315 | strh r5, [r2] | 315 | strh r5, [r2] |
316 | mov r5, r5, lsr #16 | 316 | mov r5, r5, lsr #16 |
317 | strh r5, [r2] | 317 | strh r5, [r2] |
318 | strh r6, [r2] | 318 | strh r12, [r2] |
319 | mov r6, r6, lsr #16 | 319 | mov r12, r12, lsr #16 |
320 | strh r6, [r2] | 320 | strh r12, [r2] |
321 | subs r1, r1, #8 /* 8 or more halfwords left? */ | 321 | subs r1, r1, #8 /* 8 or more halfwords left? */ |
322 | bge .w_loop_a | 322 | bge .w_loop_a |
323 | 323 | ||
@@ -343,7 +343,7 @@ copy_write_sectors: | |||
343 | ldrneh r3, [r0], #2 | 343 | ldrneh r3, [r0], #2 |
344 | strneh r3, [r2] | 344 | strneh r3, [r2] |
345 | 345 | ||
346 | ldmfd sp!, {r4, r5, r6, pc} | 346 | ldmfd sp!, {r4, r5, pc} |
347 | 347 | ||
348 | .w_end: | 348 | .w_end: |
349 | .size copy_write_sectors,.w_end-copy_write_sectors | 349 | .size copy_write_sectors,.w_end-copy_write_sectors |