1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Michael Sevakis 2007-07-09 13:53:12 +00:00
parent 07fabd1cd1
commit 01e8fce287

View file

@ -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 */