aboutsummaryrefslogtreecommitdiff
path: root/riscv/mmu.cc
diff options
context:
space:
mode:
authorScott Johnson <scott.johnson@arilinc.com>2021-03-06 08:51:32 -0800
committerAndrew Waterman <aswaterman@gmail.com>2021-09-08 07:59:02 -0700
commit971cf098413fe227a28f5dc30a1e50872e9e04ef (patch)
treeb82a7d66f02f302d43d22eda2eca7963b872949e /riscv/mmu.cc
parentead8870cb7a3170c1729be17ebf93b7ce25c439f (diff)
downloadspike-971cf098413fe227a28f5dc30a1e50872e9e04ef.zip
spike-971cf098413fe227a28f5dc30a1e50872e9e04ef.tar.gz
spike-971cf098413fe227a28f5dc30a1e50872e9e04ef.tar.bz2
Add get_const_xlen() as a way to document assumptions of unchanging xlen
Spike does not support dynamic xlen today, but if it should in the future, this will help identify all the code that needs to be updated.
Diffstat (limited to 'riscv/mmu.cc')
-rw-r--r--riscv/mmu.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/riscv/mmu.cc b/riscv/mmu.cc
index b50ca8c..0d6509a 100644
--- a/riscv/mmu.cc
+++ b/riscv/mmu.cc
@@ -263,7 +263,7 @@ reg_t mmu_t::s2xlate(reg_t gva, reg_t gpa, access_type type, access_type trap_ty
if (!virt)
return gpa;
- vm_info vm = decode_vm_info(proc->max_xlen, true, 0, proc->get_state()->hgatp);
+ vm_info vm = decode_vm_info(proc->get_const_xlen(), true, 0, proc->get_state()->hgatp);
if (vm.levels == 0)
return gpa;
@@ -341,7 +341,7 @@ 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;
- vm_info vm = decode_vm_info(proc->max_xlen, false, mode, satp);
+ 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