Ring3: Added Idt to User page table.

This commit is contained in:
Mikhail Krichanov 2024-11-29 19:40:26 +03:00
parent 1a5a22e450
commit 63dcc29d15
2 changed files with 17 additions and 3 deletions

View File

@ -213,6 +213,7 @@ InitializeUserPageTable (
UINTN SectionAddress;
UINT32 Index;
UEFI_IMAGE_RECORD *UserImageRecord;
IA32_DESCRIPTOR IdtDescriptor;
UserPageTable = (UINTN)AllocatePages (EFI_SIZE_TO_PAGES (mUserPageTableTemplateSize));
@ -261,7 +262,7 @@ InitializeUserPageTable (
}
//
// Map CoreBootServices, gCoreSysCallStackBase, ExceptionHandlers, ExceptionStacks
// Map CoreBootServices, gCoreSysCallStackBase
//
gCpu->SetUserMemoryAttributes (
gCpu,
@ -286,7 +287,10 @@ InitializeUserPageTable (
EFI_SIZE_TO_PAGES (USER_STACK_SIZE) * EFI_PAGE_SIZE,
EFI_MEMORY_XP
);
//
// Map ExceptionHandlers, ExceptionStacks, Idt
//
gCpu->SetUserMemoryAttributes (
gCpu,
UserPageTable,
@ -311,6 +315,15 @@ InitializeUserPageTable (
EFI_MEMORY_XP
);
AsmReadIdtr (&IdtDescriptor);
gCpu->SetUserMemoryAttributes (
gCpu,
UserPageTable,
IdtDescriptor.Base,
SIZE_4KB,
EFI_MEMORY_RO | EFI_MEMORY_XP
);
//
// Necessary fix for ProcessLibraryConstructorList() -> DxeCcProbeLibConstructor()
//

View File

@ -728,8 +728,9 @@ InitInterruptDescriptorTable (
//
// Increase Interrupt Descriptor Table and Copy the old IDT table in
//
IdtTable = AllocateZeroPool (sizeof (IA32_IDT_GATE_DESCRIPTOR) * CPU_INTERRUPT_NUM);
IdtTable = AllocatePages (1);
ASSERT (IdtTable != NULL);
SetMem (IdtTable, EFI_PAGE_SIZE, 0);
CopyMem (IdtTable, (VOID *)IdtDescriptor.Base, sizeof (IA32_IDT_GATE_DESCRIPTOR) * IdtEntryCount);
//