From 544ec63d6e592602b3fa01be5b3ff772493477d1 Mon Sep 17 00:00:00 2001 From: Aiken Harris Date: Mon, 4 Aug 2025 23:22:23 +0200 Subject: [PATCH] Remove global BlpGetNextPageTable implementation in favor of arch-specific versions --- xtldr/memory.c | 72 -------------------------------------------------- 1 file changed, 72 deletions(-) diff --git a/xtldr/memory.c b/xtldr/memory.c index 953bab4..c135d03 100644 --- a/xtldr/memory.c +++ b/xtldr/memory.c @@ -739,75 +739,3 @@ BlpGetLoaderMemoryType(IN EFI_MEMORY_TYPE EfiMemoryType) /* Return XTLDR memory type */ return MemoryType; } - -/** - * Returns next level of the Page Table. - * - * @param PageMap - * Supplies a pointer to the page mapping structure. - * - * @param PageTable - * Supplies a pointer to the current Page Table. - * - * @param Entry - * Supplies an index of the current Page Table entry. - * - * @param NextPageTable - * Supplies a pointer to the memory area where the next Page Table level is returned. - * - * @return This routine returns a status code. - * - * @since XT 1.0 - */ -XTCDECL -EFI_STATUS -BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap, - IN PHARDWARE_PTE PageTable, - IN SIZE_T Entry, - OUT PHARDWARE_PTE *NextPageTable) -{ - EFI_PHYSICAL_ADDRESS Address; - ULONGLONG PmlPointer; - EFI_STATUS Status; - - /* Check if this is a valid table */ - if(PageTable[Entry].Valid) - { - /* Get PML pointer */ - PmlPointer = PageTable[Entry].PageFrameNumber; - PmlPointer <<= EFI_PAGE_SHIFT; - } - else - { - /* Allocate pages for new PML entry */ - Status = BlAllocateMemoryPages(1, &Address); - if(Status != STATUS_EFI_SUCCESS) - { - /* Memory allocation failure */ - return Status; - } - - /* Add new memory mapping */ - Status = BlMapVirtualMemory(PageMap, NULL, (PVOID)(UINT_PTR)Address, 1, LoaderMemoryData); - if(Status != STATUS_EFI_SUCCESS) - { - /* Memory mapping failure */ - return Status; - } - - /* Fill allocated memory with zeros */ - RtlZeroMemory((PVOID)(ULONGLONG)Address, EFI_PAGE_SIZE); - - /* Set paging entry settings */ - PageTable[Entry].PageFrameNumber = Address / EFI_PAGE_SIZE; - PageTable[Entry].Valid = 1; - PageTable[Entry].Writable = 1; - PmlPointer = (ULONGLONG)Address; - } - - /* Set next Page Map Level (PML) */ - *NextPageTable = (PHARDWARE_PTE)(ULONGLONG)PmlPointer; - - /* Return success */ - return STATUS_EFI_SUCCESS; -}