1 | /* |
---|
2 | * cf-isv.c -- |
---|
3 | * |
---|
4 | * Copyright (c) 2006 CodeSourcery Inc |
---|
5 | * |
---|
6 | * The authors hereby grant permission to use, copy, modify, distribute, |
---|
7 | * and license this software and its documentation for any purpose, provided |
---|
8 | * that existing copyright notices are retained in all copies and that this |
---|
9 | * notice is included verbatim in any distributions. No written agreement, |
---|
10 | * license, or royalty fee is required for any of the authorized uses. |
---|
11 | * Modifications to this software may be copyrighted by their authors |
---|
12 | * and need not follow the licensing terms described here, provided that |
---|
13 | * the new terms are clearly indicated on the first page of each file where |
---|
14 | * they apply. |
---|
15 | */ |
---|
16 | |
---|
17 | /* This file contains default interrupt handlers code for the |
---|
18 | interrupt vector. All but one of the interrupts are user |
---|
19 | replaceable. |
---|
20 | |
---|
21 | These interrupt handlers are entered whenever the associated |
---|
22 | interrupt occurs. All they do is stop the debugger to give the user |
---|
23 | the opportunity to determine where the problem was. */ |
---|
24 | |
---|
25 | |
---|
26 | /* Each ISR is a loop containing a halt instruction */ |
---|
27 | #define ISR_DEFINE(NAME) \ |
---|
28 | void __attribute__((interrupt_handler)) NAME (void) \ |
---|
29 | { \ |
---|
30 | while (1) \ |
---|
31 | __asm__ __volatile__ ("halt" ::: "memory"); \ |
---|
32 | } \ |
---|
33 | struct eat_trailing_semicolon |
---|
34 | |
---|
35 | #if defined (L_other_interrupt) |
---|
36 | static ISR_DEFINE (__other_interrupt); |
---|
37 | #define ALIAS __other_interrupt |
---|
38 | #define PREFIX interrupt |
---|
39 | #define ALIASES A(6) A(7) \ |
---|
40 | A(15) A(16) A(17) A(18) A(19) A(20) A(21) A(22) A(23) \ |
---|
41 | A(25) A(26) A(27) A(28) A(29) A(30) A(31) \ |
---|
42 | A(56) A(57) A(58) A(59) A(60) A(62) A(63) \ |
---|
43 | A(64) A(65) A(66) A(67) A(68) A(69) A(70) A(71) \ |
---|
44 | A(72) A(73) A(74) A(75) A(76) A(77) A(78) A(79) \ |
---|
45 | A(80) A(81) A(82) A(83) A(84) A(85) A(86) A(87) \ |
---|
46 | A(88) A(89) A(90) A(91) A(92) A(93) A(94) A(95) \ |
---|
47 | A(96) A(97) A(98) A(99) A(100) A(101) A(102) A(103) \ |
---|
48 | A(104) A(105) A(106) A(107) A(108) A(109) A(110) A(111) \ |
---|
49 | A(112) A(113) A(114) A(115) A(116) A(117) A(118) A(119) \ |
---|
50 | A(120) A(121) A(122) A(123) A(124) A(125) A(126) A(127) \ |
---|
51 | A(128) A(129) A(130) A(131) A(132) A(133) A(134) A(135) \ |
---|
52 | A(136) A(137) A(138) A(139) A(140) A(141) A(142) A(143) \ |
---|
53 | A(144) A(145) A(146) A(147) A(148) A(149) A(150) A(151) \ |
---|
54 | A(152) A(153) A(154) A(155) A(156) A(157) A(158) A(159) \ |
---|
55 | A(160) A(161) A(162) A(163) A(164) A(165) A(166) A(167) \ |
---|
56 | A(168) A(169) A(170) A(171) A(172) A(173) A(174) A(175) \ |
---|
57 | A(176) A(177) A(178) A(179) A(180) A(181) A(182) A(183) \ |
---|
58 | A(184) A(185) A(186) A(187) A(188) A(189) A(190) A(191) \ |
---|
59 | A(192) A(193) A(194) A(195) A(196) A(197) A(198) A(199) \ |
---|
60 | A(200) A(201) A(202) A(203) A(204) A(205) A(206) A(207) \ |
---|
61 | A(208) A(209) A(210) A(211) A(212) A(213) A(214) A(215) \ |
---|
62 | A(216) A(217) A(218) A(219) A(220) A(221) A(222) A(223) \ |
---|
63 | A(224) A(225) A(226) A(227) A(228) A(229) A(230) A(231) \ |
---|
64 | A(232) A(233) A(234) A(235) A(236) A(237) A(238) A(239) \ |
---|
65 | A(240) A(241) A(242) A(243) A(244) A(245) A(246) A(247) \ |
---|
66 | A(248) A(249) A(250) A(251) A(252) A(253) A(254) A(255) |
---|
67 | #endif |
---|
68 | |
---|
69 | #if defined (L_access_error) |
---|
70 | ISR_DEFINE (__access_error); |
---|
71 | #define DEFINED __access_error |
---|
72 | #endif |
---|
73 | |
---|
74 | #if defined (L_address_error) |
---|
75 | ISR_DEFINE (__address_error); |
---|
76 | #define DEFINED __address_error |
---|
77 | #endif |
---|
78 | |
---|
79 | #if defined (L_illegal_instruction) |
---|
80 | ISR_DEFINE (__illegal_instruction); |
---|
81 | #define DEFINED __illegal_instruction |
---|
82 | #endif |
---|
83 | |
---|
84 | #if defined (L_divide_by_zero) |
---|
85 | ISR_DEFINE (__divide_by_zero); |
---|
86 | #define DEFINED __divide_by_zero |
---|
87 | #endif |
---|
88 | |
---|
89 | #if defined (L_privilege_violation) |
---|
90 | ISR_DEFINE (__privilege_violation); |
---|
91 | #define DEFINED __privilege_violation |
---|
92 | #endif |
---|
93 | |
---|
94 | #if defined (L_trace) |
---|
95 | ISR_DEFINE (__trace); |
---|
96 | #define DEFINED __trace |
---|
97 | #endif |
---|
98 | |
---|
99 | #if defined (L_unimplemented_opcode) |
---|
100 | static ISR_DEFINE (__unimplemented_opcode); |
---|
101 | #define ALIAS __unimplemented_opcode |
---|
102 | #define PREFIX unimplemented_ |
---|
103 | #define SUFFIX _opcode |
---|
104 | #define ALIASES A(line_a) A(line_f) |
---|
105 | #endif |
---|
106 | |
---|
107 | #if defined (L_breakpoint_debug_interrupt) |
---|
108 | static ISR_DEFINE (__breakpoint_debug_interrupt); |
---|
109 | #define ALIAS __breakpoint_debug_interrupt |
---|
110 | #define SUFFIX _breakpoint_debug_interrupt |
---|
111 | #define ALIASES A(non_pc) A(pc) |
---|
112 | #endif |
---|
113 | |
---|
114 | #if defined (L_format_error) |
---|
115 | ISR_DEFINE (__format_error); |
---|
116 | #define DEFINED __format_error |
---|
117 | #endif |
---|
118 | |
---|
119 | #if defined (L_spurious_interrupt) |
---|
120 | ISR_DEFINE (__spurious_interrupt); |
---|
121 | #define DEFINED __spurious_interrupt |
---|
122 | #endif |
---|
123 | |
---|
124 | #if defined (L_trap_interrupt) |
---|
125 | static ISR_DEFINE (__trap_interrupt); |
---|
126 | #define ALIAS __trap_interrupt |
---|
127 | #define PREFIX trap |
---|
128 | #define ALIASES A(0) A(1) A(2) A(3) A(4) A(5) A(6) A(7) \ |
---|
129 | A(8) A(9) A(10) A(11) A(12) A(13) A(14) A(15) |
---|
130 | #endif |
---|
131 | |
---|
132 | #if defined (L_fp_interrupt) |
---|
133 | static ISR_DEFINE (__fp_interrupt); |
---|
134 | #define ALIAS __fp_interrupt |
---|
135 | #define PREFIX fp_ |
---|
136 | #define ALIASES A(branch_unordered) A(inexact_result) A(divide_by_zero) \ |
---|
137 | A(underflow) A(operand_error) A(overflow) A(input_not_a_number) \ |
---|
138 | A(input_denormalized_number) |
---|
139 | #endif |
---|
140 | |
---|
141 | #if defined (L_unsupported_instruction) |
---|
142 | ISR_DEFINE (__unsupported_instruction); |
---|
143 | #define DEFINED __unsupported_instruction |
---|
144 | #endif |
---|
145 | |
---|
146 | #if defined(ALIAS) |
---|
147 | #ifndef PREFIX |
---|
148 | #define PREFIX |
---|
149 | #endif |
---|
150 | #ifndef SUFFIX |
---|
151 | #define SUFFIX |
---|
152 | #endif |
---|
153 | #define STRING_(a) #a |
---|
154 | #define STRING(a) STRING_(a) |
---|
155 | #define PASTE4_(a,b,c,d) a##b##c##d |
---|
156 | #define PASTE4(a,b,c,d) PASTE4_(a,b,c,d) |
---|
157 | #define A(N) \ |
---|
158 | void __attribute__((weak, alias(STRING(ALIAS)))) PASTE4(__,PREFIX,N,SUFFIX) (void); |
---|
159 | ALIASES |
---|
160 | #elif !defined(DEFINED) |
---|
161 | #error "No interrupt routine requested" |
---|
162 | #endif |
---|
163 | |
---|