diff options
Diffstat (limited to 'firmware/target/arm/imx31/crt0.S')
-rw-r--r-- | firmware/target/arm/imx31/crt0.S | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/firmware/target/arm/imx31/crt0.S b/firmware/target/arm/imx31/crt0.S index 776699da14..69577e4d3d 100644 --- a/firmware/target/arm/imx31/crt0.S +++ b/firmware/target/arm/imx31/crt0.S | |||
@@ -253,15 +253,6 @@ remap_end: | |||
253 | strhi r4, [r2], #4 | 253 | strhi r4, [r2], #4 |
254 | bhi 1b | 254 | bhi 1b |
255 | 255 | ||
256 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
257 | ldr sp, =stackend | ||
258 | ldr r2, =stackbegin | ||
259 | ldr r3, =0xdeadbeef | ||
260 | 1: | ||
261 | cmp sp, r2 | ||
262 | strhi r3, [r2], #4 | ||
263 | bhi 1b | ||
264 | |||
265 | /* Set up stack for IRQ mode */ | 256 | /* Set up stack for IRQ mode */ |
266 | msr cpsr_c, #0xd2 | 257 | msr cpsr_c, #0xd2 |
267 | ldr sp, =irq_stack | 258 | ldr sp, =irq_stack |
@@ -270,14 +261,25 @@ remap_end: | |||
270 | msr cpsr_c, #0xd1 | 261 | msr cpsr_c, #0xd1 |
271 | ldr sp, =fiq_stack | 262 | ldr sp, =fiq_stack |
272 | 263 | ||
273 | /* Let abort and undefined modes use IRQ stack */ | 264 | /* Let svc, abort and undefined modes use irq stack */ |
265 | msr cpsr_c, #0xd3 | ||
266 | ldr sp, =irq_stack | ||
274 | msr cpsr_c, #0xd7 | 267 | msr cpsr_c, #0xd7 |
275 | ldr sp, =irq_stack | 268 | ldr sp, =irq_stack |
276 | msr cpsr_c, #0xdb | 269 | msr cpsr_c, #0xdb |
277 | ldr sp, =irq_stack | 270 | ldr sp, =irq_stack |
278 | 271 | ||
279 | /* Switch back to supervisor mode */ | 272 | /* Switch to sys mode */ |
280 | msr cpsr_c, #0xd3 | 273 | msr cpsr_c, #0xdf |
274 | |||
275 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
276 | ldr sp, =stackend | ||
277 | ldr r2, =stackbegin | ||
278 | ldr r3, =0xdeadbeef | ||
279 | 1: | ||
280 | cmp sp, r2 | ||
281 | strhi r3, [r2], #4 | ||
282 | bhi 1b | ||
281 | 283 | ||
282 | #ifndef BOOTLOADER | 284 | #ifndef BOOTLOADER |
283 | /* Enable access to VFP */ | 285 | /* Enable access to VFP */ |
@@ -334,11 +336,13 @@ undef_instr_handler: | |||
334 | mov r1, #0 | 336 | mov r1, #0 |
335 | b UIE | 337 | b UIE |
336 | 338 | ||
337 | /* We run supervisor mode most of the time, and should never see a software | 339 | /* We run sys mode most of the time, and should never see a software |
338 | * exception being thrown. Perhaps make it illegal and call UIE? */ | 340 | * exception being thrown. Make it illegal and call UIE. */ |
339 | software_int_handler: | 341 | software_int_handler: |
340 | reserved_handler: | 342 | reserved_handler: |
341 | movs pc, lr | 343 | sub r0, lr, #4 |
344 | mov r1, #4 | ||
345 | b UIE | ||
342 | 346 | ||
343 | prefetch_abort_handler: | 347 | prefetch_abort_handler: |
344 | sub r0, lr, #4 | 348 | sub r0, lr, #4 |