:: commit f4cab0bec0323fac84e0ef8928a0fc208387f23f

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

parents: 6d53720c62

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