Correct. The old CpuDxe(one year ago) has such code to protect IDT entries used 
by soft debugger.

Now the UefiCpuPkg/CpuDxe has already been updated to support Method to Reserve 
Interrupt and Exception Vectors (Introduced from PI spec 1.2.1). And removed 
such code logic.

Thanks!
Jeff
From: Andrew Fish [mailto:af...@apple.com]
Sent: Thursday, October 30, 2014 10:25 AM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] question about InitInterruptDescriptorTable() function in 
CpuDxe.c


On Oct 29, 2014, at 7:19 PM, 
tiger...@via-alliance.com<mailto:tiger...@via-alliance.com> wrote:

Hi, experts:
I am confused by some codes in InitInterruptDescriptorTable() function (in 
UefiCpuPkg/CpuDxe/CpuDxe.c).
……
  if ((OldIdtPtr.Base != 0) && ((OldIdtPtr.Limit & 7) == 7)) {
// Based on my understanding, because DxeIpl has created IDT when switching 
from P-Mode to Long-Mode.
// So, should execute below code.
    OldIdt = (IA32_IDT_GATE_DESCRIPTOR*) OldIdtPtr.Base;
OldIdtSize = (OldIdtPtr.Limit + 1) / sizeof (IA32_IDT_GATE_DESCRIPTOR);
……
  } else {
    OldIdt = NULL;
    OldIdtSize = 0;
  }
……
  // Based on my understanding,  When come here, index = OldIdtSize = 32, so 
CpuRegisterInterruptHandler() could not be run.
  for (Index = OldIdtSize; Index < 32; Index++) {
    Status = CpuRegisterInterruptHandler (&gCpu, Index, CommonExceptionHandler);
    ASSERT_EFI_ERROR (Status);
  }

My question is:
Because DxeIpl has created IDT, and OldIdtSize = 32, so 
CpuRegisterInterruptHandler() could not be run, right?


I think there is an assumption that the OldIdtSize represents vectors from the 
debugger. If the debugger did not grab any, or all, of the possible exception 
vectors, then this driver hooks in an exception handler.

Thanks,

Andrew Fish



Best wishes,
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to