diff options
Diffstat (limited to 'firmware/target/arm/s3c2440/crt0.S')
-rw-r--r-- | firmware/target/arm/s3c2440/crt0.S | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/firmware/target/arm/s3c2440/crt0.S b/firmware/target/arm/s3c2440/crt0.S index faa54313e7..8cbd8ab91e 100644 --- a/firmware/target/arm/s3c2440/crt0.S +++ b/firmware/target/arm/s3c2440/crt0.S | |||
@@ -527,32 +527,34 @@ bsszero: | |||
527 | cmp r3, r2 | 527 | cmp r3, r2 |
528 | strhi r4, [r2], #4 | 528 | strhi r4, [r2], #4 |
529 | bhi bsszero | 529 | bhi bsszero |
530 | |||
531 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
532 | ldr sp, =stackend | ||
533 | mov r3, sp | ||
534 | ldr r2, =stackbegin | ||
535 | ldr r4, =0xdeadbeef | ||
536 | stackmunge: | ||
537 | cmp r3, r2 | ||
538 | strhi r4, [r2], #4 | ||
539 | bhi stackmunge | ||
540 | 530 | ||
541 | /* Set up stack for IRQ mode */ | 531 | /* Set up stack for IRQ mode */ |
542 | msr cpsr_c, #0xd2 | 532 | msr cpsr_c, #0xd2 |
543 | ldr sp, =irq_stack | 533 | ldr sp, =irq_stack |
544 | /* Set up stack for FIQ mode */ | 534 | /* Set up stack for FIQ mode */ |
545 | msr cpsr_c, #0xd1 | 535 | msr cpsr_c, #0xd1 |
546 | ldr sp, =fiq_stack | 536 | ldr sp, =fiq_stack |
547 | 537 | ||
548 | /* Let abort and undefined modes use IRQ stack */ | 538 | /* Let svc, abort and undefined modes use irq stack */ |
539 | msr cpsr_c, #0xd3 | ||
540 | ldr sp, =irq_stack | ||
549 | msr cpsr_c, #0xd7 | 541 | msr cpsr_c, #0xd7 |
550 | ldr sp, =irq_stack | 542 | ldr sp, =irq_stack |
551 | msr cpsr_c, #0xdb | 543 | msr cpsr_c, #0xdb |
552 | ldr sp, =irq_stack | 544 | ldr sp, =irq_stack |
553 | /* Switch to supervisor mode */ | 545 | |
554 | msr cpsr_c, #0xd3 | 546 | /* Switch to sys mode */ |
547 | msr cpsr_c, #0xdf | ||
548 | |||
549 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
555 | ldr sp, =stackend | 550 | ldr sp, =stackend |
551 | mov r3, sp | ||
552 | ldr r2, =stackbegin | ||
553 | ldr r4, =0xdeadbeef | ||
554 | stackmunge: | ||
555 | cmp r3, r2 | ||
556 | strhi r4, [r2], #4 | ||
557 | bhi stackmunge | ||
556 | 558 | ||
557 | /* Start the main function */ | 559 | /* Start the main function */ |
558 | ldr lr, =vectors | 560 | ldr lr, =vectors |
@@ -573,12 +575,14 @@ undef_instr_handler: | |||
573 | mov r1, #0 | 575 | mov r1, #0 |
574 | b UIE | 576 | b UIE |
575 | 577 | ||
576 | /* We run supervisor mode most of the time, and should never see a software | 578 | /* We run sys mode most of the time, and should never see a software |
577 | exception being thrown. Perhaps make it illegal and call UIE? | 579 | exception being thrown. Make it illegal and call UIE. |
578 | */ | 580 | */ |
579 | software_int_handler: | 581 | software_int_handler: |
580 | reserved_handler: | 582 | reserved_handler: |
581 | movs pc, lr | 583 | sub r0, lr, #4 |
584 | mov r1, #4 | ||
585 | b UIE | ||
582 | 586 | ||
583 | prefetch_abort_handler: | 587 | prefetch_abort_handler: |
584 | sub r0, lr, #4 | 588 | sub r0, lr, #4 |
@@ -749,4 +753,3 @@ irq_stack: | |||
749 | /* 256 words of FIQ stack */ | 753 | /* 256 words of FIQ stack */ |
750 | .space 256*4 | 754 | .space 256*4 |
751 | fiq_stack: | 755 | fiq_stack: |
752 | |||