/** @file\r
CPU DXE Module to produce CPU ARCH Protocol.\r
\r
- Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2008 - 2022, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
#include "CpuMp.h"\r
#include "CpuPageTable.h"\r
\r
+#define CPU_INTERRUPT_NUM 256\r
+\r
//\r
// Global Variables\r
//\r
VOID\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_VECTOR_HANDOFF_INFO *VectorInfoList;\r
- EFI_VECTOR_HANDOFF_INFO *VectorInfo;\r
+ EFI_STATUS Status;\r
+ EFI_VECTOR_HANDOFF_INFO *VectorInfoList;\r
+ EFI_VECTOR_HANDOFF_INFO *VectorInfo;\r
+ IA32_IDT_GATE_DESCRIPTOR *IdtTable;\r
+ IA32_DESCRIPTOR IdtDescriptor;\r
+ UINTN IdtEntryCount;\r
\r
VectorInfo = NULL;\r
Status = EfiGetSystemConfigurationTable (&gEfiVectorHandoffTableGuid, (VOID **)&VectorInfoList);\r
VectorInfo = VectorInfoList;\r
}\r
\r
- Status = InitializeCpuInterruptHandlers (VectorInfo);\r
+ AsmReadIdtr (&IdtDescriptor);\r
+ IdtEntryCount = (IdtDescriptor.Limit + 1) / sizeof (IA32_IDT_GATE_DESCRIPTOR);\r
+ if (IdtEntryCount < CPU_INTERRUPT_NUM) {\r
+ //\r
+ // Increase Interrupt Descriptor Table and Copy the old IDT table in\r
+ //\r
+ IdtTable = AllocateZeroPool (sizeof (IA32_IDT_GATE_DESCRIPTOR) * CPU_INTERRUPT_NUM);\r
+ ASSERT (IdtTable != NULL);\r
+ CopyMem (IdtTable, (VOID *)IdtDescriptor.Base, sizeof (IA32_IDT_GATE_DESCRIPTOR) * IdtEntryCount);\r
+\r
+ //\r
+ // Load Interrupt Descriptor Table\r
+ //\r
+ IdtDescriptor.Base = (UINTN)IdtTable;\r
+ IdtDescriptor.Limit = (UINT16)(sizeof (IA32_IDT_GATE_DESCRIPTOR) * CPU_INTERRUPT_NUM - 1);\r
+ AsmWriteIdtr (&IdtDescriptor);\r
+ }\r
+\r
+ Status = InitializeCpuExceptionHandlers (VectorInfo);\r
ASSERT_EFI_ERROR (Status);\r
}\r
\r