16c595b3dSSandrine Bailleux/* 2*bbf8f6f9SYatharth Kochar * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved. 36c595b3dSSandrine Bailleux * 46c595b3dSSandrine Bailleux * Redistribution and use in source and binary forms, with or without 56c595b3dSSandrine Bailleux * modification, are permitted provided that the following conditions are met: 66c595b3dSSandrine Bailleux * 76c595b3dSSandrine Bailleux * Redistributions of source code must retain the above copyright notice, this 86c595b3dSSandrine Bailleux * list of conditions and the following disclaimer. 96c595b3dSSandrine Bailleux * 106c595b3dSSandrine Bailleux * Redistributions in binary form must reproduce the above copyright notice, 116c595b3dSSandrine Bailleux * this list of conditions and the following disclaimer in the documentation 126c595b3dSSandrine Bailleux * and/or other materials provided with the distribution. 136c595b3dSSandrine Bailleux * 146c595b3dSSandrine Bailleux * Neither the name of ARM nor the names of its contributors may be used 156c595b3dSSandrine Bailleux * to endorse or promote products derived from this software without specific 166c595b3dSSandrine Bailleux * prior written permission. 176c595b3dSSandrine Bailleux * 186c595b3dSSandrine Bailleux * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 196c595b3dSSandrine Bailleux * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 206c595b3dSSandrine Bailleux * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 216c595b3dSSandrine Bailleux * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 226c595b3dSSandrine Bailleux * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 236c595b3dSSandrine Bailleux * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 246c595b3dSSandrine Bailleux * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 256c595b3dSSandrine Bailleux * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 266c595b3dSSandrine Bailleux * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 276c595b3dSSandrine Bailleux * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 286c595b3dSSandrine Bailleux * POSSIBILITY OF SUCH DAMAGE. 296c595b3dSSandrine Bailleux */ 306c595b3dSSandrine Bailleux 316c595b3dSSandrine Bailleux#include <asm_macros.S> 32*bbf8f6f9SYatharth Kochar#include <bl_common.h> 336c595b3dSSandrine Bailleux 346c595b3dSSandrine Bailleux .globl early_exceptions 356c595b3dSSandrine Bailleux 366c595b3dSSandrine Bailleux .section .vectors, "ax"; .align 11 376c595b3dSSandrine Bailleux 386c595b3dSSandrine Bailleux /* ----------------------------------------------------- 396c595b3dSSandrine Bailleux * Very simple stackless exception handlers used by BL2 406c595b3dSSandrine Bailleux * and BL3-1 bootloader stages. BL3-1 uses them before 416c595b3dSSandrine Bailleux * stacks are setup. BL2 uses them throughout. 426c595b3dSSandrine Bailleux * ----------------------------------------------------- 436c595b3dSSandrine Bailleux */ 446c595b3dSSandrine Bailleux .align 7 456c595b3dSSandrine Bailleuxearly_exceptions: 466c595b3dSSandrine Bailleux /* ----------------------------------------------------- 476c595b3dSSandrine Bailleux * Current EL with SP0 : 0x0 - 0x180 486c595b3dSSandrine Bailleux * ----------------------------------------------------- 496c595b3dSSandrine Bailleux */ 506c595b3dSSandrine BailleuxSynchronousExceptionSP0: 516c595b3dSSandrine Bailleux mov x0, #SYNC_EXCEPTION_SP_EL0 526c595b3dSSandrine Bailleux bl plat_report_exception 536c595b3dSSandrine Bailleux b SynchronousExceptionSP0 546c595b3dSSandrine Bailleux check_vector_size SynchronousExceptionSP0 556c595b3dSSandrine Bailleux 566c595b3dSSandrine Bailleux .align 7 576c595b3dSSandrine BailleuxIrqSP0: 586c595b3dSSandrine Bailleux mov x0, #IRQ_SP_EL0 596c595b3dSSandrine Bailleux bl plat_report_exception 606c595b3dSSandrine Bailleux b IrqSP0 616c595b3dSSandrine Bailleux check_vector_size IrqSP0 626c595b3dSSandrine Bailleux 636c595b3dSSandrine Bailleux .align 7 646c595b3dSSandrine BailleuxFiqSP0: 656c595b3dSSandrine Bailleux mov x0, #FIQ_SP_EL0 666c595b3dSSandrine Bailleux bl plat_report_exception 676c595b3dSSandrine Bailleux b FiqSP0 686c595b3dSSandrine Bailleux check_vector_size FiqSP0 696c595b3dSSandrine Bailleux 706c595b3dSSandrine Bailleux .align 7 716c595b3dSSandrine BailleuxSErrorSP0: 726c595b3dSSandrine Bailleux mov x0, #SERROR_SP_EL0 736c595b3dSSandrine Bailleux bl plat_report_exception 746c595b3dSSandrine Bailleux b SErrorSP0 756c595b3dSSandrine Bailleux check_vector_size SErrorSP0 766c595b3dSSandrine Bailleux 776c595b3dSSandrine Bailleux /* ----------------------------------------------------- 786c595b3dSSandrine Bailleux * Current EL with SPx: 0x200 - 0x380 796c595b3dSSandrine Bailleux * ----------------------------------------------------- 806c595b3dSSandrine Bailleux */ 816c595b3dSSandrine Bailleux .align 7 826c595b3dSSandrine BailleuxSynchronousExceptionSPx: 836c595b3dSSandrine Bailleux mov x0, #SYNC_EXCEPTION_SP_ELX 846c595b3dSSandrine Bailleux bl plat_report_exception 856c595b3dSSandrine Bailleux b SynchronousExceptionSPx 866c595b3dSSandrine Bailleux check_vector_size SynchronousExceptionSPx 876c595b3dSSandrine Bailleux 886c595b3dSSandrine Bailleux .align 7 896c595b3dSSandrine BailleuxIrqSPx: 906c595b3dSSandrine Bailleux mov x0, #IRQ_SP_ELX 916c595b3dSSandrine Bailleux bl plat_report_exception 926c595b3dSSandrine Bailleux b IrqSPx 936c595b3dSSandrine Bailleux check_vector_size IrqSPx 946c595b3dSSandrine Bailleux 956c595b3dSSandrine Bailleux .align 7 966c595b3dSSandrine BailleuxFiqSPx: 976c595b3dSSandrine Bailleux mov x0, #FIQ_SP_ELX 986c595b3dSSandrine Bailleux bl plat_report_exception 996c595b3dSSandrine Bailleux b FiqSPx 1006c595b3dSSandrine Bailleux check_vector_size FiqSPx 1016c595b3dSSandrine Bailleux 1026c595b3dSSandrine Bailleux .align 7 1036c595b3dSSandrine BailleuxSErrorSPx: 1046c595b3dSSandrine Bailleux mov x0, #SERROR_SP_ELX 1056c595b3dSSandrine Bailleux bl plat_report_exception 1066c595b3dSSandrine Bailleux b SErrorSPx 1076c595b3dSSandrine Bailleux check_vector_size SErrorSPx 1086c595b3dSSandrine Bailleux 1096c595b3dSSandrine Bailleux /* ----------------------------------------------------- 1106c595b3dSSandrine Bailleux * Lower EL using AArch64 : 0x400 - 0x580 1116c595b3dSSandrine Bailleux * ----------------------------------------------------- 1126c595b3dSSandrine Bailleux */ 1136c595b3dSSandrine Bailleux .align 7 1146c595b3dSSandrine BailleuxSynchronousExceptionA64: 1156c595b3dSSandrine Bailleux mov x0, #SYNC_EXCEPTION_AARCH64 1166c595b3dSSandrine Bailleux bl plat_report_exception 1176c595b3dSSandrine Bailleux b SynchronousExceptionA64 1186c595b3dSSandrine Bailleux check_vector_size SynchronousExceptionA64 1196c595b3dSSandrine Bailleux 1206c595b3dSSandrine Bailleux .align 7 1216c595b3dSSandrine BailleuxIrqA64: 1226c595b3dSSandrine Bailleux mov x0, #IRQ_AARCH64 1236c595b3dSSandrine Bailleux bl plat_report_exception 1246c595b3dSSandrine Bailleux b IrqA64 1256c595b3dSSandrine Bailleux check_vector_size IrqA64 1266c595b3dSSandrine Bailleux 1276c595b3dSSandrine Bailleux .align 7 1286c595b3dSSandrine BailleuxFiqA64: 1296c595b3dSSandrine Bailleux mov x0, #FIQ_AARCH64 1306c595b3dSSandrine Bailleux bl plat_report_exception 1316c595b3dSSandrine Bailleux b FiqA64 1326c595b3dSSandrine Bailleux check_vector_size FiqA64 1336c595b3dSSandrine Bailleux 1346c595b3dSSandrine Bailleux .align 7 1356c595b3dSSandrine BailleuxSErrorA64: 1366c595b3dSSandrine Bailleux mov x0, #SERROR_AARCH64 1376c595b3dSSandrine Bailleux bl plat_report_exception 1386c595b3dSSandrine Bailleux b SErrorA64 1396c595b3dSSandrine Bailleux check_vector_size SErrorA64 1406c595b3dSSandrine Bailleux 1416c595b3dSSandrine Bailleux /* ----------------------------------------------------- 1426c595b3dSSandrine Bailleux * Lower EL using AArch32 : 0x0 - 0x180 1436c595b3dSSandrine Bailleux * ----------------------------------------------------- 1446c595b3dSSandrine Bailleux */ 1456c595b3dSSandrine Bailleux .align 7 1466c595b3dSSandrine BailleuxSynchronousExceptionA32: 1476c595b3dSSandrine Bailleux mov x0, #SYNC_EXCEPTION_AARCH32 1486c595b3dSSandrine Bailleux bl plat_report_exception 1496c595b3dSSandrine Bailleux b SynchronousExceptionA32 1506c595b3dSSandrine Bailleux check_vector_size SynchronousExceptionA32 1516c595b3dSSandrine Bailleux 1526c595b3dSSandrine Bailleux .align 7 1536c595b3dSSandrine BailleuxIrqA32: 1546c595b3dSSandrine Bailleux mov x0, #IRQ_AARCH32 1556c595b3dSSandrine Bailleux bl plat_report_exception 1566c595b3dSSandrine Bailleux b IrqA32 1576c595b3dSSandrine Bailleux check_vector_size IrqA32 1586c595b3dSSandrine Bailleux 1596c595b3dSSandrine Bailleux .align 7 1606c595b3dSSandrine BailleuxFiqA32: 1616c595b3dSSandrine Bailleux mov x0, #FIQ_AARCH32 1626c595b3dSSandrine Bailleux bl plat_report_exception 1636c595b3dSSandrine Bailleux b FiqA32 1646c595b3dSSandrine Bailleux check_vector_size FiqA32 1656c595b3dSSandrine Bailleux 1666c595b3dSSandrine Bailleux .align 7 1676c595b3dSSandrine BailleuxSErrorA32: 1686c595b3dSSandrine Bailleux mov x0, #SERROR_AARCH32 1696c595b3dSSandrine Bailleux bl plat_report_exception 1706c595b3dSSandrine Bailleux b SErrorA32 1716c595b3dSSandrine Bailleux check_vector_size SErrorA32 172