diff options
author | Andrew Waterman <andrew@sifive.com> | 2020-09-24 17:22:59 -0700 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2020-09-24 17:31:33 -0700 |
commit | c6a5585849f4d446706dfcc904b9a422bd2b3067 (patch) | |
tree | 07e7cda664f2be18c4d5016d0f6a6d902684d894 /riscv/insns/sfence_vma.h | |
parent | 348fc0c97021e6788cfd73571687bb8f1bf6a44a (diff) | |
download | spike-c6a5585849f4d446706dfcc904b9a422bd2b3067.zip spike-c6a5585849f4d446706dfcc904b9a422bd2b3067.tar.gz spike-c6a5585849f4d446706dfcc904b9a422bd2b3067.tar.bz2 |
Correctly respect mstatus.TVM
It never has effect when V=1.
HFENCE.GVMA and the hgatp CSR must respect it (when V=0).
Diffstat (limited to 'riscv/insns/sfence_vma.h')
-rw-r--r-- | riscv/insns/sfence_vma.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/riscv/insns/sfence_vma.h b/riscv/insns/sfence_vma.h index aca14d0..ff949c7 100644 --- a/riscv/insns/sfence_vma.h +++ b/riscv/insns/sfence_vma.h @@ -1,5 +1,8 @@ require_extension('S'); -if (STATE.v && (STATE.prv == PRV_U || get_field(STATE.hstatus, HSTATUS_VTVM))) - require_novirt(); -require_privilege(get_field(STATE.mstatus, MSTATUS_TVM) ? PRV_M : PRV_S); +if (STATE.v) { + if (STATE.prv == PRV_U || get_field(STATE.hstatus, HSTATUS_VTVM)) + require_novirt(); +} else { + require_privilege(get_field(STATE.mstatus, MSTATUS_TVM) ? PRV_M : PRV_S); +} MMU.flush_tlb(); |