00001 /*This file is prepared for Doxygen automatic documentation generation.*/ 00017 /* Copyright (c) 2009 Atmel Corporation. All rights reserved. 00018 * 00019 * Redistribution and use in source and binary forms, with or without 00020 * modification, are permitted provided that the following conditions are met: 00021 * 00022 * 1. Redistributions of source code must retain the above copyright notice, this 00023 * list of conditions and the following disclaimer. 00024 * 00025 * 2. Redistributions in binary form must reproduce the above copyright notice, 00026 * this list of conditions and the following disclaimer in the documentation 00027 * and/or other materials provided with the distribution. 00028 * 00029 * 3. The name of Atmel may not be used to endorse or promote products derived 00030 * from this software without specific prior written permission. 00031 * 00032 * 4. This software may only be redistributed and used in connection with an Atmel 00033 * AVR product. 00034 * 00035 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 00036 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00037 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00038 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 00039 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00040 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00041 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00042 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00043 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00044 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 00045 * 00046 */ 00047 00048 #include <avr32/io.h> 00049 00050 00053 .section .exception, "ax", @progbits 00054 00055 00056 // Start of Exception Vector Table. 00057 00058 // EVBA must be aligned with a power of two strictly greater than the EVBA- 00059 // relative offset of the last vector. 00060 .balign 0x200 00061 // Export symbol. 00062 .global _evba 00063 .type _evba, @function 00064 _evba: 00065 .org 0x000 00066 /* For all exceptions except the SCALL exception (offset 100h), go to exm */ 00067 .rept 0x100 / 4 00068 pushm r0-r12, lr /* Save registers on the stack. */ 00069 rjmp exm 00070 .endr 00071 00072 /* Specific for supervisor call - mapped in (_EVBA+100h) */ 00073 pushm r0-r12, lr /* Save registers on the stack. */ 00074 /* Set the parameters given to the handle_exception() function. */ 00075 mov r10, 0x100 / 4 /* R10 <- Exception cause == (EVBA offset of the exception)>>2 */ 00076 lddsp r11, sp[14*4+4] /* R11 <- Address of the offending instruction */ 00077 sub r12, sp, -14*4 /* R12 <- Ptr to sp before the pushm we just did */ 00078 call handle_exception /* Handle the exception now */ 00079 popm r0-r12, lr /* Restore registers. */ 00080 rets /* Return from SCALL. */ 00081 00082 exm: /* All other exceptions */ 00083 mfsr r10, AVR32_ECR /* R10 <- AVR32_ECR (exception cause register) */ 00084 lddsp r11, sp[14*4+4] /* R11 <- Address of the offending instruction */ 00085 sub r12, sp, -14*4 /* R12 <- Ptr to sp before the pushm we just did */ 00086 call handle_exception /* Handle the exception now */ 00087 popm r0-r12, lr /* Restore registers. */ 00088 rete /* Return from exception. */ 00089 00090