1 /** @file 2 * Exception handling support specific for ARM 3 * 4 * Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> 5 * Copyright (c) 2014, ARM Limited. All rights reserved.<BR> 6 * Copyright (c) 2016 HP Development Company, L.P.<BR> 7 * 8 * This program and the accompanying materials 9 * are licensed and made available under the terms and conditions of the BSD License 10 * which accompanies this distribution. The full text of the license may be found at 11 * http://opensource.org/licenses/bsd-license.php 12 * 13 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15 * 16 **/ 17 18 #include <Uefi.h> 19 20 #include <Chipset/ArmV7.h> 21 22 #include <Library/ArmLib.h> 23 24 #include <Protocol/DebugSupport.h> // for MAX_ARM_EXCEPTION 25 26 UINTN gMaxExceptionNumber = MAX_ARM_EXCEPTION; 27 EFI_EXCEPTION_CALLBACK gExceptionHandlers[MAX_ARM_EXCEPTION + 1] = { 0 }; 28 EFI_EXCEPTION_CALLBACK gDebuggerExceptionHandlers[MAX_ARM_EXCEPTION + 1] = { 0 }; 29 PHYSICAL_ADDRESS gExceptionVectorAlignmentMask = ARM_VECTOR_TABLE_ALIGNMENT; 30 31 // Exception handler contains branch to vector location (jmp $) so no handler 32 // NOTE: This code assumes vectors are ARM and not Thumb code 33 UINTN gDebuggerNoHandlerValue = 0xEAFFFFFE; 34 ArchVectorConfig(IN UINTN VectorBaseAddress)35RETURN_STATUS ArchVectorConfig( 36 IN UINTN VectorBaseAddress 37 ) 38 { 39 // if the vector address corresponds to high vectors 40 if (VectorBaseAddress == 0xFFFF0000) { 41 // set SCTLR.V to enable high vectors 42 ArmSetHighVectors(); 43 } 44 else { 45 // Set SCTLR.V to 0 to enable VBAR to be used 46 ArmSetLowVectors(); 47 } 48 49 return RETURN_SUCCESS; 50 } 51