]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/ArmExceptionLib/AArch64/AArch64Exception.c
UefiCpuPkg/RegisterCpuFeaturesLib: Add ASSERT on allocated memory
[mirror_edk2.git] / ArmPkg / Library / ArmExceptionLib / AArch64 / AArch64Exception.c
CommitLineData
2939c778
EC
1/** @file\r
2* Exception Handling support specific for AArch64\r
3*\r
4* Copyright (c) 2016 HP Development Company, L.P.\r
5*\r
6* This program and the accompanying materials\r
7* are licensed and made available under the terms and conditions of the BSD License\r
8* which accompanies this distribution. The full text of the license may be found at\r
9* http://opensource.org/licenses/bsd-license.php\r
10*\r
11* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13*\r
14**/\r
15\r
16#include <Uefi.h>\r
17\r
18#include <Chipset/AArch64.h>\r
19\r
20#include <Protocol/DebugSupport.h> // for MAX_AARCH64_EXCEPTION\r
21\r
22UINTN gMaxExceptionNumber = MAX_AARCH64_EXCEPTION;\r
23EFI_EXCEPTION_CALLBACK gExceptionHandlers[MAX_AARCH64_EXCEPTION + 1] = { 0 };\r
24EFI_EXCEPTION_CALLBACK gDebuggerExceptionHandlers[MAX_AARCH64_EXCEPTION + 1] = { 0 };\r
25PHYSICAL_ADDRESS gExceptionVectorAlignmentMask = ARM_VECTOR_TABLE_ALIGNMENT;\r
26UINTN gDebuggerNoHandlerValue = 0; // todo: define for AArch64\r
27\r
28RETURN_STATUS ArchVectorConfig(\r
29 IN UINTN VectorBaseAddress\r
30 )\r
31{\r
32 UINTN HcrReg;\r
33\r
34 if (ArmReadCurrentEL() == AARCH64_EL2) {\r
35 HcrReg = ArmReadHcr();\r
36\r
37 // Trap General Exceptions. All exceptions that would be routed to EL1 are routed to EL2\r
38 HcrReg |= ARM_HCR_TGE;\r
39\r
40 ArmWriteHcr(HcrReg);\r
41 }\r
42\r
43 return RETURN_SUCCESS;\r
44}\r