aboutsummaryrefslogtreecommitdiff
path: root/riscv/mmu.cc
diff options
context:
space:
mode:
authorScott Johnson <scott.johnson@arilinc.com>2021-03-02 00:02:57 -0800
committerAndrew Waterman <aswaterman@gmail.com>2021-09-08 07:59:02 -0700
commit14219453156c573caa9dfc0936e1bdfd71138ea3 (patch)
treea67f9631ae7d71330fd6adf523438e0a5829c83c /riscv/mmu.cc
parent4f008be2f747265d092e6a5fff2b046484d18625 (diff)
downloadspike-14219453156c573caa9dfc0936e1bdfd71138ea3.zip
spike-14219453156c573caa9dfc0936e1bdfd71138ea3.tar.gz
spike-14219453156c573caa9dfc0936e1bdfd71138ea3.tar.bz2
Use virtualized_csr_t for satp and vsatp
This was much more complicated than the others because of the mstatus.TVM and hstatus.VTVM bits, and because of the special WARL-ness of satp that doesn't apply to vsatp. It appears (based on reading the code) that the commitlog for these two was problematic. CSRW to satp when V=1 was reporting a write to satp instead of vsatp which was actually written. Also a CSRW to vsatp looks like it was not being logged at all. Both problems should be fixed now.
Diffstat (limited to 'riscv/mmu.cc')
-rw-r--r--riscv/mmu.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/riscv/mmu.cc b/riscv/mmu.cc
index b880739..8cedd44 100644
--- a/riscv/mmu.cc
+++ b/riscv/mmu.cc
@@ -340,7 +340,7 @@ reg_t mmu_t::s2xlate(reg_t gva, reg_t gpa, access_type type, access_type trap_ty
reg_t mmu_t::walk(reg_t addr, access_type type, reg_t mode, bool virt, bool hlvx)
{
reg_t page_mask = (reg_t(1) << PGSHIFT) - 1;
- reg_t satp = (virt) ? proc->get_state()->vsatp : proc->get_state()->satp;
+ reg_t satp = proc->get_state()->satp->readvirt(virt);
vm_info vm = decode_vm_info(proc->get_const_xlen(), false, mode, satp);
if (vm.levels == 0)
return s2xlate(addr, addr & ((reg_t(2) << (proc->xlen-1))-1), type, type, virt, hlvx) & ~page_mask; // zero-extend from xlen