diff options
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/at91sam/lyre_proto1/crt0.S | 36 | ||||
-rw-r--r-- | firmware/target/arm/crt0-pp-bl.S | 2 | ||||
-rw-r--r-- | firmware/target/arm/crt0-pp.S | 68 | ||||
-rw-r--r-- | firmware/target/arm/crt0-pp502x-bl-usb.S | 35 | ||||
-rw-r--r-- | firmware/target/arm/crt0.S | 36 | ||||
-rw-r--r-- | firmware/target/arm/imx233/crt0.S | 35 | ||||
-rw-r--r-- | firmware/target/arm/imx31/crt0.S | 34 | ||||
-rw-r--r-- | firmware/target/arm/pnx0101/crt0-pnx0101.S | 37 | ||||
-rw-r--r-- | firmware/target/arm/rk27xx/crt0.S | 41 | ||||
-rw-r--r-- | firmware/target/arm/s3c2440/crt0.S | 39 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/crt0.S | 34 | ||||
-rw-r--r-- | firmware/target/arm/s5l8702/crt0.S | 34 | ||||
-rw-r--r-- | firmware/target/arm/system-arm.c | 3 | ||||
-rw-r--r-- | firmware/target/arm/tcc77x/crt0.S | 23 | ||||
-rw-r--r-- | firmware/target/arm/tcc780x/crt0.S | 23 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/crt0.S | 25 |
16 files changed, 285 insertions, 220 deletions
diff --git a/firmware/target/arm/at91sam/lyre_proto1/crt0.S b/firmware/target/arm/at91sam/lyre_proto1/crt0.S index 0146a8409c..029c1b7aec 100644 --- a/firmware/target/arm/at91sam/lyre_proto1/crt0.S +++ b/firmware/target/arm/at91sam/lyre_proto1/crt0.S | |||
@@ -33,6 +33,8 @@ | |||
33 | #define ARM_MODE_FIQ 0x11 | 33 | #define ARM_MODE_FIQ 0x11 |
34 | #define ARM_MODE_IRQ 0x12 | 34 | #define ARM_MODE_IRQ 0x12 |
35 | #define ARM_MODE_SVC 0x13 | 35 | #define ARM_MODE_SVC 0x13 |
36 | #define ARM_MODE_UND 0x1b | ||
37 | #define ARM_MODE_SYS 0x1f | ||
36 | 38 | ||
37 | #define I_BIT 0x80 | 39 | #define I_BIT 0x80 |
38 | #define F_BIT 0x40 | 40 | #define F_BIT 0x40 |
@@ -163,6 +165,15 @@ _stack_init: | |||
163 | * r2 = IRQ_STACK_SIZE | 165 | * r2 = IRQ_STACK_SIZE |
164 | */ | 166 | */ |
165 | 167 | ||
168 | /*- Set up Interrupt Mode and set IRQ Mode Stack */ | ||
169 | msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT /* Enter in Mode Interrupt | ||
170 | * and disable IRQ (Interrupt) and FIQ (Fast Interrupt) | ||
171 | */ | ||
172 | |||
173 | mov sp, r0 /* sp (Interrupt Mode Stack Pointer) = | ||
174 | * TOP_OF_MEMORY (end of IRAM 1) | ||
175 | */ | ||
176 | |||
166 | /*- Set up Abort Mode and set ABT Mode Stack */ | 177 | /*- Set up Abort Mode and set ABT Mode Stack */ |
167 | msr CPSR_c, #ARM_MODE_ABT | I_BIT | F_BIT /* Enter in Mode Abort | 178 | msr CPSR_c, #ARM_MODE_ABT | I_BIT | F_BIT /* Enter in Mode Abort |
168 | * and disable IRQ (Interrupt) and FIQ (Fast Interrupt) | 179 | * and disable IRQ (Interrupt) and FIQ (Fast Interrupt) |
@@ -172,26 +183,27 @@ _stack_init: | |||
172 | * (end of IRAM 1) | 183 | * (end of IRAM 1) |
173 | */ | 184 | */ |
174 | 185 | ||
175 | /* put r0 with value of the new address for next Stack */ | 186 | /*- Set up Abort Mode and set ABT Mode Stack */ |
176 | sub r0, r0, r1 /* r0 = r0 - r1 --> r0 = (end of IRAM 1) - | 187 | msr CPSR_c, #ARM_MODE_UND | I_BIT | F_BIT /* Enter in Mode Undefined |
177 | * (ABT_STACK_SIZE) | ||
178 | */ | ||
179 | |||
180 | /*- Set up Interrupt Mode and set IRQ Mode Stack */ | ||
181 | msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT /* Enter in Mode Interrupt | ||
182 | * and disable IRQ (Interrupt) and FIQ (Fast Interrupt) | 188 | * and disable IRQ (Interrupt) and FIQ (Fast Interrupt) |
183 | */ | 189 | */ |
184 | 190 | ||
185 | mov sp, r0 /* sp (Interrupt Mode Stack Pointer) = | 191 | mov sp, r0 /* sp (ABT Mode Stack Pointer) = TOP_OF_MEMORY |
186 | * TOP_OF_MEMORY (end of IRAM 1) - (ABT_STACK_SIZE) | 192 | * (end of IRAM 1) |
187 | */ | 193 | */ |
188 | 194 | ||
195 | /*- Set up Supervisor Mode and set Supervisor Mode Stack */ | ||
196 | msr CPSR_c, #ARM_MODE_SVC | I_BIT | F_BIT | ||
197 | mov sp, r0 | ||
198 | |||
189 | sub r0, r0, r2 /* Put on r0 the new address for next | 199 | sub r0, r0, r2 /* Put on r0 the new address for next |
190 | * Stack (Supervisor Mode) | 200 | * Stack (Sys Mode) |
191 | */ | 201 | */ |
192 | 202 | ||
193 | /*- Enable interrupt & Set up Supervisor Mode and set Supervisor Mode Stack */ | 203 | /*- Set up Sys Mode and set Sys Mode Stack */ |
194 | msr CPSR_c, #ARM_MODE_SVC | F_BIT | 204 | msr CPSR_c, #ARM_MODE_SYS | F_BIT /* Enter in Sys Mode |
205 | * and enable IRQ (Interrupt) and disable FIQ (Fast Interrupt) | ||
206 | */ | ||
195 | mov sp, r0 | 207 | mov sp, r0 |
196 | 208 | ||
197 | /*----------------------------------------------------------------------------- | 209 | /*----------------------------------------------------------------------------- |
diff --git a/firmware/target/arm/crt0-pp-bl.S b/firmware/target/arm/crt0-pp-bl.S index d1d9182314..01681288f9 100644 --- a/firmware/target/arm/crt0-pp-bl.S +++ b/firmware/target/arm/crt0-pp-bl.S | |||
@@ -61,7 +61,7 @@ start: | |||
61 | .equ CACHE_ENAB, 0x1 | 61 | .equ CACHE_ENAB, 0x1 |
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ */ | 64 | msr cpsr_c, #0xdf /* enter sys mode, disable IRQ */ |
65 | #ifndef E200R_INSTALLER | 65 | #ifndef E200R_INSTALLER |
66 | /* 1 - Copy the bootloader to IRAM */ | 66 | /* 1 - Copy the bootloader to IRAM */ |
67 | /* get the high part of our execute address */ | 67 | /* get the high part of our execute address */ |
diff --git a/firmware/target/arm/crt0-pp.S b/firmware/target/arm/crt0-pp.S index 12c885068d..4a9d4232b4 100644 --- a/firmware/target/arm/crt0-pp.S +++ b/firmware/target/arm/crt0-pp.S | |||
@@ -262,17 +262,6 @@ cpu_init: | |||
262 | strhi r4, [r2], #4 | 262 | strhi r4, [r2], #4 |
263 | bhi 1b | 263 | bhi 1b |
264 | 264 | ||
265 | /* Load stack munge value */ | ||
266 | ldr r4, =0xdeadbeef | ||
267 | |||
268 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
269 | ldr r2, =stackbegin | ||
270 | ldr sp, =stackend | ||
271 | 1: | ||
272 | cmp sp, r2 | ||
273 | strhi r4, [r2], #4 | ||
274 | bhi 1b | ||
275 | |||
276 | #if NUM_CORES > 1 | 265 | #if NUM_CORES > 1 |
277 | /* Set up idle stack and munge it with 0xdeadbeef */ | 266 | /* Set up idle stack and munge it with 0xdeadbeef */ |
278 | ldr r2, =cpu_idlestackbegin | 267 | ldr r2, =cpu_idlestackbegin |
@@ -289,14 +278,28 @@ cpu_init: | |||
289 | /* Set up stack for FIQ mode */ | 278 | /* Set up stack for FIQ mode */ |
290 | msr cpsr_c, #0xd1 /* IRQ/FIQ disabled */ | 279 | msr cpsr_c, #0xd1 /* IRQ/FIQ disabled */ |
291 | ldr sp, =fiq_stack | 280 | ldr sp, =fiq_stack |
292 | /* Let abort and undefined modes use IRQ stack */ | 281 | |
282 | /* Let svc, abort and undefined modes use irq stack */ | ||
283 | msr cpsr_c, #0xd3 /* IRQ/FIQ disabled */ | ||
284 | ldr sp, =irq_stack | ||
293 | msr cpsr_c, #0xd7 /* IRQ/FIQ disabled */ | 285 | msr cpsr_c, #0xd7 /* IRQ/FIQ disabled */ |
294 | ldr sp, =irq_stack | 286 | ldr sp, =irq_stack |
295 | msr cpsr_c, #0xdb /* IRQ/FIQ disabled */ | 287 | msr cpsr_c, #0xdb /* IRQ/FIQ disabled */ |
296 | ldr sp, =irq_stack | 288 | ldr sp, =irq_stack |
297 | 289 | ||
298 | /* Switch back to supervisor mode */ | 290 | /* Switch to sys mode */ |
299 | msr cpsr_c, #0xd3 | 291 | msr cpsr_c, #0xdf |
292 | |||
293 | /* Load stack munge value */ | ||
294 | ldr r4, =0xdeadbeef | ||
295 | |||
296 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
297 | ldr r2, =stackbegin | ||
298 | ldr sp, =stackend | ||
299 | 1: | ||
300 | cmp sp, r2 | ||
301 | strhi r4, [r2], #4 | ||
302 | bhi 1b | ||
300 | 303 | ||
301 | /* Delay waking the COP until thread initialization is complete unless dual-core | 304 | /* Delay waking the COP until thread initialization is complete unless dual-core |
302 | support is not enabled in which case the cop_main function does not perform | 305 | support is not enabled in which case the cop_main function does not perform |
@@ -320,15 +323,6 @@ cop_init: | |||
320 | beq 1b | 323 | beq 1b |
321 | #endif | 324 | #endif |
322 | 325 | ||
323 | /* Set up idle stack for COP and munge it with 0xdeadbeef */ | ||
324 | ldr sp, =cop_idlestackend | ||
325 | ldr r2, =cop_idlestackbegin | ||
326 | ldr r4, =0xdeadbeef | ||
327 | 2: | ||
328 | cmp sp, r2 | ||
329 | strhi r4, [r2], #4 | ||
330 | bhi 2b | ||
331 | |||
332 | /* Set up stack for IRQ mode */ | 326 | /* Set up stack for IRQ mode */ |
333 | msr cpsr_c, #0x92 /* IRQ disabled, FIQ enabled */ | 327 | msr cpsr_c, #0x92 /* IRQ disabled, FIQ enabled */ |
334 | ldr sp, =cop_irq_stack | 328 | ldr sp, =cop_irq_stack |
@@ -336,15 +330,26 @@ cop_init: | |||
336 | msr cpsr_c, #0xd1 /* IRQ/FIQ disabled */ | 330 | msr cpsr_c, #0xd1 /* IRQ/FIQ disabled */ |
337 | ldr sp, =cop_fiq_stack | 331 | ldr sp, =cop_fiq_stack |
338 | 332 | ||
339 | /* Let abort and undefined modes use IRQ stack */ | 333 | /* Let svc, abort and undefined modes use irq stack */ |
334 | msr cpsr_c, #0xd3 /* IRQ/FIQ disabled */ | ||
335 | ldr sp, =cop_irq_stack | ||
340 | msr cpsr_c, #0xd7 /* IRQ/FIQ disabled */ | 336 | msr cpsr_c, #0xd7 /* IRQ/FIQ disabled */ |
341 | ldr sp, =cop_irq_stack | 337 | ldr sp, =cop_irq_stack |
342 | msr cpsr_c, #0xdb /* IRQ/FIQ disabled */ | 338 | msr cpsr_c, #0xdb /* IRQ/FIQ disabled */ |
343 | ldr sp, =cop_irq_stack | 339 | ldr sp, =cop_irq_stack |
344 | 340 | ||
345 | /* Switch back to supervisor mode */ | 341 | /* Switch to sys mode */ |
346 | msr cpsr_c, #0xd3 | 342 | msr cpsr_c, #0xdf |
347 | 343 | ||
344 | /* Set up idle stack for COP and munge it with 0xdeadbeef */ | ||
345 | ldr sp, =cop_idlestackend | ||
346 | ldr r2, =cop_idlestackbegin | ||
347 | ldr r4, =0xdeadbeef | ||
348 | 2: | ||
349 | cmp sp, r2 | ||
350 | strhi r4, [r2], #4 | ||
351 | bhi 2b | ||
352 | |||
348 | /* Run cop_main() in apps/main.c */ | 353 | /* Run cop_main() in apps/main.c */ |
349 | ldr pc, =cop_main | 354 | ldr pc, =cop_main |
350 | 355 | ||
@@ -383,12 +388,15 @@ undef_instr_handler: | |||
383 | mov r1, #0 | 388 | mov r1, #0 |
384 | b UIE | 389 | b UIE |
385 | 390 | ||
386 | /* We run supervisor mode most of the time, and should never see a software | 391 | /* We run sys mode most of the time, and should never see a software |
387 | exception being thrown. Perhaps make it illegal and call UIE? | 392 | exception being thrown. Make it illegal and call UIE. |
388 | */ | 393 | */ |
389 | software_int_handler: | 394 | software_int_handler: |
390 | reserved_handler: | 395 | reserved_handler: |
391 | movs pc, lr | 396 | sub r0, lr, #4 |
397 | mov r1, #4 | ||
398 | b UIE | ||
399 | |||
392 | prefetch_abort_handler: | 400 | prefetch_abort_handler: |
393 | sub r0, lr, #4 | 401 | sub r0, lr, #4 |
394 | mov r1, #1 | 402 | mov r1, #1 |
diff --git a/firmware/target/arm/crt0-pp502x-bl-usb.S b/firmware/target/arm/crt0-pp502x-bl-usb.S index c8b7fb4ee8..7b0489b2a8 100644 --- a/firmware/target/arm/crt0-pp502x-bl-usb.S +++ b/firmware/target/arm/crt0-pp502x-bl-usb.S | |||
@@ -239,26 +239,28 @@ start_stub_end: | |||
239 | strhi r0, [r1], #4 | 239 | strhi r0, [r1], #4 |
240 | bhi 1b | 240 | bhi 1b |
241 | 241 | ||
242 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
243 | ldr r0, =0xdeadbeef | ||
244 | ldr r1, =stackbegin | ||
245 | ldr sp, =stackend | ||
246 | 1: | ||
247 | cmp sp, r1 | ||
248 | strhi r0, [r1], #4 | ||
249 | bhi 1b | ||
250 | |||
251 | /* Set up stack for IRQ mode */ | 242 | /* Set up stack for IRQ mode */ |
252 | msr cpsr_c, #0xd2 /* IRQ/FIQ disabled */ | 243 | msr cpsr_c, #0xd2 /* IRQ/FIQ disabled */ |
253 | ldr sp, =irq_stack | 244 | ldr sp, =irq_stack |
254 | /* Let abort and undefined modes use IRQ stack */ | 245 | /* Let svc, abort and undefined modes use irq stack */ |
246 | msr cpsr_c, #0xd3 | ||
247 | ldr sp, =irq_stack | ||
255 | msr cpsr_c, #0xd7 /* IRQ/FIQ disabled */ | 248 | msr cpsr_c, #0xd7 /* IRQ/FIQ disabled */ |
256 | ldr sp, =irq_stack | 249 | ldr sp, =irq_stack |
257 | msr cpsr_c, #0xdb /* IRQ/FIQ disabled */ | 250 | msr cpsr_c, #0xdb /* IRQ/FIQ disabled */ |
258 | ldr sp, =irq_stack | 251 | ldr sp, =irq_stack |
259 | 252 | ||
260 | /* Switch back to supervisor mode */ | 253 | /* Switch back to sys mode */ |
261 | msr cpsr_c, #0xd3 | 254 | msr cpsr_c, #0xdf |
255 | |||
256 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
257 | ldr r0, =0xdeadbeef | ||
258 | ldr r1, =stackbegin | ||
259 | ldr sp, =stackend | ||
260 | 1: | ||
261 | cmp sp, r1 | ||
262 | strhi r0, [r1], #4 | ||
263 | bhi 1b | ||
262 | 264 | ||
263 | /* execute the loader - this will load an image to 0x10000000 */ | 265 | /* execute the loader - this will load an image to 0x10000000 */ |
264 | ldr r0, =main | 266 | ldr r0, =main |
@@ -335,12 +337,15 @@ undef_instr_handler: | |||
335 | mov r1, #0 | 337 | mov r1, #0 |
336 | b UIE | 338 | b UIE |
337 | 339 | ||
338 | /* We run supervisor mode most of the time, and should never see a software | 340 | /* We run sys mode most of the time, and should never see a software |
339 | exception being thrown. Perhaps make it illegal and call UIE? | 341 | exception being thrown. Make it illegal and call UIE. |
340 | */ | 342 | */ |
341 | software_int_handler: | 343 | software_int_handler: |
342 | reserved_handler: | 344 | reserved_handler: |
343 | movs pc, lr | 345 | sub r0, lr, #4 |
346 | mov r1, #4 | ||
347 | b UIE | ||
348 | |||
344 | prefetch_abort_handler: | 349 | prefetch_abort_handler: |
345 | sub r0, lr, #4 | 350 | sub r0, lr, #4 |
346 | mov r1, #1 | 351 | mov r1, #1 |
diff --git a/firmware/target/arm/crt0.S b/firmware/target/arm/crt0.S index 3765df9ffc..f75f37006d 100644 --- a/firmware/target/arm/crt0.S +++ b/firmware/target/arm/crt0.S | |||
@@ -100,15 +100,6 @@ newstart: | |||
100 | strhi r4, [r2], #4 | 100 | strhi r4, [r2], #4 |
101 | bhi 1b | 101 | bhi 1b |
102 | 102 | ||
103 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
104 | ldr sp, =stackend | ||
105 | ldr r2, =stackbegin | ||
106 | ldr r3, =0xdeadbeef | ||
107 | 1: | ||
108 | cmp sp, r2 | ||
109 | strhi r3, [r2], #4 | ||
110 | bhi 1b | ||
111 | |||
112 | /* Set up stack for IRQ mode */ | 103 | /* Set up stack for IRQ mode */ |
113 | msr cpsr_c, #0xd2 | 104 | msr cpsr_c, #0xd2 |
114 | ldr sp, =irq_stack | 105 | ldr sp, =irq_stack |
@@ -117,14 +108,26 @@ newstart: | |||
117 | msr cpsr_c, #0xd1 | 108 | msr cpsr_c, #0xd1 |
118 | ldr sp, =fiq_stack | 109 | ldr sp, =fiq_stack |
119 | 110 | ||
120 | /* Let abort and undefined modes use IRQ stack */ | 111 | /* Let svc, abort and undefined modes use irq stack */ |
112 | msr cpsr_c, #0xd3 | ||
113 | ldr sp, =irq_stack | ||
121 | msr cpsr_c, #0xd7 | 114 | msr cpsr_c, #0xd7 |
122 | ldr sp, =irq_stack | 115 | ldr sp, =irq_stack |
123 | msr cpsr_c, #0xdb | 116 | msr cpsr_c, #0xdb |
124 | ldr sp, =irq_stack | 117 | ldr sp, =irq_stack |
125 | 118 | ||
126 | /* Switch back to supervisor mode */ | 119 | /* Switch to sys mode */ |
127 | msr cpsr_c, #0xd3 | 120 | msr cpsr_c, #0xdf |
121 | |||
122 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
123 | ldr sp, =stackend | ||
124 | ldr r2, =stackbegin | ||
125 | ldr r3, =0xdeadbeef | ||
126 | 1: | ||
127 | cmp sp, r2 | ||
128 | strhi r3, [r2], #4 | ||
129 | bhi 1b | ||
130 | |||
128 | ldr ip, =main @ make sure we are using the virtual address | 131 | ldr ip, =main @ make sure we are using the virtual address |
129 | bx ip | 132 | bx ip |
130 | 133 | ||
@@ -142,11 +145,13 @@ undef_instr_handler: | |||
142 | mov r1, #0 | 145 | mov r1, #0 |
143 | b UIE | 146 | b UIE |
144 | 147 | ||
145 | /* We run supervisor mode most of the time, and should never see a software | 148 | /* We run sys mode most of the time, and should never see a software |
146 | * exception being thrown. Perhaps make it illegal and call UIE? */ | 149 | * exception being thrown. Make it illegal and call UIE. */ |
147 | software_int_handler: | 150 | software_int_handler: |
148 | reserved_handler: | 151 | reserved_handler: |
149 | movs pc, lr | 152 | sub r0, lr, #4 |
153 | mov r1, #4 | ||
154 | b UIE | ||
150 | 155 | ||
151 | prefetch_abort_handler: | 156 | prefetch_abort_handler: |
152 | sub r0, lr, #4 | 157 | sub r0, lr, #4 |
@@ -165,5 +170,4 @@ irq_stack: | |||
165 | /* 256 words of FIQ stack */ | 170 | /* 256 words of FIQ stack */ |
166 | .space 256*4 | 171 | .space 256*4 |
167 | fiq_stack: | 172 | fiq_stack: |
168 | |||
169 | end: | 173 | end: |
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: |
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 |
diff --git a/firmware/target/arm/pnx0101/crt0-pnx0101.S b/firmware/target/arm/pnx0101/crt0-pnx0101.S index c8c4232a3a..f297c29d0c 100644 --- a/firmware/target/arm/pnx0101/crt0-pnx0101.S +++ b/firmware/target/arm/pnx0101/crt0-pnx0101.S | |||
@@ -115,16 +115,6 @@ start: | |||
115 | strhi r4, [r2], #4 | 115 | strhi r4, [r2], #4 |
116 | bhi 1b | 116 | bhi 1b |
117 | 117 | ||
118 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
119 | ldr sp, =stackend | ||
120 | mov r3, sp | ||
121 | ldr r2, =stackbegin | ||
122 | ldr r4, =0xdeadbeef | ||
123 | 1: | ||
124 | cmp r3, r2 | ||
125 | strhi r4, [r2], #4 | ||
126 | bhi 1b | ||
127 | |||
128 | /* Set up stack for IRQ mode */ | 118 | /* Set up stack for IRQ mode */ |
129 | msr cpsr_c, #0xd2 | 119 | msr cpsr_c, #0xd2 |
130 | ldr sp, =irq_stack | 120 | ldr sp, =irq_stack |
@@ -132,14 +122,27 @@ start: | |||
132 | msr cpsr_c, #0xd1 | 122 | msr cpsr_c, #0xd1 |
133 | ldr sp, =fiq_stack | 123 | ldr sp, =fiq_stack |
134 | 124 | ||
135 | /* Let abort and undefined modes use IRQ stack */ | 125 | /* Let svc, abort and undefined modes use irq stack */ |
126 | msr cpsr_c, #0xd3 | ||
127 | ldr sp =irq_stack | ||
136 | msr cpsr_c, #0xd7 | 128 | msr cpsr_c, #0xd7 |
137 | ldr sp, =irq_stack | 129 | ldr sp, =irq_stack |
138 | msr cpsr_c, #0xdb | 130 | msr cpsr_c, #0xdb |
139 | ldr sp, =irq_stack | 131 | ldr sp, =irq_stack |
140 | /* Switch to supervisor mode */ | 132 | |
141 | msr cpsr_c, #0xd3 | 133 | /* Switch to sys mode */ |
134 | msr cpsr_c, #0xdf | ||
135 | |||
136 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
142 | ldr sp, =stackend | 137 | ldr sp, =stackend |
138 | mov r3, sp | ||
139 | ldr r2, =stackbegin | ||
140 | ldr r4, =0xdeadbeef | ||
141 | 1: | ||
142 | cmp r3, r2 | ||
143 | strhi r4, [r2], #4 | ||
144 | bhi 1b | ||
145 | |||
143 | bl main | 146 | bl main |
144 | /* main() should never return */ | 147 | /* main() should never return */ |
145 | 148 | ||
@@ -178,12 +181,14 @@ undef_instr_handler: | |||
178 | mov r1, #0 | 181 | mov r1, #0 |
179 | b UIE | 182 | b UIE |
180 | 183 | ||
181 | /* We run supervisor mode most of the time, and should never see a software | 184 | /* We run sys mode most of the time, and should never see a software |
182 | exception being thrown. Perhaps make it illegal and call UIE? | 185 | exception being thrown. Make it illegal and call UIE. |
183 | */ | 186 | */ |
184 | software_int_handler: | 187 | software_int_handler: |
185 | reserved_handler: | 188 | reserved_handler: |
186 | movs pc, lr | 189 | sub r0, lr, #4 |
190 | mov r1, #4 | ||
191 | b UIE | ||
187 | 192 | ||
188 | prefetch_abort_handler: | 193 | prefetch_abort_handler: |
189 | sub r0, lr, #4 | 194 | sub r0, lr, #4 |
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 | ||
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 | |||
diff --git a/firmware/target/arm/s5l8700/crt0.S b/firmware/target/arm/s5l8700/crt0.S index 0d9793208c..0582ab0c8f 100644 --- a/firmware/target/arm/s5l8700/crt0.S +++ b/firmware/target/arm/s5l8700/crt0.S | |||
@@ -465,15 +465,6 @@ start_loc: | |||
465 | bhi 1b | 465 | bhi 1b |
466 | #endif | 466 | #endif |
467 | 467 | ||
468 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
469 | ldr sp, =stackend | ||
470 | ldr r2, =stackbegin | ||
471 | ldr r3, =0xdeadbeef | ||
472 | 1: | ||
473 | cmp sp, r2 | ||
474 | strhi r3, [r2], #4 | ||
475 | bhi 1b | ||
476 | |||
477 | /* Set up stack for IRQ mode */ | 468 | /* Set up stack for IRQ mode */ |
478 | msr cpsr_c, #0xd2 | 469 | msr cpsr_c, #0xd2 |
479 | ldr sp, =_irqstackend | 470 | ldr sp, =_irqstackend |
@@ -482,14 +473,25 @@ start_loc: | |||
482 | msr cpsr_c, #0xd1 | 473 | msr cpsr_c, #0xd1 |
483 | ldr sp, =_fiqstackend | 474 | ldr sp, =_fiqstackend |
484 | 475 | ||
485 | /* Let abort and undefined modes use IRQ stack */ | 476 | /* Let svc, abort and undefined modes use irq stack */ |
477 | msr cpsr_c, #0xd3 | ||
478 | ldr sp, =_irqstackend | ||
486 | msr cpsr_c, #0xd7 | 479 | msr cpsr_c, #0xd7 |
487 | ldr sp, =_irqstackend | 480 | ldr sp, =_irqstackend |
488 | msr cpsr_c, #0xdb | 481 | msr cpsr_c, #0xdb |
489 | ldr sp, =_irqstackend | 482 | ldr sp, =_irqstackend |
490 | 483 | ||
491 | /* Switch back to supervisor mode */ | 484 | /* Switch to sys mode */ |
492 | msr cpsr_c, #0xd3 | 485 | msr cpsr_c, #0xdf |
486 | |||
487 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
488 | ldr sp, =stackend | ||
489 | ldr r2, =stackbegin | ||
490 | ldr r3, =0xdeadbeef | ||
491 | 1: | ||
492 | cmp sp, r2 | ||
493 | strhi r3, [r2], #4 | ||
494 | bhi 1b | ||
493 | 495 | ||
494 | // if we did not switch remap on, device | 496 | // if we did not switch remap on, device |
495 | // would crash when MENU is pressed, | 497 | // would crash when MENU is pressed, |
@@ -518,11 +520,13 @@ undef_instr_handler: | |||
518 | mov r1, #0 | 520 | mov r1, #0 |
519 | b UIE | 521 | b UIE |
520 | 522 | ||
521 | /* We run supervisor mode most of the time, and should never see a software | 523 | /* We run sys mode most of the time, and should never see a software |
522 | * exception being thrown. Perhaps make it illegal and call UIE? */ | 524 | * exception being thrown. Make it illegal and call UIE. */ |
523 | software_int_handler: | 525 | software_int_handler: |
524 | reserved_handler: | 526 | reserved_handler: |
525 | movs pc, lr | 527 | sub r0, lr, #4 |
528 | mov r1, #4 | ||
529 | b UIE | ||
526 | 530 | ||
527 | prefetch_abort_handler: | 531 | prefetch_abort_handler: |
528 | sub r0, lr, #4 | 532 | sub r0, lr, #4 |
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 |
diff --git a/firmware/target/arm/system-arm.c b/firmware/target/arm/system-arm.c index 59eaa903b6..23ccfd1f14 100644 --- a/firmware/target/arm/system-arm.c +++ b/firmware/target/arm/system-arm.c | |||
@@ -29,7 +29,8 @@ static const char* const uiename[] = { | |||
29 | "Undefined instruction", | 29 | "Undefined instruction", |
30 | "Prefetch abort", | 30 | "Prefetch abort", |
31 | "Data abort", | 31 | "Data abort", |
32 | "Divide by zero" | 32 | "Divide by zero", |
33 | "SWI" | ||
33 | }; | 34 | }; |
34 | 35 | ||
35 | /* Unexpected Interrupt or Exception handler. Currently only deals with | 36 | /* Unexpected Interrupt or Exception handler. Currently only deals with |
diff --git a/firmware/target/arm/tcc77x/crt0.S b/firmware/target/arm/tcc77x/crt0.S index 251fd0c903..d0873102d4 100644 --- a/firmware/target/arm/tcc77x/crt0.S +++ b/firmware/target/arm/tcc77x/crt0.S | |||
@@ -141,16 +141,16 @@ copied_start: | |||
141 | ldr r11, =dma_play_data | 141 | ldr r11, =dma_play_data |
142 | #endif | 142 | #endif |
143 | 143 | ||
144 | /* Let abort and undefined modes use IRQ stack */ | 144 | /* Let svc, abort and undefined modes use irq stack */ |
145 | mov r0,#0xd7 | 145 | msr cpsr, #0xd3 |
146 | msr cpsr, r0 | ||
147 | ldr sp, =irq_stack | 146 | ldr sp, =irq_stack |
148 | mov r0,#0xdb | 147 | msr cpsr, #0xd7 |
149 | msr cpsr, r0 | 148 | ldr sp, =irq_stack |
149 | msr cpsr, #0xdb | ||
150 | ldr sp, =irq_stack | 150 | ldr sp, =irq_stack |
151 | 151 | ||
152 | /* Switch to supervisor mode */ | 152 | /* Switch to sys mode */ |
153 | mov r0,#0xd3 | 153 | mov r0,#0xdf |
154 | msr cpsr, r0 | 154 | msr cpsr, r0 |
155 | ldr sp, =stackend | 155 | ldr sp, =stackend |
156 | 156 | ||
@@ -222,12 +222,14 @@ undef_instr_handler: | |||
222 | mov r1, #0 | 222 | mov r1, #0 |
223 | b UIE | 223 | b UIE |
224 | 224 | ||
225 | /* We run supervisor mode most of the time, and should never see a software | 225 | /* We run sys mode most of the time, and should never see a software |
226 | exception being thrown. Perhaps make it illegal and call UIE? | 226 | exception being thrown. Make it illegal and call UIE. |
227 | */ | 227 | */ |
228 | software_int_handler: | 228 | software_int_handler: |
229 | reserved_handler: | 229 | reserved_handler: |
230 | movs pc, lr | 230 | sub r0, lr, #4 |
231 | mov r1, #4 | ||
232 | b UIE | ||
231 | 233 | ||
232 | prefetch_abort_handler: | 234 | prefetch_abort_handler: |
233 | sub r0, lr, #4 | 235 | sub r0, lr, #4 |
@@ -255,4 +257,3 @@ irq_stack: | |||
255 | /* 256 words of FIQ stack */ | 257 | /* 256 words of FIQ stack */ |
256 | .space 256*4 | 258 | .space 256*4 |
257 | fiq_stack: | 259 | fiq_stack: |
258 | |||
diff --git a/firmware/target/arm/tcc780x/crt0.S b/firmware/target/arm/tcc780x/crt0.S index 1612973866..1dbccf9828 100644 --- a/firmware/target/arm/tcc780x/crt0.S +++ b/firmware/target/arm/tcc780x/crt0.S | |||
@@ -120,17 +120,16 @@ copied_start: | |||
120 | ldr r11, =dma_play_data | 120 | ldr r11, =dma_play_data |
121 | #endif | 121 | #endif |
122 | 122 | ||
123 | /* Let abort and undefined modes use IRQ stack */ | 123 | /* Let svc, abort and undefined modes use irq stack */ |
124 | mov r0,#0xd7 | 124 | msr cpsr, #0xd3 |
125 | msr cpsr, r0 | ||
126 | ldr sp, =irq_stack | 125 | ldr sp, =irq_stack |
127 | mov r0,#0xdb | 126 | msr cpsr, #0xd7 |
128 | msr cpsr, r0 | 127 | ldr sp, =irq_stack |
128 | msr cpsr, #0xdb | ||
129 | ldr sp, =irq_stack | 129 | ldr sp, =irq_stack |
130 | 130 | ||
131 | /* Switch to supervisor mode */ | 131 | /* Switch to sys mode */ |
132 | mov r0,#0xd3 | 132 | msr cpsr, #0xdf |
133 | msr cpsr, r0 | ||
134 | ldr sp, =stackend | 133 | ldr sp, =stackend |
135 | 134 | ||
136 | /* Enable MMU & caches. At present this is just doing what the OF does. | 135 | /* Enable MMU & caches. At present this is just doing what the OF does. |
@@ -293,12 +292,14 @@ undef_instr_handler: | |||
293 | mov r1, #0 | 292 | mov r1, #0 |
294 | b UIE | 293 | b UIE |
295 | 294 | ||
296 | /* We run supervisor mode most of the time, and should never see a software | 295 | /* We run sys mode most of the time, and should never see a software |
297 | exception being thrown. Perhaps make it illegal and call UIE? | 296 | exception being thrown. Make it illegal and call UIE. |
298 | */ | 297 | */ |
299 | software_int_handler: | 298 | software_int_handler: |
300 | reserved_handler: | 299 | reserved_handler: |
301 | movs pc, lr | 300 | sub r0, lr, #4 |
301 | mov r1, #4 | ||
302 | b UIE | ||
302 | 303 | ||
303 | prefetch_abort_handler: | 304 | prefetch_abort_handler: |
304 | sub r0, lr, #4 | 305 | sub r0, lr, #4 |
diff --git a/firmware/target/arm/tms320dm320/crt0.S b/firmware/target/arm/tms320dm320/crt0.S index 0119ade3c7..d53cff2b63 100644 --- a/firmware/target/arm/tms320dm320/crt0.S +++ b/firmware/target/arm/tms320dm320/crt0.S | |||
@@ -169,23 +169,25 @@ _start: | |||
169 | msr cpsr_c, #0xd2 /* Go into irq state */ | 169 | msr cpsr_c, #0xd2 /* Go into irq state */ |
170 | ldr sp, =_irq_stack_start /* set the irq stack pointer */ | 170 | ldr sp, =_irq_stack_start /* set the irq stack pointer */ |
171 | 171 | ||
172 | /* This should not be needed, but set the stack location for abort and | 172 | /* SVC, ABT, UNDEF share irq stack */ |
173 | * undefined to at least a known stack location (IRQ) | 173 | msr cpsr_c, #0xd3 /* Go into svc state */ |
174 | */ | 174 | ldr sp, =_irq_stack_start /* set svc stack pointer */ |
175 | msr cpsr_c, #0xd7 /* Go into abort state */ | 175 | |
176 | msr cpsr_c, #0xd7 /* Go into abort state */ | ||
176 | ldr sp, =_irq_stack_start /* set the stack pointer */ | 177 | ldr sp, =_irq_stack_start /* set the stack pointer */ |
177 | 178 | ||
178 | msr cpsr_c, #0xdb /* Go into undefined state */ | 179 | msr cpsr_c, #0xdb /* Go into undefined state */ |
179 | ldr sp, =_irq_stack_start /* set the stack pointer */ | 180 | ldr sp, =_irq_stack_start /* set the stack pointer */ |
180 | 181 | ||
181 | /* Initialize program stack */ | 182 | /* Initialize program stack */ |
182 | msr cpsr_c, #0xd3 /* Go into supervisor state */ | 183 | msr cpsr_c, #0xdf /* Go into sys state */ |
184 | |||
183 | ldr r0, =0xDEADBEEF /* Can be taken out; left for clarity */ | 185 | ldr r0, =0xDEADBEEF /* Can be taken out; left for clarity */ |
184 | ldr r1, =_pro_stack_end /* Stack counts backwards, so end is first*/ | 186 | ldr r1, =_pro_stack_end /* Stack counts backwards, so end is first*/ |
185 | ldr r2, =_pro_stack_start | 187 | ldr r2, =_pro_stack_start |
186 | bl _init_section | 188 | bl _init_section |
187 | 189 | ||
188 | ldr sp, =_pro_stack_start /* set the supervisor stack pointer */ | 190 | ldr sp, =_pro_stack_start /* set the sys stack pointer */ |
189 | 191 | ||
190 | /* MMU initialization */ | 192 | /* MMU initialization */ |
191 | bl ttb_init | 193 | bl ttb_init |
@@ -298,6 +300,8 @@ _delay_cycles: | |||
298 | * 0: Undefined Instruction * | 300 | * 0: Undefined Instruction * |
299 | * 1: Prefetch Abort * | 301 | * 1: Prefetch Abort * |
300 | * 2: Data Abort * | 302 | * 2: Data Abort * |
303 | * 3: DIV0 * | ||
304 | * 4: SWI * | ||
301 | * The exceptions return operations are documented in section A2.6 of the * | 305 | * The exceptions return operations are documented in section A2.6 of the * |
302 | * ARM Architecture Reference Manual. * | 306 | * ARM Architecture Reference Manual. * |
303 | ******************************************************************************/ | 307 | ******************************************************************************/ |
@@ -309,11 +313,12 @@ _undefined_instruction: | |||
309 | bl UIE | 313 | bl UIE |
310 | 314 | ||
311 | /* A2.6.4: Software Interrupt exception - These should not happen in Rockbox, | 315 | /* A2.6.4: Software Interrupt exception - These should not happen in Rockbox, |
312 | * but for now leave this as a placeholder and continue with the program. | 316 | * make it illegal |
313 | * LR=PC of next instruction. | ||
314 | */ | 317 | */ |
315 | _software_interrupt: | 318 | _software_interrupt: |
316 | mov pc, lr | 319 | sub r0, lr, #4 |
320 | mov r1, #4 | ||
321 | bl UIE | ||
317 | 322 | ||
318 | /* A2.6.5 Prefetch Abort - This is also the BKPT instruction since this is a | 323 | /* A2.6.5 Prefetch Abort - This is also the BKPT instruction since this is a |
319 | * v5 target. Pass it on to UIE since it is not currently used. | 324 | * v5 target. Pass it on to UIE since it is not currently used. |