diff options
Diffstat (limited to 'firmware/target/arm/imx233/crt0.S')
-rw-r--r-- | firmware/target/arm/imx233/crt0.S | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/firmware/target/arm/imx233/crt0.S b/firmware/target/arm/imx233/crt0.S index abbff5816a..4ae083ccb2 100644 --- a/firmware/target/arm/imx233/crt0.S +++ b/firmware/target/arm/imx233/crt0.S | |||
@@ -126,15 +126,6 @@ remap: | |||
126 | strhi r4, [r2], #4 | 126 | strhi r4, [r2], #4 |
127 | bhi 1b | 127 | bhi 1b |
128 | 128 | ||
129 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
130 | ldr sp, =stackend | ||
131 | ldr r2, =stackbegin | ||
132 | ldr r3, =0xdeadbeef | ||
133 | 1: | ||
134 | cmp sp, r2 | ||
135 | strhi r3, [r2], #4 | ||
136 | bhi 1b | ||
137 | |||
138 | /* Set up stack for IRQ mode */ | 129 | /* Set up stack for IRQ mode */ |
139 | msr cpsr_c, #0xd2 | 130 | msr cpsr_c, #0xd2 |
140 | ldr sp, =irq_stack | 131 | ldr sp, =irq_stack |
@@ -143,14 +134,25 @@ remap: | |||
143 | msr cpsr_c, #0xd1 | 134 | msr cpsr_c, #0xd1 |
144 | ldr sp, =fiq_stack | 135 | ldr sp, =fiq_stack |
145 | 136 | ||
146 | /* Let abort and undefined modes use IRQ stack */ | 137 | /* Let svc, abort and undefined modes use irq stack */ |
138 | msr cpsr_c, #0xd3 | ||
139 | ldr sp, =irq_stack | ||
147 | msr cpsr_c, #0xd7 | 140 | msr cpsr_c, #0xd7 |
148 | ldr sp, =irq_stack | 141 | ldr sp, =irq_stack |
149 | msr cpsr_c, #0xdb | 142 | msr cpsr_c, #0xdb |
150 | ldr sp, =irq_stack | 143 | ldr sp, =irq_stack |
151 | 144 | ||
152 | /* Switch back to supervisor mode */ | 145 | /* Switch to sys mode */ |
153 | msr cpsr_c, #0xd3 | 146 | msr cpsr_c, #0xdf |
147 | |||
148 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
149 | ldr sp, =stackend | ||
150 | ldr r2, =stackbegin | ||
151 | ldr r3, =0xdeadbeef | ||
152 | 1: | ||
153 | cmp sp, r2 | ||
154 | strhi r3, [r2], #4 | ||
155 | bhi 1b | ||
154 | 156 | ||
155 | /* Jump to main */ | 157 | /* Jump to main */ |
156 | mov r0, r6 | 158 | mov r0, r6 |
@@ -173,11 +175,13 @@ undef_instr_handler: | |||
173 | mov r1, #0 | 175 | mov r1, #0 |
174 | b UIE | 176 | b UIE |
175 | 177 | ||
176 | /* We run supervisor mode most of the time, and should never see a software | 178 | /* We run sys mode most of the time, and should never see a software |
177 | * exception being thrown. Perhaps make it illegal and call UIE? */ | 179 | * exception being thrown. Make it illegal and call UIE. */ |
178 | software_int_handler: | 180 | software_int_handler: |
179 | reserved_handler: | 181 | reserved_handler: |
180 | movs pc, lr | 182 | sub r0, lr, #4 |
183 | mov r1, #4 | ||
184 | b UIE | ||
181 | 185 | ||
182 | prefetch_abort_handler: | 186 | prefetch_abort_handler: |
183 | sub r0, lr, #4 | 187 | sub r0, lr, #4 |
@@ -196,5 +200,4 @@ irq_stack: | |||
196 | /* 256 words of FIQ stack */ | 200 | /* 256 words of FIQ stack */ |
197 | .space 256*4 | 201 | .space 256*4 |
198 | fiq_stack: | 202 | fiq_stack: |
199 | |||
200 | end: | 203 | end: |