From 971cf098413fe227a28f5dc30a1e50872e9e04ef Mon Sep 17 00:00:00 2001 From: Scott Johnson Date: Sat, 6 Mar 2021 08:51:32 -0800 Subject: 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. --- riscv/mmu.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'riscv/mmu.cc') 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 -- cgit v1.1