Fix calculating l0index in _pmap_alloc_l3 on arm64

When moving from the l1 index to l0 index we need to use the l1 shift
value not the l0 shift value. With 4k pages they are identical, however
with 16k pages we only have 2 l0 entries so the shift value is incorrect.

Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34517
This commit is contained in:
Andrew Turner 2022-03-10 14:40:38 +00:00
parent 0977ebb071
commit 5e2f304cb4

View File

@ -1945,7 +1945,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp)
pd_entry_t tl0;
l1index = ptepindex - NUL2E;
l0index = l1index >> L0_ENTRIES_SHIFT;
l0index = l1index >> Ln_ENTRIES_SHIFT;
l0 = &pmap->pm_l0[l0index];
tl0 = pmap_load(l0);
@ -1973,7 +1973,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp)
pd_entry_t tl0, tl1;
l1index = ptepindex >> Ln_ENTRIES_SHIFT;
l0index = l1index >> L0_ENTRIES_SHIFT;
l0index = l1index >> Ln_ENTRIES_SHIFT;
l0 = &pmap->pm_l0[l0index];
tl0 = pmap_load(l0);