2 * Exception Handling support specific for AArch64
4 * Copyright (c) 2016 HP Development Company, L.P.
6 * This program and the accompanying materials
7 * are licensed and made available under the terms and conditions of the BSD License
8 * which accompanies this distribution. The full text of the license may be found at
9 * http://opensource.org/licenses/bsd-license.php
11 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #include <Chipset/AArch64.h>
20 #include <Protocol/DebugSupport.h> // for MAX_AARCH64_EXCEPTION
22 UINTN gMaxExceptionNumber
= MAX_AARCH64_EXCEPTION
;
23 EFI_EXCEPTION_CALLBACK gExceptionHandlers
[MAX_AARCH64_EXCEPTION
+ 1] = { 0 };
24 EFI_EXCEPTION_CALLBACK gDebuggerExceptionHandlers
[MAX_AARCH64_EXCEPTION
+ 1] = { 0 };
25 PHYSICAL_ADDRESS gExceptionVectorAlignmentMask
= ARM_VECTOR_TABLE_ALIGNMENT
;
26 UINTN gDebuggerNoHandlerValue
= 0; // todo: define for AArch64
28 RETURN_STATUS
ArchVectorConfig(
29 IN UINTN VectorBaseAddress
34 if (ArmReadCurrentEL() == AARCH64_EL2
) {
35 HcrReg
= ArmReadHcr();
37 // Trap General Exceptions. All exceptions that would be routed to EL1 are routed to EL2
38 HcrReg
|= ARM_HCR_TGE
;
43 return RETURN_SUCCESS
;