]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/ArmExceptionLib/Arm/ArmException.c
ArmPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / ArmPkg / Library / ArmExceptionLib / Arm / ArmException.c
CommitLineData
2939c778
EC
1/** @file\r
2* Exception handling support specific for ARM\r
3*\r
4* Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
5* Copyright (c) 2014, ARM Limited. All rights reserved.<BR>\r
6* Copyright (c) 2016 HP Development Company, L.P.<BR>\r
7*\r
4059386c 8* SPDX-License-Identifier: BSD-2-Clause-Patent\r
2939c778
EC
9*\r
10**/\r
11\r
12#include <Uefi.h>\r
13\r
14#include <Chipset/ArmV7.h>\r
15\r
16#include <Library/ArmLib.h>\r
17\r
18#include <Protocol/DebugSupport.h> // for MAX_ARM_EXCEPTION\r
19\r
20UINTN gMaxExceptionNumber = MAX_ARM_EXCEPTION;\r
21EFI_EXCEPTION_CALLBACK gExceptionHandlers[MAX_ARM_EXCEPTION + 1] = { 0 };\r
22EFI_EXCEPTION_CALLBACK gDebuggerExceptionHandlers[MAX_ARM_EXCEPTION + 1] = { 0 };\r
23PHYSICAL_ADDRESS gExceptionVectorAlignmentMask = ARM_VECTOR_TABLE_ALIGNMENT;\r
24\r
25// Exception handler contains branch to vector location (jmp $) so no handler\r
26// NOTE: This code assumes vectors are ARM and not Thumb code\r
27UINTN gDebuggerNoHandlerValue = 0xEAFFFFFE;\r
28\r
29RETURN_STATUS ArchVectorConfig(\r
30 IN UINTN VectorBaseAddress\r
31 )\r
32{\r
33 // if the vector address corresponds to high vectors\r
34 if (VectorBaseAddress == 0xFFFF0000) {\r
35 // set SCTLR.V to enable high vectors\r
36 ArmSetHighVectors();\r
37 }\r
38 else {\r
39 // Set SCTLR.V to 0 to enable VBAR to be used\r
40 ArmSetLowVectors();\r
41 }\r
42\r
43 return RETURN_SUCCESS;\r
44}\r