aboutsummaryrefslogtreecommitdiff
path: root/riscv/mmu.cc
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2016-02-05 18:18:06 -0800
committerAndrew Waterman <waterman@cs.berkeley.edu>2016-03-02 12:15:25 -0800
commit66a37a5104172a874ae72c80480cba4edceb7505 (patch)
treeb9d3f329a0f83b158e570ae59410cea8f1470504 /riscv/mmu.cc
parent3bfc00ef2a1b1f0b0472a39a866261b00f67027e (diff)
downloadspike-66a37a5104172a874ae72c80480cba4edceb7505.zip
spike-66a37a5104172a874ae72c80480cba4edceb7505.tar.gz
spike-66a37a5104172a874ae72c80480cba4edceb7505.tar.bz2
WIP on priv spec v1.9
Diffstat (limited to 'riscv/mmu.cc')
-rw-r--r--riscv/mmu.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/riscv/mmu.cc b/riscv/mmu.cc
index 0073a8a..0ba3785 100644
--- a/riscv/mmu.cc
+++ b/riscv/mmu.cc
@@ -34,9 +34,10 @@ reg_t mmu_t::translate(reg_t addr, access_type type)
if (!proc)
return addr;
- reg_t mode = get_field(proc->state.mstatus, MSTATUS_PRV);
- if (type != FETCH && get_field(proc->state.mstatus, MSTATUS_MPRV))
- mode = get_field(proc->state.mstatus, MSTATUS_PRV1);
+ reg_t mode = proc->state.prv;
+ if (type != FETCH && proc->state.prv == PRV_M &&
+ get_field(proc->state.mstatus, MSTATUS_MPRV))
+ mode = get_field(proc->state.mstatus, MSTATUS_MPP);
if (get_field(proc->state.mstatus, MSTATUS_VM) == VM_MBARE)
mode = PRV_M;