TianoCore EDK2 master
Loading...
Searching...
No Matches
Exception.c
Go to the documentation of this file.
1
10#include "CpuDxe.h"
13
17 )
18{
19 EFI_STATUS Status;
20 EFI_VECTOR_HANDOFF_INFO *VectorInfoList;
21 EFI_VECTOR_HANDOFF_INFO *VectorInfo;
22 BOOLEAN IrqEnabled;
23 BOOLEAN FiqEnabled;
24
25 VectorInfo = (EFI_VECTOR_HANDOFF_INFO *)NULL;
26 Status = EfiGetSystemConfigurationTable (&gEfiVectorHandoffTableGuid, (VOID **)&VectorInfoList);
27 if ((Status == EFI_SUCCESS) && (VectorInfoList != NULL)) {
28 VectorInfo = VectorInfoList;
29 }
30
31 // initialize the CpuExceptionHandlerLib so we take over the exception vector table from the DXE Core
32 InitializeCpuExceptionHandlers (VectorInfo);
33
34 Status = EFI_SUCCESS;
35
36 //
37 // Disable interrupts
38 //
39 Cpu->GetInterruptState (Cpu, &IrqEnabled);
40 Cpu->DisableInterrupt (Cpu);
41
42 //
43 // EFI does not use the FIQ, but a debugger might so we must disable
44 // as we take over the exception vectors.
45 //
46 FiqEnabled = ArmGetFiqState ();
47 ArmDisableFiq ();
48
49 if (FiqEnabled) {
50 ArmEnableFiq ();
51 }
52
53 if (IrqEnabled) {
54 //
55 // Restore interrupt state
56 //
57 Status = Cpu->EnableInterrupt (Cpu);
58 }
59
60 //
61 // On a DEBUG build, unmask SErrors so they are delivered right away rather
62 // than when the OS unmasks them. This gives us a better chance of figuring
63 // out the cause.
64 //
66 ArmEnableAsynchronousAbort ();
67 );
68
69 return Status;
70}
71
94 IN EFI_EXCEPTION_TYPE InterruptType,
95 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
96 )
97{
98 // pass down to CpuExceptionHandlerLib
99 return (EFI_STATUS)RegisterCpuInterruptHandler (InterruptType, InterruptHandler);
100}
EFI_STATUS RegisterInterruptHandler(IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)
Definition: Exception.c:93
EFI_STATUS InitializeExceptions(IN EFI_CPU_ARCH_PROTOCOL *Cpu)
Definition: Exception.c:15
VOID(EFIAPI * EFI_CPU_INTERRUPT_HANDLER)(IN CONST EFI_EXCEPTION_TYPE InterruptType, IN CONST EFI_SYSTEM_CONTEXT SystemContext)
Definition: Cpu.h:52
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define DEBUG_CODE(Expression)
Definition: DebugLib.h:590
INTN EFI_EXCEPTION_TYPE
Definition: DebugSupport.h:35
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_STATUS EFIAPI EfiGetSystemConfigurationTable(IN EFI_GUID *TableGuid, OUT VOID **Table)
Definition: UefiLib.c:82