TianoCore EDK2 master
Loading...
Searching...
No Matches
DxeException.c
Go to the documentation of this file.
1
9#include <PiDxe.h>
10#include "CpuExceptionCommon.h"
11#include <Library/DebugLib.h>
14
15CONST UINTN mDoFarReturnFlag = 0;
16
17RESERVED_VECTORS_DATA mReservedVectorsData[CPU_INTERRUPT_NUM];
18EFI_CPU_INTERRUPT_HANDLER mExternalInterruptHandlerTable[CPU_INTERRUPT_NUM];
19EXCEPTION_HANDLER_DATA mExceptionHandlerData = {
20 CPU_INTERRUPT_NUM,
21 0, // To be fixed
22 mReservedVectorsData,
23 mExternalInterruptHandlerTable
24};
25
26UINT8 mBuffer[CPU_STACK_SWITCH_EXCEPTION_NUMBER * CPU_KNOWN_GOOD_STACK_SIZE
27 + CPU_TSS_GDT_SIZE];
28
35VOID
36EFIAPI
38 IN EFI_EXCEPTION_TYPE ExceptionType,
39 IN EFI_SYSTEM_CONTEXT SystemContext
40 )
41{
42 CommonExceptionHandlerWorker (ExceptionType, SystemContext, &mExceptionHandlerData);
43}
44
62EFIAPI
64 IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL
65 )
66{
67 InitializeSpinLock (&mExceptionHandlerData.DisplayMessageSpinLock);
68 return InitializeCpuExceptionHandlersWorker (VectorInfo, &mExceptionHandlerData);
69}
70
95EFIAPI
97 IN EFI_EXCEPTION_TYPE InterruptType,
98 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
99 )
100{
101 return RegisterCpuInterruptHandlerWorker (InterruptType, InterruptHandler, &mExceptionHandlerData);
102}
103
119EFIAPI
121 IN VOID *Buffer,
122 IN OUT UINTN *BufferSize
123 )
124{
125 UINTN LocalBufferSize;
126 EFI_STATUS Status;
127
128 if ((Buffer == NULL) && (BufferSize == NULL)) {
129 SetMem (mBuffer, sizeof (mBuffer), 0);
130 LocalBufferSize = sizeof (mBuffer);
131 Status = ArchSetupExceptionStack (mBuffer, &LocalBufferSize);
132 ASSERT_EFI_ERROR (Status);
133 return Status;
134 } else {
135 return ArchSetupExceptionStack (Buffer, BufferSize);
136 }
137}
UINT64 UINTN
VOID *EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
Definition: SetMemWrapper.c:38
VOID(EFIAPI * EFI_CPU_INTERRUPT_HANDLER)(IN CONST EFI_EXCEPTION_TYPE InterruptType, IN CONST EFI_SYSTEM_CONTEXT SystemContext)
Definition: Cpu.h:52
EFI_STATUS ArchSetupExceptionStack(IN VOID *Buffer, IN OUT UINTN *BufferSize)
EFI_STATUS RegisterCpuInterruptHandlerWorker(IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler, IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData)
EFI_STATUS InitializeCpuExceptionHandlersWorker(IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL, IN OUT EXCEPTION_HANDLER_DATA *ExceptionHandlerData)
VOID CommonExceptionHandlerWorker(IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext, IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData)
EFI_STATUS EFIAPI InitializeSeparateExceptionStacks(IN VOID *Buffer, IN OUT UINTN *BufferSize)
Definition: DxeException.c:120
EFI_STATUS EFIAPI InitializeCpuExceptionHandlers(IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL)
Definition: DxeException.c:63
EFI_STATUS EFIAPI RegisterCpuInterruptHandler(IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)
Definition: DxeException.c:96
VOID EFIAPI CommonExceptionHandler(IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext)
Definition: DxeException.c:37
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
INTN EFI_EXCEPTION_TYPE
Definition: DebugSupport.h:35
SPIN_LOCK *EFIAPI InitializeSpinLock(OUT SPIN_LOCK *SpinLock)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29