- if (IdtEntryTable[ExceptionType].RegisteredCallback != NULL) {\r
- if (ExceptionType != SYSTEM_TIMER_VECTOR) {\r
- IdtEntryTable[ExceptionType].RegisteredCallback (ExceptionType, ContextRecord);\r
- } else {\r
- OrigVector = IdtEntryTable[ExceptionType].OrigVector;\r
- IdtEntryTable[ExceptionType].RegisteredCallback (ContextRecord);\r
+ EFI_EXCEPTION_TYPE ExceptionType;\r
+\r
+ //\r
+ // Check whether FxStor instructions are supported.\r
+ //\r
+ if (!FxStorSupport ()) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ IdtEntryTable = AllocateZeroPool (sizeof (IDT_ENTRY) * NUM_IDT_ENTRIES);\r
+ if (IdtEntryTable == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ for (ExceptionType = 0; ExceptionType < NUM_IDT_ENTRIES; ExceptionType ++) {\r
+ IdtEntryTable[ExceptionType].StubEntry = (DEBUG_PROC) (UINTN) AllocatePool (StubSize);\r
+ if (IdtEntryTable[ExceptionType].StubEntry == NULL) {\r
+ goto ErrorCleanup;\r
+ }\r
+ \r
+ //\r
+ // Copy Interrupt stub code.\r
+ //\r
+ CopyMem ((VOID *)(UINTN)IdtEntryTable[ExceptionType].StubEntry, InterruptEntryStub, StubSize);\r
+ }\r
+ return EFI_SUCCESS;\r
+\r
+ErrorCleanup:\r
+\r
+ for (ExceptionType = 0; ExceptionType < NUM_IDT_ENTRIES; ExceptionType++) {\r
+ if (IdtEntryTable[ExceptionType].StubEntry != NULL) {\r
+ FreePool ((VOID *)(UINTN)IdtEntryTable[ExceptionType].StubEntry);\r