:: commit 1fea122982bed4b100801fec29d60d249f244330

Mintsuki <mintsuki@protonmail.com> — 2026-02-07 07:52

parents: c7845ee6d4

mm/pmm: Handle non-usable entries that fully contain usable entries in sanitiser

diff --git a/common/mm/pmm.s2.c b/common/mm/pmm.s2.c
index 3bc87547..55d12ef9 100644
--- a/common/mm/pmm.s2.c
+++ b/common/mm/pmm.s2.c
@@ -143,6 +143,12 @@ void pmm_sanitise_entries(struct memmap_entry *m, size_t *_count, bool align_ent
             uint64_t res_length = m[j].length;
             uint64_t res_top    = res_base + res_length;
 
+            // Non-usable entry fully contains usable entry
+            if (res_base <= base && res_top >= top) {
+                base = top;
+                break;
+            }
+
             if ( (res_base >= base && res_base < top)
               && (res_top  >= base && res_top  < top) ) {
                 // TODO actually handle splitting off usable chunks
tab: 248 wrap: offon