diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2007-07-09 13:53:12 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2007-07-09 13:53:12 +0000 |
| commit | 01e8fce28760ab32c45ca330a8506c5cf45abf14 (patch) | |
| tree | a9f186ade263b12d18659b7e58eb1a80891ac665 | |
| parent | 07fabd1cd1f2173d93cb1b3962da7d11ca80c569 (diff) | |
| download | rockbox-01e8fce28760ab32c45ca330a8506c5cf45abf14.zip rockbox-01e8fce28760ab32c45ca330a8506c5cf45abf14.tar.gz rockbox-01e8fce28760ab32c45ca330a8506c5cf45abf14.tar.bz2 rockbox-01e8fce28760ab32c45ca330a8506c5cf45abf14.tar.xz | |
Add divide-by-zero trap for ARM instead of just silently ignoring them.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13832 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/system.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/firmware/system.c b/firmware/system.c index a3a354f7..3fcf37d 100644 --- a/firmware/system.c +++ b/firmware/system.c @@ -170,7 +170,10 @@ bool detect_original_firmware(void) #if defined(CPU_ARM) static const char* const uiename[] = { - "Undefined instruction", "Prefetch abort", "Data abort" + "Undefined instruction", + "Prefetch abort", + "Data abort", + "Divide by zero" }; /* Unexpected Interrupt or Exception handler. Currently only deals with @@ -197,5 +200,18 @@ void UIE(unsigned int pc, unsigned int num) } } +#ifndef STUB +/* Needs to be here or gcc won't find it */ +void __div0(void) __attribute__((naked)); +void __div0(void) +{ + asm volatile ( + "ldr r0, [sp] \r\n" + "mov r1, #3 \r\n" + "b UIE \r\n" + ); +} +#endif + #endif /* CPU_ARM */ |