diff options
author | Wuyang Chung <wy-chung@outlook.com> | 2024-08-04 14:04:12 +0000 |
---|---|---|
committer | Mitchell Horne <mhorne@FreeBSD.org> | 2024-08-29 15:20:28 +0000 |
commit | 2e33abc35460b9e2c2eeb1e43a0614db7bebbdb3 (patch) | |
tree | d5964b2a712cc47b9be060647a2934fdf6b24853 | |
parent | 05cf677bb8d8b2528fd5bf472c908eabe4e76125 (diff) | |
download | src-2e33abc35460b9e2c2eeb1e43a0614db7bebbdb3.tar.gz src-2e33abc35460b9e2c2eeb1e43a0614db7bebbdb3.zip |
riscv: fix a bug in calculating the pindex for L1 page
pmap_l1_pindex(va) expands to: ((va >> L1_SHIFT) + NUL2E)
Reviewed by: mhorne
MFC after: 1 week
Fixes: a4667e09e652 ("Convert vm_page_alloc() callers to...")
Pull Request: https://github.com/freebsd/freebsd-src/pull/1360
-rw-r--r-- | sys/riscv/riscv/pmap.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index c372e6f7362b..4baa4948e442 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -1887,8 +1887,8 @@ pmap_growkernel(vm_offset_t addr) nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | 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; + panic("%s: no memory to grow kernel", __func__); + nkpg->pindex = pmap_l1_pindex(kernel_vm_end); paddr = VM_PAGE_TO_PHYS(nkpg); pn = (paddr / PAGE_SIZE); @@ -1913,8 +1913,8 @@ pmap_growkernel(vm_offset_t addr) nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | 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; + panic("%s: no memory to grow kernel", __func__); + nkpg->pindex = pmap_l2_pindex(kernel_vm_end); paddr = VM_PAGE_TO_PHYS(nkpg); pn = (paddr / PAGE_SIZE); |