diff options
Diffstat (limited to 'firmware/target/arm/rk27xx/crt0.S')
-rw-r--r-- | firmware/target/arm/rk27xx/crt0.S | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/firmware/target/arm/rk27xx/crt0.S b/firmware/target/arm/rk27xx/crt0.S index 4ddae01c53..23f3fcf2c9 100644 --- a/firmware/target/arm/rk27xx/crt0.S +++ b/firmware/target/arm/rk27xx/crt0.S | |||
@@ -156,15 +156,6 @@ newstart2: | |||
156 | bhi 1b | 156 | bhi 1b |
157 | #endif | 157 | #endif |
158 | 158 | ||
159 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
160 | ldr sp, =stackend | ||
161 | ldr r2, =stackbegin | ||
162 | ldr r3, =0xdeadbeef | ||
163 | 1: | ||
164 | cmp sp, r2 | ||
165 | strhi r3, [r2], #4 | ||
166 | bhi 1b | ||
167 | |||
168 | /* Set up stack for IRQ mode */ | 159 | /* Set up stack for IRQ mode */ |
169 | msr cpsr_c, #0xd2 | 160 | msr cpsr_c, #0xd2 |
170 | ldr sp, =_irqstackend | 161 | ldr sp, =_irqstackend |
@@ -173,14 +164,26 @@ newstart2: | |||
173 | msr cpsr_c, #0xd1 | 164 | msr cpsr_c, #0xd1 |
174 | ldr sp, =_fiqstackend | 165 | ldr sp, =_fiqstackend |
175 | 166 | ||
176 | /* Let abort and undefined modes use IRQ stack */ | 167 | /* Let svc, abort and undefined modes use irq stack */ |
168 | msr cpsr_c, #0xd3 | ||
169 | ldr sp, =_irqstackend | ||
177 | msr cpsr_c, #0xd7 | 170 | msr cpsr_c, #0xd7 |
178 | ldr sp, =_irqstackend | 171 | ldr sp, =_irqstackend |
179 | msr cpsr_c, #0xdb | 172 | msr cpsr_c, #0xdb |
180 | ldr sp, =_irqstackend | 173 | ldr sp, =_irqstackend |
181 | 174 | ||
182 | /* Switch back to supervisor mode */ | 175 | /* Switch to sys mode */ |
183 | msr cpsr_c, #0xd3 | 176 | msr cpsr_c, #0xdf |
177 | |||
178 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
179 | ldr sp, =stackend | ||
180 | ldr r2, =stackbegin | ||
181 | ldr r3, =0xdeadbeef | ||
182 | 1: | ||
183 | cmp sp, r2 | ||
184 | strhi r3, [r2], #4 | ||
185 | bhi 1b | ||
186 | |||
184 | 187 | ||
185 | bl main | 188 | bl main |
186 | 189 | ||
@@ -196,12 +199,6 @@ undef_instr_handler: | |||
196 | mov r1, #0 | 199 | mov r1, #0 |
197 | b UIE | 200 | b UIE |
198 | 201 | ||
199 | /* We run supervisor mode most of the time, and should never see a software | ||
200 | * exception being thrown. Perhaps make it illegal and call UIE? */ | ||
201 | software_int_handler: | ||
202 | reserved_handler: | ||
203 | movs pc, lr | ||
204 | |||
205 | prefetch_abort_handler: | 202 | prefetch_abort_handler: |
206 | sub r0, lr, #4 | 203 | sub r0, lr, #4 |
207 | mov r1, #1 | 204 | mov r1, #1 |
@@ -211,3 +208,11 @@ data_abort_handler: | |||
211 | sub r0, lr, #8 | 208 | sub r0, lr, #8 |
212 | mov r1, #2 | 209 | mov r1, #2 |
213 | b UIE | 210 | b UIE |
211 | |||
212 | /* We run sys mode most of the time, and should never see a software | ||
213 | * exception being thrown. Make it illegal and call UIE */ | ||
214 | software_int_handler: | ||
215 | reserved_handler: | ||
216 | sub r0, lr, #4 | ||
217 | mov r1, #5 | ||
218 | b UIE | ||