Skip to content

Commit

Permalink
riscv: use pmap_l1_pindex to calculate the pindex of the l2 page tabl…
Browse files Browse the repository at this point in the history
…e page

Reviewed by:	mhorne
MFC after:	1 week
Pull Request:	freebsd#1360
  • Loading branch information
wy-chung authored and mhorne committed Aug 29, 2024
1 parent 2e33abc commit 835cd17
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sys/riscv/riscv/pmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ pmap_alloc_l2(pmap_t pmap, vm_offset_t va, struct rwlock **lockp)
{
pd_entry_t *l1;
vm_page_t l2pg;
vm_pindex_t l2pindex;
vm_pindex_t pindex;

retry:
l1 = pmap_l1(pmap, va);
Expand All @@ -1756,8 +1756,8 @@ pmap_alloc_l2(pmap_t pmap, vm_offset_t va, struct rwlock **lockp)
l2pg->ref_count++;
} else {
/* Allocate a L2 page. */
l2pindex = pmap_l2_pindex(va) >> Ln_ENTRIES_SHIFT;
l2pg = _pmap_alloc_l3(pmap, NUL2E + l2pindex, lockp);
pindex = pmap_l1_pindex(va);
l2pg = _pmap_alloc_l3(pmap, pindex, lockp);
if (l2pg == NULL && lockp != NULL)
goto retry;
}
Expand Down

0 comments on commit 835cd17

Please sign in to comment.