diff options
Diffstat (limited to 'firmware/target/arm/s5l8702/crt0.S')
-rw-r--r-- | firmware/target/arm/s5l8702/crt0.S | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/firmware/target/arm/s5l8702/crt0.S b/firmware/target/arm/s5l8702/crt0.S index da2f49c971..e894e8f157 100644 --- a/firmware/target/arm/s5l8702/crt0.S +++ b/firmware/target/arm/s5l8702/crt0.S | |||
@@ -150,15 +150,6 @@ start_loc: | |||
150 | bhi 1b | 150 | bhi 1b |
151 | #endif | 151 | #endif |
152 | 152 | ||
153 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
154 | ldr sp, =stackend | ||
155 | ldr r2, =stackbegin | ||
156 | ldr r3, =0xdeadbeef | ||
157 | 1: | ||
158 | cmp sp, r2 | ||
159 | strhi r3, [r2], #4 | ||
160 | bhi 1b | ||
161 | |||
162 | /* Set up stack for IRQ mode */ | 153 | /* Set up stack for IRQ mode */ |
163 | msr cpsr_c, #0xd2 | 154 | msr cpsr_c, #0xd2 |
164 | ldr sp, =_irqstackend | 155 | ldr sp, =_irqstackend |
@@ -167,14 +158,25 @@ start_loc: | |||
167 | msr cpsr_c, #0xd1 | 158 | msr cpsr_c, #0xd1 |
168 | ldr sp, =_fiqstackend | 159 | ldr sp, =_fiqstackend |
169 | 160 | ||
170 | /* Let abort and undefined modes use IRQ stack */ | 161 | /* Let svc, abort and undefined modes use irq stack */ |
162 | msr cpsr_c, #0xd3 | ||
163 | ldr sp, =_irqstackend | ||
171 | msr cpsr_c, #0xd7 | 164 | msr cpsr_c, #0xd7 |
172 | ldr sp, =_irqstackend | 165 | ldr sp, =_irqstackend |
173 | msr cpsr_c, #0xdb | 166 | msr cpsr_c, #0xdb |
174 | ldr sp, =_irqstackend | 167 | ldr sp, =_irqstackend |
175 | 168 | ||
176 | /* Switch back to supervisor mode */ | 169 | /* Switch to sys mode */ |
177 | msr cpsr_c, #0xd3 | 170 | msr cpsr_c, #0xdf |
171 | |||
172 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
173 | ldr sp, =stackend | ||
174 | ldr r2, =stackbegin | ||
175 | ldr r3, =0xdeadbeef | ||
176 | 1: | ||
177 | cmp sp, r2 | ||
178 | strhi r3, [r2], #4 | ||
179 | bhi 1b | ||
178 | 180 | ||
179 | bl main | 181 | bl main |
180 | 182 | ||
@@ -190,11 +192,13 @@ undef_instr_handler: | |||
190 | mov r1, #0 | 192 | mov r1, #0 |
191 | b UIE | 193 | b UIE |
192 | 194 | ||
193 | /* We run supervisor mode most of the time, and should never see a software | 195 | /* We run sys mode most of the time, and should never see a software |
194 | * exception being thrown. Perhaps make it illegal and call UIE? */ | 196 | * exception being thrown. Make it illegal and call UIE. */ |
195 | software_int_handler: | 197 | software_int_handler: |
196 | reserved_handler: | 198 | reserved_handler: |
197 | movs pc, lr | 199 | sub r0, lr, #4 |
200 | mov r1, #4 | ||
201 | b UIE | ||
198 | 202 | ||
199 | prefetch_abort_handler: | 203 | prefetch_abort_handler: |
200 | sub r0, lr, #4 | 204 | sub r0, lr, #4 |