arm: factor all exception handlers out of the crt0.S files

Remove the implementations of all exceptions handlers from the
various crt0.S files and have a single implementation in system-arm.h
The new implementation is weak so that it can be overwritten by some
specific code (like the unwinder)

Change-Id: Ib3e041ed6037376bbe0e79286057e1051640dd90
Reviewed-on: http://gerrit.rockbox.org/205
Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
This commit is contained in:
Amaury Pouly 2012-04-02 15:11:21 +02:00
parent bb0e4cc543
commit f33330c0ff
11 changed files with 50 additions and 312 deletions

View file

@ -36,6 +36,56 @@ static const char* const uiename[] = {
"SWI"
};
void __attribute__((weak,naked)) data_abort_handler(void)
{
asm volatile(
"sub r0, lr, #8 \n"
"mov r1, #2 \n"
"b UIE \n"
);
}
void __attribute__((weak,naked)) software_int_handler(void)
{
asm volatile(
"sub r0, lr, #4 \n"
"mov r1, #4 \n"
"b UIE \n"
);
}
void __attribute__((weak,naked)) reserved_handler(void)
{
asm volatile(
"sub r0, lr, #4 \n"
"mov r1, #4 \n"
"b UIE \n"
);
}
void __attribute__((weak,naked)) prefetch_abort_handler(void)
{
asm volatile(
"sub r0, lr, #4 \n"
"mov r1, #1 \n"
"b UIE \n"
);
}
void __attribute__((weak,naked)) undef_instr_handler(void)
{
asm volatile(
"sub r0, lr, #4 \n"
#ifdef USE_THUMB
"mrs r1, spsr \n"
"tst r1, #(1 << 5) \n" // T bit set ?
"subne r0, lr, #2 \n" // if yes, offset to THUMB instruction
#endif
"mov r1, #0 \n"
"b UIE \n"
);
}
/* Unexpected Interrupt or Exception handler. Currently only deals with
exceptions, but will deal with interrupts later.
*/