git: 38a08e45f194 - main - arm64: fix L1 pindex calculation in pmap_growkernel()

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Fri, 30 Aug 2024 19:40:29 UTC
The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=38a08e45f19447717726de4d41bd161f966d29da

commit 38a08e45f19447717726de4d41bd161f966d29da
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2024-08-29 15:25:52 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-08-30 19:39:56 +0000

    arm64: fix L1 pindex calculation in pmap_growkernel()
    
    Use the pmap_l1_pindex() macro which accounts for the NUL2E offset.
    While here, use pmap_l2_pindex() macro further down (no change).
    
    Prompted by pull request and commit 2e33abc35460, making the change for
    the riscv pmap.
---
 sys/arm64/arm64/pmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 58795e25c82e..224ecbdc4577 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -2962,7 +2962,7 @@ pmap_growkernel(vm_offset_t addr)
 			    VM_ALLOC_NOFREE | VM_ALLOC_WIRED | VM_ALLOC_ZERO);
 			if (nkpg == NULL)
 				panic("pmap_growkernel: no memory to grow kernel");
-			nkpg->pindex = kernel_vm_end >> L1_SHIFT;
+			nkpg->pindex = pmap_l1_pindex(kernel_vm_end);
 			/* See the dmb() in _pmap_alloc_l3(). */
 			dmb(ishst);
 			pmap_store(l1, VM_PAGE_TO_PTE(nkpg) | L1_TABLE);
@@ -2982,7 +2982,7 @@ pmap_growkernel(vm_offset_t addr)
 		    VM_ALLOC_NOFREE | VM_ALLOC_WIRED | VM_ALLOC_ZERO);
 		if (nkpg == NULL)
 			panic("pmap_growkernel: no memory to grow kernel");
-		nkpg->pindex = kernel_vm_end >> L2_SHIFT;
+		nkpg->pindex = pmap_l2_pindex(kernel_vm_end);
 		/* See the dmb() in _pmap_alloc_l3(). */
 		dmb(ishst);
 		pmap_store(l2, VM_PAGE_TO_PTE(nkpg) | L2_TABLE);