From f3357648ab599fb3a7dfdef992b2f4df713aafff Mon Sep 17 00:00:00 2001 From: mintsuki Date: Mon, 17 Oct 2022 04:41:11 +0200 Subject: [PATCH] pmm: Fix AllocatePages() call to take pages count; remove useless alignment check --- common/mm/pmm.s2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/mm/pmm.s2.c b/common/mm/pmm.s2.c index b7b28699..ef1fd8f9 100644 --- a/common/mm/pmm.s2.c +++ b/common/mm/pmm.s2.c @@ -403,11 +403,10 @@ void init_memmap(void) { if (status) { for (size_t j = 0; j < memmap[i].length; j += 4096) { - uint64_t length = memmap[i].length - j < 4096 ? memmap[i].length - j : 4096; base = memmap[i].base + j; - status = gBS->AllocatePages(AllocateAddress, EfiLoaderData, length, &base); + status = gBS->AllocatePages(AllocateAddress, EfiLoaderData, 1, &base); if (status) { - memmap_alloc_range(base, length, MEMMAP_EFI_RECLAIMABLE, MEMMAP_USABLE, true, false, false); + memmap_alloc_range(base, 4096, MEMMAP_EFI_RECLAIMABLE, MEMMAP_USABLE, true, false, false); } } }