From f653b9f79c560e0af5a924cf2b7a1bd9f5f0f37a Mon Sep 17 00:00:00 2001 From: Aiken Harris Date: Thu, 1 Jan 2026 20:51:30 +0100 Subject: [PATCH] Properly handle bad physical pages --- xtoskrnl/mm/pfn.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xtoskrnl/mm/pfn.cc b/xtoskrnl/mm/pfn.cc index 8fc1e7c..dfc77e7 100644 --- a/xtoskrnl/mm/pfn.cc +++ b/xtoskrnl/mm/pfn.cc @@ -260,6 +260,9 @@ MM::Pfn::LinkFreePage(IN PFN_NUMBER PageFrameIndex) /* Update cache attribute to not mapped */ PfnEntry->u3.e1.CacheAttribute = PfnNotMapped; + /* Insert the page into the bad page list instead */ + LinkPage(&BadPagesList, PageFrameIndex); + /* Do not add it to the free list */ return; } @@ -693,8 +696,8 @@ MM::Pfn::ProcessMemoryDescriptor(IN PFN_NUMBER BasePage, switch(MemoryType) { case LoaderBad: - /* This memory is marked as bad and should not be used */ - UNIMPLEMENTED; + /* This memory is marked as bad and should not be used, add it to the bad pages list */ + LinkPage(&BadPagesList, BasePage); break; case LoaderXIPRom: /* This memory range contains Read-Only Memory (ROM) */