diff options
author | Rupert Swarbrick <rswarbrick@lowrisc.org> | 2020-02-28 13:50:38 +0000 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2020-02-28 12:47:13 -0800 |
commit | a154c42a9ba0ffca021825117542f5285084bba8 (patch) | |
tree | 6ee4bfbc39717d2f2c173900e12f6f2ee7dbeecc | |
parent | 7dfd3525c8ce4e29570205af7fed33c3095f4bf8 (diff) | |
download | riscv-isa-sim-a154c42a9ba0ffca021825117542f5285084bba8.zip riscv-isa-sim-a154c42a9ba0ffca021825117542f5285084bba8.tar.gz riscv-isa-sim-a154c42a9ba0ffca021825117542f5285084bba8.tar.bz2 |
Add do-nothing support for mcountinhibit CSR
This CSR appeared in version 1.11 of the ISA and is described in the
Volume II: Privileged Architecture manual. It's an optional register
and should read as zero if not implemented, which is what this patch
does.
-rw-r--r-- | riscv/encoding.h | 2 | ||||
-rw-r--r-- | riscv/processor.cc | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/riscv/encoding.h b/riscv/encoding.h index 26142db..a1d6c7c 100644 --- a/riscv/encoding.h +++ b/riscv/encoding.h @@ -1617,6 +1617,7 @@ #define CSR_MIE 0x304 #define CSR_MTVEC 0x305 #define CSR_MCOUNTEREN 0x306 +#define CSR_MCOUNTINHIBIT 0x320 #define CSR_MSCRATCH 0x340 #define CSR_MEPC 0x341 #define CSR_MCAUSE 0x342 @@ -2538,6 +2539,7 @@ DECLARE_CSR(mideleg, CSR_MIDELEG) DECLARE_CSR(mie, CSR_MIE) DECLARE_CSR(mtvec, CSR_MTVEC) DECLARE_CSR(mcounteren, CSR_MCOUNTEREN) +DECLARE_CSR(mcountinhibit, CSR_MCOUNTINHIBIT) DECLARE_CSR(mscratch, CSR_MSCRATCH) DECLARE_CSR(mepc, CSR_MEPC) DECLARE_CSR(mcause, CSR_MCAUSE) diff --git a/riscv/processor.cc b/riscv/processor.cc index d458e39..17b8796 100644 --- a/riscv/processor.cc +++ b/riscv/processor.cc @@ -888,6 +888,7 @@ reg_t processor_t::get_csr(int which) break; case CSR_SCOUNTEREN: return state.scounteren; case CSR_MCOUNTEREN: return state.mcounteren; + case CSR_MCOUNTINHIBIT: return 0; case CSR_SSTATUS: { reg_t mask = SSTATUS_SIE | SSTATUS_SPIE | SSTATUS_SPP | SSTATUS_FS | (supports_extension('V') ? SSTATUS_VS : 0) |