From 80f7969714648d41933bf23508011392d51746a5 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Wed, 12 Mar 2025 13:08:40 -0400 Subject: [PATCH] kernel/x86_64: Correct address mask in DebugGetReverseMappingInfo. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With how we currently use virtual address spaces, the old and new computations should produce identical results even on LA57, but this should be more correct if we ever do use more than just 48 bits of the address space. Change-Id: I61915fceff8e7998032e0a9895010ef9c26b7b94 Reviewed-on: https://review.haiku-os.org/c/haiku/+/9121 Haiku-Format: Haiku-format Bot Tested-by: Commit checker robot Reviewed-by: Jérôme Duval Reviewed-by: waddlesplash --- .../arch/x86/paging/64bit/X86VMTranslationMap64Bit.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/arch/x86/paging/64bit/X86VMTranslationMap64Bit.cpp b/src/system/kernel/arch/x86/paging/64bit/X86VMTranslationMap64Bit.cpp index 8bb9276637..4e6ae4cc23 100644 --- a/src/system/kernel/arch/x86/paging/64bit/X86VMTranslationMap64Bit.cpp +++ b/src/system/kernel/arch/x86/paging/64bit/X86VMTranslationMap64Bit.cpp @@ -786,8 +786,13 @@ X86VMTranslationMap64Bit::DebugGetReverseMappingInfo(phys_addr_t physicalAddress if ((virtualPML4[i] & X86_64_PML4E_PRESENT) == 0) continue; uint64 addressMask = 0; - if (i >= 256) - addressMask = fLA57 ? 0xff00000000000000LL : 0xfffff00000000000LL; + if (fLA57) { + if (p >= 256) + addressMask = 0xff00000000000000LL; + } else { + if (i >= 256) + addressMask = 0xfffff00000000000LL; + } const uint64* virtualPDPT = (uint64*)fPageMapper->GetPageTableAt( virtualPML4[i] & X86_64_PML4E_ADDRESS_MASK);