From 86857aa3511d0a3bb1d28f8a6213013382545f77 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Tue, 12 Nov 2019 19:17:12 -0800 Subject: mstatus.FS only exists if (S || V || F) --- riscv/processor.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/riscv/processor.cc b/riscv/processor.cc index 3dff83e..9b8050c 100644 --- a/riscv/processor.cc +++ b/riscv/processor.cc @@ -535,10 +535,14 @@ void processor_t::set_csr(int which, reg_t val) (MSTATUS_MPP | MSTATUS_MPRV | MSTATUS_SUM | MSTATUS_MXR)) mmu->flush_tlb(); + bool has_fs = supports_extension('S') || supports_extension('F') + || supports_extension('V'); + reg_t mask = MSTATUS_SIE | MSTATUS_SPIE | MSTATUS_MIE | MSTATUS_MPIE - | MSTATUS_FS | MSTATUS_MPRV | MSTATUS_SUM + | MSTATUS_MPRV | MSTATUS_SUM | MSTATUS_MXR | MSTATUS_TW | MSTATUS_TVM | MSTATUS_TSR | MSTATUS_UXL | MSTATUS_SXL | + (has_fs ? MSTATUS_FS : 0) | (ext ? MSTATUS_XS : 0); reg_t requested_mpp = legalize_privilege(get_field(val, MSTATUS_MPP)); -- cgit v1.1