1 /******************************************************************************
2 * Exception and interrupt vectors.
4 * This file has been built from the Newlib exception.S. It maps all events
7 * - Compiler: GNU GCC for AVR32
8 * - Supported devices: All AVR32A devices with an INTC module can be used.
11 * - author Atmel Corporation: http://www.atmel.com \n
12 * Support email: avr32@atmel.com
14 ******************************************************************************/
16 /* Copyright (c) 2007, Atmel Corporation All rights reserved.
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions are met:
21 * 1. Redistributions of source code must retain the above copyright notice,
22 * this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright notice,
25 * this list of conditions and the following disclaimer in the documentation
26 * and/or other materials provided with the distribution.
28 * 3. The name of ATMEL may not be used to endorse or promote products derived
29 * from this software without specific prior written permission.
31 * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
32 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
33 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
34 * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
35 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
37 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
38 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
40 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48 .section .exception, "ax"
51 // Start of Exception Vector Table.
53 // EVBA must be aligned with a power of two strictly greater than the EVBA-
54 // relative offset of the last vector.
62 // Unrecoverable Exception.
63 _handle_Unrecoverable_Exception:
67 // TLB Multiple Hit: UNUSED IN AVR32A.
68 _handle_TLB_Multiple_Hit:
72 // Bus Error Data Fetch.
73 _handle_Bus_Error_Data_Fetch:
77 // Bus Error Instruction Fetch.
78 _handle_Bus_Error_Instruction_Fetch:
87 // Instruction Address.
88 _handle_Instruction_Address:
93 _handle_ITLB_Protection:
103 _handle_Illegal_Opcode:
107 // Unimplemented Instruction.
108 _handle_Unimplemented_Instruction:
112 // Privilege Violation.
113 _handle_Privilege_Violation:
117 // Floating-Point: UNUSED IN AVR32A.
118 _handle_Floating_Point:
122 // Coprocessor Absent: UNUSED IN AVR32A.
123 _handle_Coprocessor_Absent:
127 // Data Address (Read).
128 _handle_Data_Address_Read:
132 // Data Address (Write).
133 _handle_Data_Address_Write:
137 // DTLB Protection (Read).
138 _handle_DTLB_Protection_Read:
142 // DTLB Protection (Write).
143 _handle_DTLB_Protection_Write:
147 // DTLB Modified: UNUSED IN AVR32A.
148 _handle_DTLB_Modified:
152 // ITLB Miss: UNUSED IN AVR32A.
157 // DTLB Miss (Read): UNUSED IN AVR32A.
158 _handle_DTLB_Miss_Read:
162 // DTLB Miss (Write): UNUSED IN AVR32A.
163 _handle_DTLB_Miss_Write:
168 _handle_Supervisor_Call:
172 // Interrupt support.
173 // The interrupt controller must provide the offset address relative to EVBA.
175 // All interrupts call a C function named _get_interrupt_handler.
176 // This function will read group and interrupt line number to then return in
177 // R12 a pointer to a user-provided interrupt handler.
182 // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
183 // CPU upon interrupt entry.
184 #if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
186 bfextu r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
198 mov r12, 0 // Pass the int_lev parameter to the _get_interrupt_handler function.
199 call _get_interrupt_handler
200 cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
201 movne pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
202 rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
205 // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
206 // CPU upon interrupt entry.
207 #if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
209 bfextu r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
221 mov r12, 1 // Pass the int_lev parameter to the _get_interrupt_handler function.
222 call _get_interrupt_handler
223 cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
224 movne pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
225 rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
228 // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
229 // CPU upon interrupt entry.
230 #if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
232 bfextu r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
244 mov r12, 2 // Pass the int_lev parameter to the _get_interrupt_handler function.
245 call _get_interrupt_handler
246 cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
247 movne pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
248 rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
251 // R8-R12, LR, PC and SR are automatically pushed onto the system stack by the
252 // CPU upon interrupt entry.
253 #if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
255 bfextu r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
267 mov r12, 3 // Pass the int_lev parameter to the _get_interrupt_handler function.
268 call _get_interrupt_handler
269 cp.w r12, 0 // Get the pointer to the interrupt handler returned by the function.
270 movne pc, r12 // If this was not a spurious interrupt (R12 != NULL), jump to the handler.
271 rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
274 // Constant data area.
278 // Values to store in the interrupt priority registers for the various interrupt priority levels.
279 // The interrupt priority registers contain the interrupt priority level and
280 // the EVBA-relative interrupt vector offset.
283 .word (INT0 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int0 - _evba),\
284 (INT1 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int1 - _evba),\
285 (INT2 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int2 - _evba),\
286 (INT3 << AVR32_INTC_IPR0_INTLEV_OFFSET) | (_int3 - _evba)