From 5a3324644dfd0ab1da6f3d3dd306f31dd902a55a Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Sat, 4 Apr 2015 15:17:13 -0700 Subject: [PATCH] Check for F extension when accessing FCSR --- riscv/processor.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/riscv/processor.cc b/riscv/processor.cc index 1187265..1fe0a9c 100644 --- a/riscv/processor.cc +++ b/riscv/processor.cc @@ -460,12 +460,18 @@ reg_t processor_t::get_csr(int which) { case CSR_FFLAGS: require_fp; + if (!supports_extension('F')) + break; return state.fflags; case CSR_FRM: require_fp; + if (!supports_extension('F')) + break; return state.frm; case CSR_FCSR: require_fp; + if (!supports_extension('F')) + break; return (state.fflags << FSR_AEXC_SHIFT) | (state.frm << FSR_RD_SHIFT); case CSR_CYCLE: case CSR_TIME: -- 2.30.2