diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2009-01-08 10:15:32 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2009-01-08 10:15:32 +0000 |
commit | 4ed78f5c72649002d78d48d9a117826a5d9c36f9 (patch) | |
tree | 7ebe8ac19acabd74117a638da8dbb0c1cedf2600 /firmware/system.c | |
parent | 32d9752dcc73fd1aaa81d484c3d426ca7856b146 (diff) | |
download | rockbox-4ed78f5c72649002d78d48d9a117826a5d9c36f9.tar.gz rockbox-4ed78f5c72649002d78d48d9a117826a5d9c36f9.zip |
Clean up panicf and introduce system_exception_wait to do further target tasks and wait for a button when an unrecoverable error has occurred (panic, UIE, etc.). Returning from that function should reboot or don't return from it. Move UIE and __div0 for ARM to its own file.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19716 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/system.c')
-rw-r--r-- | firmware/system.c | 58 |
1 files changed, 1 insertions, 57 deletions
diff --git a/firmware/system.c b/firmware/system.c index ada99e0b56..befc785823 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -18,16 +18,11 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <stdio.h> | ||
22 | #include "config.h" | 21 | #include "config.h" |
23 | #include <stdbool.h> | ||
24 | #include "lcd.h" | ||
25 | #include "font.h" | ||
26 | #include "system.h" | 22 | #include "system.h" |
23 | #include <stdio.h> | ||
27 | #include "kernel.h" | 24 | #include "kernel.h" |
28 | #include "thread.h" | 25 | #include "thread.h" |
29 | #include "timer.h" | ||
30 | #include "inttypes.h" | ||
31 | #include "string.h" | 26 | #include "string.h" |
32 | 27 | ||
33 | #ifndef SIMULATOR | 28 | #ifndef SIMULATOR |
@@ -226,54 +221,3 @@ bool detect_original_firmware(void) | |||
226 | return !(detect_flashed_ramimage() || detect_flashed_romimage()); | 221 | return !(detect_flashed_ramimage() || detect_flashed_romimage()); |
227 | } | 222 | } |
228 | 223 | ||
229 | #if defined(CPU_ARM) | ||
230 | |||
231 | static const char* const uiename[] = { | ||
232 | "Undefined instruction", | ||
233 | "Prefetch abort", | ||
234 | "Data abort", | ||
235 | "Divide by zero" | ||
236 | }; | ||
237 | |||
238 | /* Unexpected Interrupt or Exception handler. Currently only deals with | ||
239 | exceptions, but will deal with interrupts later. | ||
240 | */ | ||
241 | void UIE(unsigned int pc, unsigned int num) __attribute__((noreturn)); | ||
242 | void UIE(unsigned int pc, unsigned int num) | ||
243 | { | ||
244 | char str[32]; | ||
245 | |||
246 | lcd_clear_display(); | ||
247 | #ifdef HAVE_LCD_BITMAP | ||
248 | lcd_setfont(FONT_SYSFIXED); | ||
249 | #endif | ||
250 | lcd_puts(0, 0, uiename[num]); | ||
251 | snprintf(str, sizeof(str), "at %08x" IF_COP(" (%d)"), pc | ||
252 | IF_COP(, CURRENT_CORE)); | ||
253 | lcd_puts(0, 1, str); | ||
254 | lcd_update(); | ||
255 | |||
256 | while (1) | ||
257 | { | ||
258 | /* TODO: perhaps add button handling in here when we get a polling | ||
259 | driver some day. | ||
260 | */ | ||
261 | core_idle(); | ||
262 | } | ||
263 | } | ||
264 | |||
265 | #ifndef STUB | ||
266 | /* Needs to be here or gcc won't find it */ | ||
267 | void __div0(void) __attribute__((naked)); | ||
268 | void __div0(void) | ||
269 | { | ||
270 | asm volatile ( | ||
271 | "ldr r0, [sp] \r\n" | ||
272 | "mov r1, #3 \r\n" | ||
273 | "b UIE \r\n" | ||
274 | ); | ||
275 | } | ||
276 | #endif | ||
277 | |||
278 | #endif /* CPU_ARM */ | ||
279 | |||