32 switch (ExceptionType) {
44 if (!EFI_ERROR (Status)) {
61 if (!EFI_ERROR (Status)) {
72 ReservedVectors = ExceptionHandlerData->ReservedVectors;
73 ExternalInterruptHandler = ExceptionHandlerData->ExternalInterruptHandler;
75 switch (ReservedVectors[ExceptionType].Attribute) {
76 case EFI_VECTOR_HANDOFF_HOOK_BEFORE:
81 ExceptionHandlerContext->ExceptionDataFlag = (mErrorCodeFlag & (1 << ExceptionType)) ?
TRUE :
FALSE;
82 ExceptionHandlerContext->OldIdtHandler = ReservedVectors[ExceptionType].ExceptonHandler;
84 case EFI_VECTOR_HANDOFF_HOOK_AFTER:
95 ReservedVectors[ExceptionType].ApicId =
GetApicId ();
97 ExceptionHandlerContext->ExceptionDataFlag = (mErrorCodeFlag & (1 << ExceptionType)) ?
TRUE :
FALSE;
98 ExceptionHandlerContext->OldIdtHandler = ReservedVectors[ExceptionType].ExceptonHandler;
106 if (ReservedVectors[ExceptionType].ApicId ==
GetApicId ()) {
133 if ((ExternalInterruptHandler !=
NULL) &&
134 (ExternalInterruptHandler[ExceptionType] !=
NULL))
136 (ExternalInterruptHandler[ExceptionType])(ExceptionType, SystemContext);
137 }
else if (ExceptionType < CPU_EXCEPTION_NUM) {
160 if (ReservedVectors[ExceptionType].Attribute != EFI_VECTOR_HANDOFF_HOOK_BEFORE) {
177 IN IA32_IDT_GATE_DESCRIPTOR *IdtTable,
184 UINTN InterruptHandler;
187 ReservedVectors = ExceptionHandlerData->ReservedVectors;
193 for (Index = 0; Index < ExceptionHandlerData->IdtEntryCount; Index++) {
194 IdtTable[Index].Bits.Selector = CodeSegment;
198 switch (ReservedVectors[Index].Attribute) {
204 case EFI_VECTOR_HANDOFF_HOOK_AFTER:
207 (VOID *)ReservedVectors[Index].HookAfterStubHeaderCode,
208 (VOID *)TemplateMap->HookAfterStubHeaderStart,
209 TemplateMap->ExceptionStubHeaderSize
212 (VOID *)ReservedVectors[Index].HookAfterStubHeaderCode,
214 (VOID *)TemplateMap->HookAfterStubHeaderStart
219 case EFI_VECTOR_HANDOFF_HOOK_BEFORE:
231 InterruptHandler = TemplateMap->ExceptionStart + Index * TemplateMap->ExceptionStubHeaderSize;
257 IA32_DESCRIPTOR IdtDescriptor;
260 IA32_IDT_GATE_DESCRIPTOR *IdtTable;
263 ReservedVectors = ExceptionHandlerData->ReservedVectors;
265 if (VectorInfo !=
NULL) {
267 if (EFI_ERROR (Status)) {
268 return EFI_INVALID_PARAMETER;
277 IdtEntryCount = (IdtDescriptor.Limit + 1) /
sizeof (IA32_IDT_GATE_DESCRIPTOR);
278 ExceptionHandlerData->IdtEntryCount =
MIN (IdtEntryCount, ExceptionHandlerData->IdtEntryCount);
280 IdtTable = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base;
282 ASSERT (TemplateMap.ExceptionStubHeaderSize <= HOOKAFTER_STUB_SIZE);
313 UINTN EnabledInterruptNum;
317 EnabledInterruptNum = ExceptionHandlerData->IdtEntryCount;
318 ReservedVectors = ExceptionHandlerData->ReservedVectors;
319 ExternalInterruptHandler = ExceptionHandlerData->ExternalInterruptHandler;
321 if ((InterruptType < 0) || (InterruptType >= (
EFI_EXCEPTION_TYPE)EnabledInterruptNum) ||
324 return EFI_UNSUPPORTED;
327 if ((InterruptHandler ==
NULL) && (ExternalInterruptHandler[InterruptType] ==
NULL)) {
328 return EFI_INVALID_PARAMETER;
331 if ((InterruptHandler !=
NULL) && (ExternalInterruptHandler[InterruptType] !=
NULL)) {
332 return EFI_ALREADY_STARTED;
335 ExternalInterruptHandler[InterruptType] = InterruptHandler;
RETURN_STATUS EFIAPI SerialPortInitialize(VOID)
VOID EFIAPI CpuDeadLoop(VOID)
VOID EFIAPI CpuPause(VOID)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
EFI_STATUS EFIAPI CcExitHandleVe(IN OUT EFI_EXCEPTION_TYPE *ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext)
VOID(EFIAPI * EFI_CPU_INTERRUPT_HANDLER)(IN CONST EFI_EXCEPTION_TYPE InterruptType, IN CONST EFI_SYSTEM_CONTEXT SystemContext)
EFI_STATUS ReadAndVerifyVectorInfo(IN EFI_VECTOR_HANDOFF_INFO *VectorInfo, OUT RESERVED_VECTORS_DATA *ReservedVector, IN UINTN VectorCount)
VOID ArchSaveExceptionContext(IN UINTN ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext, IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData)
VOID EFIAPI AsmVectorNumFixup(IN VOID *NewVectorAddr, IN UINT8 VectorNum, IN VOID *OldVectorAddr)
VOID ArchRestoreExceptionContext(IN UINTN ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext, IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData)
VOID DumpImageAndCpuContent(IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext)
VOID EFIAPI AsmGetTemplateAddressMap(OUT EXCEPTION_HANDLER_TEMPLATE_MAP *AddressMap)
UINTN ArchGetIdtHandler(IN IA32_IDT_GATE_DESCRIPTOR *IdtEntry)
VOID ArchUpdateIdtEntry(OUT IA32_IDT_GATE_DESCRIPTOR *IdtEntry, IN UINTN InterruptHandler)
UINT16 EFIAPI AsmReadCs(VOID)
UINT32 EFIAPI GetApicId(VOID)
EFI_STATUS EFIAPI CcExitHandleVc(IN OUT EFI_EXCEPTION_TYPE *ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext)
EFI_STATUS RegisterCpuInterruptHandlerWorker(IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler, IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData)
VOID UpdateIdtTable(IN IA32_IDT_GATE_DESCRIPTOR *IdtTable, IN EXCEPTION_HANDLER_TEMPLATE_MAP *TemplateMap, 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)
SPIN_LOCK *EFIAPI InitializeSpinLock(OUT SPIN_LOCK *SpinLock)
SPIN_LOCK *EFIAPI ReleaseSpinLock(IN OUT SPIN_LOCK *SpinLock)
BOOLEAN EFIAPI AcquireSpinLockOrFail(IN OUT SPIN_LOCK *SpinLock)
#define EFI_VECTOR_HANDOFF_DO_NOT_HOOK
VOID EFIAPI AsmReadIdtr(OUT IA32_DESCRIPTOR *Idtr)