From 2b13769dd5f3200cfa99b011bb22bd1b49c0deab Mon Sep 17 00:00:00 2001 From: Hendiadyoin1 Date: Sun, 3 Mar 2024 13:55:52 +0100 Subject: [PATCH] Kernel/MM: Skip non static reserved memory regions instead of crashing Crashing seems a bit harsh, so let's just skip them instead, as they actually show up in the device tree of RPis. --- Kernel/Memory/MemoryManager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp index e51df2cd80..a27fe3c43d 100644 --- a/Kernel/Memory/MemoryManager.cpp +++ b/Kernel/Memory/MemoryManager.cpp @@ -458,6 +458,12 @@ UNMAP_AFTER_INIT void MemoryManager::parse_memory_map_fdt(MemoryManager::GlobalD break; case State::InReservedMemoryChild: // FIXME: Handle non static allocations, + if (!state.start.has_value()) { + VERIFY(state.size.has_value()); + dbgln("MM: Non static reserved memory range {} of size {:#x}, skipping for now", node_name, state.size.value()); + state.state = State::InReservedMemory; + break; + } VERIFY(state.start.has_value() && state.size.has_value()); dbgln("MM: Reserved Range {}: address: {} size {:#x}", node_name, PhysicalAddress { state.start.value() }, state.size.value()); global_data.physical_memory_ranges.append(PhysicalMemoryRange { PhysicalMemoryRangeType::Reserved, PhysicalAddress { state.start.value() }, state.size.value() });