From dce2c50b9d61776da77cf48ddf4ecefe04f340e2 Mon Sep 17 00:00:00 2001 From: Aiken Harris Date: Sun, 10 Aug 2025 17:39:38 +0200 Subject: [PATCH] Replace hardcoded PML level with dynamic detection using XtpDeterminePagingLevel --- xtldr/modules/xtos_o/xtos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xtldr/modules/xtos_o/xtos.c b/xtldr/modules/xtos_o/xtos.c index abeb3cb..65e0129 100644 --- a/xtldr/modules/xtos_o/xtos.c +++ b/xtldr/modules/xtos_o/xtos.c @@ -410,7 +410,7 @@ XtpBootSequence(IN PEFI_FILE_HANDLE BootDir, VirtualAddress = (PVOID)(KSEG0_BASE + KSEG0_KERNEL_BASE); /* Initialize virtual memory mappings */ - XtLdrProtocol->Memory.InitializePageMap(&PageMap, 3, Size4K); + XtLdrProtocol->Memory.InitializePageMap(&PageMap, XtpDeterminePagingLevel(Parameters->Parameters), Size4K); Status = XtLdrProtocol->Memory.MapEfiMemory(&PageMap, &VirtualMemoryArea, NULL); if(Status != STATUS_EFI_SUCCESS) @@ -572,7 +572,7 @@ XtpInitializeLoaderBlock(IN PXTBL_PAGE_MAPPING PageMap, LoaderBlock->LoaderInformation.DbgPrint = XtLdrProtocol->Debug.Print; /* Store page map level */ - LoaderBlock->LoaderInformation.PageMapLevel = 3; + LoaderBlock->LoaderInformation.PageMapLevel = PageMap->PageMapLevel; /* Attempt to find virtual address of the EFI Runtime Services */ // Status = XtLdrProtocol->GetVirtualAddress(MemoryMappings, &EfiSystemTable->RuntimeServices->Hdr, &RuntimeServices);