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