Skip to content

Commit

Permalink
mmu: fix the width of ppn and pg_base (#158)
Browse files Browse the repository at this point in the history
Cast the ppn to uint64_t to avoid the PGBASE removing the higher
bits of ppn.
  • Loading branch information
poemonsense authored Sep 6, 2023
1 parent 7ba70b7 commit 70e6330
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/isa/riscv64/system/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static paddr_t ptw(vaddr_t vaddr, int type) {
level, vaddr, pg_base, p_pte, pte.val);
}
#endif
pg_base = PGBASE(pte.ppn);
pg_base = PGBASE((uint64_t)pte.ppn);
if (!pte.v || (!pte.r && pte.w)) goto bad;
if (pte.r || pte.x || pte.pad) { break; }
else {
Expand Down

0 comments on commit 70e6330

Please sign in to comment.