Inherit entries from previous IDT when new IDT is installed.

Update CS in each inherited IDT entry to match CS for the new GDT.


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10765 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
mdkinney 2010-08-03 04:54:44 +00:00
parent 756ad8f8e9
commit 0564ae5ee6
1 changed files with 23 additions and 6 deletions

View File

@ -1014,11 +1014,12 @@ InitInterruptDescriptorTable (
VOID
)
{
EFI_STATUS Status;
VOID *IdtPtrAlignmentBuffer;
IA32_DESCRIPTOR *IdtPtr;
UINTN Index;
UINTN CurrentHandler;
EFI_STATUS Status;
VOID *IdtPtrAlignmentBuffer;
IA32_DESCRIPTOR *IdtPtr;
UINTN Index;
UINTN CurrentHandler;
IA32_DESCRIPTOR Idtr;
SetMem (ExternalVectorTable, sizeof(ExternalVectorTable), 0);
@ -1028,7 +1029,6 @@ InitInterruptDescriptorTable (
CurrentHandler = (UINTN)AsmIdtVector00;
for (Index = 0; Index < INTERRUPT_VECTOR_NUMBER; Index ++, CurrentHandler += 0x08) {
gIdtTable[Index].Bits.OffsetLow = (UINT16)CurrentHandler;
gIdtTable[Index].Bits.Selector = AsmReadCs();
gIdtTable[Index].Bits.Reserved_0 = 0;
gIdtTable[Index].Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
gIdtTable[Index].Bits.OffsetHigh = (UINT16)(CurrentHandler >> 16);
@ -1038,6 +1038,23 @@ InitInterruptDescriptorTable (
#endif
}
//
// Get original IDT address and size.
//
AsmReadIdtr ((IA32_DESCRIPTOR *) &Idtr);
//
// Copy original IDT entry.
//
CopyMem (&gIdtTable[0], (VOID *) Idtr.Base, Idtr.Limit + 1);
//
// Update all IDT enties to use cuurent CS value
//
for (Index = 0; Index < INTERRUPT_VECTOR_NUMBER; Index ++, CurrentHandler += 0x08) {
gIdtTable[Index].Bits.Selector = AsmReadCs();
}
//
// Load IDT Pointer
//