summaryrefslogtreecommitdiff
path: root/firmware/target/arm/system-arm.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2012-04-02 15:11:21 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2012-04-06 13:46:32 +0200
commitf33330c0ff90adad8855250877a4a3d0a407bba4 (patch)
tree6b5ad86aeb2e6b0a57f78965e59c618b4a26f30f /firmware/target/arm/system-arm.c
parentbb0e4cc543e4c7bed6dff3a41d092b6867632535 (diff)
downloadrockbox-f33330c0ff90adad8855250877a4a3d0a407bba4.tar.gz
rockbox-f33330c0ff90adad8855250877a4a3d0a407bba4.zip
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>
Diffstat (limited to 'firmware/target/arm/system-arm.c')
-rw-r--r--firmware/target/arm/system-arm.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/firmware/target/arm/system-arm.c b/firmware/target/arm/system-arm.c
index c4692bbf29..e687e1d82b 100644
--- a/firmware/target/arm/system-arm.c
+++ b/firmware/target/arm/system-arm.c
@@ -36,6 +36,56 @@ static const char* const uiename[] = {
36 "SWI" 36 "SWI"
37}; 37};
38 38
39void __attribute__((weak,naked)) data_abort_handler(void)
40{
41 asm volatile(
42 "sub r0, lr, #8 \n"
43 "mov r1, #2 \n"
44 "b UIE \n"
45 );
46}
47
48void __attribute__((weak,naked)) software_int_handler(void)
49{
50 asm volatile(
51 "sub r0, lr, #4 \n"
52 "mov r1, #4 \n"
53 "b UIE \n"
54 );
55}
56
57void __attribute__((weak,naked)) reserved_handler(void)
58{
59 asm volatile(
60 "sub r0, lr, #4 \n"
61 "mov r1, #4 \n"
62 "b UIE \n"
63 );
64}
65
66void __attribute__((weak,naked)) prefetch_abort_handler(void)
67{
68 asm volatile(
69 "sub r0, lr, #4 \n"
70 "mov r1, #1 \n"
71 "b UIE \n"
72 );
73}
74
75void __attribute__((weak,naked)) undef_instr_handler(void)
76{
77 asm volatile(
78 "sub r0, lr, #4 \n"
79#ifdef USE_THUMB
80 "mrs r1, spsr \n"
81 "tst r1, #(1 << 5) \n" // T bit set ?
82 "subne r0, lr, #2 \n" // if yes, offset to THUMB instruction
83#endif
84 "mov r1, #0 \n"
85 "b UIE \n"
86 );
87}
88
39/* Unexpected Interrupt or Exception handler. Currently only deals with 89/* Unexpected Interrupt or Exception handler. Currently only deals with
40 exceptions, but will deal with interrupts later. 90 exceptions, but will deal with interrupts later.
41 */ 91 */