Skip to content

Commit e8da86d

Browse files
AnzoooooGs-ygc
authored andcommitted
fix(mmu): adjusting the timing of non-virt PBMT assignments (OpenXiangShan#988)
We have already assigned a value to cpu.pbmt at the end of gpa_stage. It should not be reassigned, as this will cause it to be overwritten incorrectly: https://github.com/OpenXiangShan/NEMU/blob/112f2fd1e68d1c8978f964f6a2846104dcd928e8/src/isa/riscv64/system/mmu.c#L371-L382
1 parent c44f944 commit e8da86d

File tree

1 file changed

+4
-2
lines changed
  • src/isa/riscv64/system

1 file changed

+4
-2
lines changed

src/isa/riscv64/system/mmu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,11 @@ static paddr_t ptw(vaddr_t vaddr, int type) {
523523
if(virt){
524524
pg_base = gpa_stage(pg_base | (vaddr & PAGE_MASK), vaddr, type, type, hlvx, false) & ~PAGE_MASK;
525525
if(pg_base == MEM_RET_FAIL) return MEM_RET_FAIL;
526+
} else {
527+
cpu.pbmt = pte.pbmt;
526528
}
529+
#else
530+
cpu.pbmt = pte.pbmt;
527531
#endif //CONFIG_RVH
528532
#ifndef CONFIG_SHARE
529533
// update a/d by hardware
@@ -548,8 +552,6 @@ static paddr_t ptw(vaddr_t vaddr, int type) {
548552
}
549553
}
550554
#endif // CONFIG_SHARE
551-
552-
cpu.pbmt = pte.pbmt;
553555
return pg_base | MEM_RET_OK;
554556

555557
bad:

0 commit comments

Comments
 (0)