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.tar.gz rockbox-01e8fce28760ab32c45ca330a8506c5cf45abf14.zip |
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 a3a354f713..3fcf37d297 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -170,7 +170,10 @@ bool detect_original_firmware(void) | |||
170 | #if defined(CPU_ARM) | 170 | #if defined(CPU_ARM) |
171 | 171 | ||
172 | static const char* const uiename[] = { | 172 | static const char* const uiename[] = { |
173 | "Undefined instruction", "Prefetch abort", "Data abort" | 173 | "Undefined instruction", |
174 | "Prefetch abort", | ||
175 | "Data abort", | ||
176 | "Divide by zero" | ||
174 | }; | 177 | }; |
175 | 178 | ||
176 | /* Unexpected Interrupt or Exception handler. Currently only deals with | 179 | /* Unexpected Interrupt or Exception handler. Currently only deals with |
@@ -197,5 +200,18 @@ void UIE(unsigned int pc, unsigned int num) | |||
197 | } | 200 | } |
198 | } | 201 | } |
199 | 202 | ||
203 | #ifndef STUB | ||
204 | /* Needs to be here or gcc won't find it */ | ||
205 | void __div0(void) __attribute__((naked)); | ||
206 | void __div0(void) | ||
207 | { | ||
208 | asm volatile ( | ||
209 | "ldr r0, [sp] \r\n" | ||
210 | "mov r1, #3 \r\n" | ||
211 | "b UIE \r\n" | ||
212 | ); | ||
213 | } | ||
214 | #endif | ||
215 | |||
200 | #endif /* CPU_ARM */ | 216 | #endif /* CPU_ARM */ |
201 | 217 | ||