diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c index 68579a7da0..2895da8571 100644 --- a/UefiCpuPkg/CpuDxe/CpuDxe.c +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c @@ -1014,6 +1014,7 @@ InitInterruptDescriptorTable ( IA32_DESCRIPTOR *IdtPtr; UINTN Index; UINTN CurrentHandler; + BOOLEAN InterruptState; SetMem (ExternalVectorTable, sizeof(ExternalVectorTable), 0); @@ -1040,7 +1041,19 @@ InitInterruptDescriptorTable ( IdtPtr = ALIGN_POINTER (IdtPtrAlignmentBuffer, 16); IdtPtr->Base = (UINT32)(((UINTN)(VOID*) gIdtTable) & (BASE_4GB-1)); IdtPtr->Limit = sizeof (gIdtTable) - 1; + + // + // Disable interrupts and save the current interrupt state + // + InterruptState = SaveAndDisableInterrupts (); + AsmWriteIdtr (IdtPtr); + + // + // Restore the interrupt state + // + SetInterruptState (InterruptState); + FreePool (IdtPtrAlignmentBuffer); //