mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-10 15:24:28 +02:00
Ring3: Added Idt to User page table.
This commit is contained in:
parent
1a5a22e450
commit
63dcc29d15
@ -213,6 +213,7 @@ InitializeUserPageTable (
|
|||||||
UINTN SectionAddress;
|
UINTN SectionAddress;
|
||||||
UINT32 Index;
|
UINT32 Index;
|
||||||
UEFI_IMAGE_RECORD *UserImageRecord;
|
UEFI_IMAGE_RECORD *UserImageRecord;
|
||||||
|
IA32_DESCRIPTOR IdtDescriptor;
|
||||||
|
|
||||||
UserPageTable = (UINTN)AllocatePages (EFI_SIZE_TO_PAGES (mUserPageTableTemplateSize));
|
UserPageTable = (UINTN)AllocatePages (EFI_SIZE_TO_PAGES (mUserPageTableTemplateSize));
|
||||||
|
|
||||||
@ -261,7 +262,7 @@ InitializeUserPageTable (
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Map CoreBootServices, gCoreSysCallStackBase, ExceptionHandlers, ExceptionStacks
|
// Map CoreBootServices, gCoreSysCallStackBase
|
||||||
//
|
//
|
||||||
gCpu->SetUserMemoryAttributes (
|
gCpu->SetUserMemoryAttributes (
|
||||||
gCpu,
|
gCpu,
|
||||||
@ -286,7 +287,10 @@ InitializeUserPageTable (
|
|||||||
EFI_SIZE_TO_PAGES (USER_STACK_SIZE) * EFI_PAGE_SIZE,
|
EFI_SIZE_TO_PAGES (USER_STACK_SIZE) * EFI_PAGE_SIZE,
|
||||||
EFI_MEMORY_XP
|
EFI_MEMORY_XP
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Map ExceptionHandlers, ExceptionStacks, Idt
|
||||||
|
//
|
||||||
gCpu->SetUserMemoryAttributes (
|
gCpu->SetUserMemoryAttributes (
|
||||||
gCpu,
|
gCpu,
|
||||||
UserPageTable,
|
UserPageTable,
|
||||||
@ -311,6 +315,15 @@ InitializeUserPageTable (
|
|||||||
EFI_MEMORY_XP
|
EFI_MEMORY_XP
|
||||||
);
|
);
|
||||||
|
|
||||||
|
AsmReadIdtr (&IdtDescriptor);
|
||||||
|
gCpu->SetUserMemoryAttributes (
|
||||||
|
gCpu,
|
||||||
|
UserPageTable,
|
||||||
|
IdtDescriptor.Base,
|
||||||
|
SIZE_4KB,
|
||||||
|
EFI_MEMORY_RO | EFI_MEMORY_XP
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Necessary fix for ProcessLibraryConstructorList() -> DxeCcProbeLibConstructor()
|
// Necessary fix for ProcessLibraryConstructorList() -> DxeCcProbeLibConstructor()
|
||||||
//
|
//
|
||||||
|
@ -728,8 +728,9 @@ InitInterruptDescriptorTable (
|
|||||||
//
|
//
|
||||||
// Increase Interrupt Descriptor Table and Copy the old IDT table in
|
// 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);
|
ASSERT (IdtTable != NULL);
|
||||||
|
SetMem (IdtTable, EFI_PAGE_SIZE, 0);
|
||||||
CopyMem (IdtTable, (VOID *)IdtDescriptor.Base, sizeof (IA32_IDT_GATE_DESCRIPTOR) * IdtEntryCount);
|
CopyMem (IdtTable, (VOID *)IdtDescriptor.Base, sizeof (IA32_IDT_GATE_DESCRIPTOR) * IdtEntryCount);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user