summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-07-09 13:53:12 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-07-09 13:53:12 +0000
commit01e8fce28760ab32c45ca330a8506c5cf45abf14 (patch)
treea9f186ade263b12d18659b7e58eb1a80891ac665 /firmware
parent07fabd1cd1f2173d93cb1b3962da7d11ca80c569 (diff)
downloadrockbox-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
Diffstat (limited to 'firmware')
-rw-r--r--firmware/system.c18
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
172static const char* const uiename[] = { 172static 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 */
205void __div0(void) __attribute__((naked));
206void __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