/**\r
Internal worker function to update IDT entries accordling to vector attributes.\r
\r
- @param[in] IdtTable Pointer to IDT table.\r
- @param[in] TemplateMap Pointer to a buffer where the address map is returned.\r
- @param[in] IdtEntryCount IDT entries number to be updated.\r
+ @param[in] IdtTable Pointer to IDT table.\r
+ @param[in] TemplateMap Pointer to a buffer where the address map is\r
+ returned.\r
+ @param[in] ExceptionHandlerData Pointer to exception handler data.\r
\r
**/\r
VOID\r
UpdateIdtTable (\r
IN IA32_IDT_GATE_DESCRIPTOR *IdtTable,\r
IN EXCEPTION_HANDLER_TEMPLATE_MAP *TemplateMap,\r
- IN UINTN IdtEntryCount\r
+ IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData\r
);\r
\r
/**\r
UINTN Index;\r
UINTN InterruptEntry;\r
UINT8 *InterruptEntryCode;\r
+ RESERVED_VECTORS_DATA *ReservedVectors;\r
+ EFI_CPU_INTERRUPT_HANDLER *ExternalInterruptHandler;\r
\r
- mReservedVectors = AllocatePool (sizeof (RESERVED_VECTORS_DATA) * CPU_INTERRUPT_NUM);\r
- ASSERT (mReservedVectors != NULL);\r
- SetMem ((VOID *) mReservedVectors, sizeof (RESERVED_VECTORS_DATA) * CPU_INTERRUPT_NUM, 0xff);\r
+ ReservedVectors = AllocatePool (sizeof (RESERVED_VECTORS_DATA) * CPU_INTERRUPT_NUM);\r
+ ASSERT (ReservedVectors != NULL);\r
+ SetMem ((VOID *) ReservedVectors, sizeof (RESERVED_VECTORS_DATA) * CPU_INTERRUPT_NUM, 0xff);\r
if (VectorInfo != NULL) {\r
- Status = ReadAndVerifyVectorInfo (VectorInfo, mReservedVectors, CPU_INTERRUPT_NUM);\r
+ Status = ReadAndVerifyVectorInfo (VectorInfo, ReservedVectors, CPU_INTERRUPT_NUM);\r
if (EFI_ERROR (Status)) {\r
- FreePool (mReservedVectors);\r
+ FreePool (ReservedVectors);\r
return EFI_INVALID_PARAMETER;\r
}\r
}\r
InitializeSpinLock (&mDisplayMessageSpinLock);\r
- mExternalInterruptHandler = AllocateZeroPool (sizeof (EFI_CPU_INTERRUPT_HANDLER) * CPU_INTERRUPT_NUM);\r
- ASSERT (mExternalInterruptHandler != NULL);\r
+ ExternalInterruptHandler = AllocateZeroPool (sizeof (EFI_CPU_INTERRUPT_HANDLER) * CPU_INTERRUPT_NUM);\r
+ ASSERT (ExternalInterruptHandler != NULL);\r
\r
//\r
// Read IDT descriptor and calculate IDT size\r
}\r
\r
TemplateMap.ExceptionStart = (UINTN) InterruptEntryCode;\r
- UpdateIdtTable (IdtTable, &TemplateMap, CPU_INTERRUPT_NUM);\r
+ mExceptionHandlerData.IdtEntryCount = CPU_INTERRUPT_NUM;\r
+ mExceptionHandlerData.ReservedVectors = ReservedVectors;\r
+ mExceptionHandlerData.ExternalInterruptHandler = ExternalInterruptHandler;\r
+ InitializeSpinLock (&mExceptionHandlerData.DisplayMessageSpinLock);\r
+\r
+ UpdateIdtTable (IdtTable, &TemplateMap, &mExceptionHandlerData);\r
\r
//\r
// Load Interrupt Descriptor Table\r
/**\r
Internal worker function to update IDT entries accordling to vector attributes.\r
\r
- @param[in] IdtTable Pointer to IDT table.\r
- @param[in] TemplateMap Pointer to a buffer where the address map is returned.\r
- @param[in] IdtEntryCount IDT entries number to be updated.\r
+ @param[in] IdtTable Pointer to IDT table.\r
+ @param[in] TemplateMap Pointer to a buffer where the address map is\r
+ returned.\r
+ @param[in] ExceptionHandlerData Pointer to exception handler data.\r
\r
**/\r
VOID\r
UpdateIdtTable (\r
IN IA32_IDT_GATE_DESCRIPTOR *IdtTable,\r
IN EXCEPTION_HANDLER_TEMPLATE_MAP *TemplateMap,\r
- IN UINTN IdtEntryCount\r
+ IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData\r
)\r
{\r
UINT16 CodeSegment;\r
UINTN Index;\r
UINTN InterruptHandler;\r
+ RESERVED_VECTORS_DATA *ReservedVectors;\r
\r
+ ReservedVectors = ExceptionHandlerData->ReservedVectors;\r
//\r
// Use current CS as the segment selector of interrupt gate in IDT\r
//\r
CodeSegment = AsmReadCs ();\r
\r
- for (Index = 0; Index < IdtEntryCount; Index ++) {\r
+ for (Index = 0; Index < ExceptionHandlerData->IdtEntryCount; Index ++) {\r
IdtTable[Index].Bits.Selector = CodeSegment;\r
//\r
// Check reserved vectors attributes\r
//\r
- switch (mReservedVectors[Index].Attribute) {\r
+ switch (ReservedVectors[Index].Attribute) {\r
case EFI_VECTOR_HANDOFF_DO_NOT_HOOK:\r
//\r
// Keep original IDT entry\r
//\r
continue;\r
case EFI_VECTOR_HANDOFF_HOOK_AFTER:\r
- InitializeSpinLock (&mReservedVectors[Index].SpinLock);\r
+ InitializeSpinLock (&ReservedVectors[Index].SpinLock);\r
CopyMem (\r
- (VOID *) mReservedVectors[Index].HookAfterStubHeaderCode,\r
+ (VOID *) ReservedVectors[Index].HookAfterStubHeaderCode,\r
(VOID *) TemplateMap->HookAfterStubHeaderStart,\r
TemplateMap->ExceptionStubHeaderSize\r
);\r
AsmVectorNumFixup (\r
- (VOID *) mReservedVectors[Index].HookAfterStubHeaderCode,\r
+ (VOID *) ReservedVectors[Index].HookAfterStubHeaderCode,\r
(UINT8) Index,\r
(VOID *) TemplateMap->HookAfterStubHeaderStart\r
);\r
//\r
// Save original IDT handler address\r
//\r
- mReservedVectors[Index].ExceptonHandler = ArchGetIdtHandler (&IdtTable[Index]);\r
+ ReservedVectors[Index].ExceptonHandler = ArchGetIdtHandler (&IdtTable[Index]);\r
//\r
// Go on the following code\r
//\r
//\r
// Save Interrupt number to global variable used for RegisterCpuInterruptHandler ()\r
//\r
- mEnabledInterruptNum = IdtEntryCount;\r
+ mEnabledInterruptNum = ExceptionHandlerData->IdtEntryCount;\r
}\r
\r
/**\r
IdtTable = (IA32_IDT_GATE_DESCRIPTOR *) IdtDescriptor.Base;\r
AsmGetTemplateAddressMap (&TemplateMap);\r
ASSERT (TemplateMap.ExceptionStubHeaderSize <= HOOKAFTER_STUB_SIZE);\r
- UpdateIdtTable (IdtTable, &TemplateMap, IdtEntryCount);\r
+\r
+ ExceptionHandlerData->IdtEntryCount = IdtEntryCount;\r
+ UpdateIdtTable (IdtTable, &TemplateMap, ExceptionHandlerData);\r
mEnabledInterruptNum = IdtEntryCount;\r
return EFI_SUCCESS;\r
}\r