From 95d8739f18538fc82bf80d7308db7f6720cc36da Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 17 Sep 2024 20:39:42 -0400 Subject: [PATCH] kernel/x86: Allow overlapping of memory types with physical memory ranges in MTRRs. Otherwise, all RAM that has a more specific type than the physical range will hit the assertion below. We also don't want to return the type set here, so put this check before the effectiveType check. Change-Id: I703242221771732c69accce66380b5a0efdc77e3 Reviewed-on: https://review.haiku-os.org/c/haiku/+/8345 Haiku-Format: Haiku-format Bot Tested-by: Commit checker robot Reviewed-by: waddlesplash --- src/system/kernel/arch/x86/arch_vm.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/system/kernel/arch/x86/arch_vm.cpp b/src/system/kernel/arch/x86/arch_vm.cpp index 60c595dbb4..a212fc8fc3 100644 --- a/src/system/kernel/arch/x86/arch_vm.cpp +++ b/src/system/kernel/arch/x86/arch_vm.cpp @@ -573,6 +573,11 @@ add_memory_type_range(area_id areaID, uint64 base, uint64 size, uint32 type, continue; } + if (range->area == -1 && !x86_use_pat()) { + // Physical memory range in MTRRs; permit overlapping. + continue; + } + if (effectiveType != NULL) { type = *effectiveType = range->type; effectiveType = NULL;