summaryrefslogtreecommitdiff
path: root/target/riscv/cpu.h
diff options
context:
space:
mode:
authorMichael Clark <mjc@sifive.com>2018-04-09 11:33:05 +1200
committerMichael Clark <mjc@sifive.com>2018-05-06 10:39:38 +1200
commit8c59f5c1b5aabbad92871bf62bb302fef017e322 (patch)
tree5eb68061c382fc0ffc17f63ca20faaf2be2277ee /target/riscv/cpu.h
parente21659057066f2f4d42fa51a62ff07a23a632e40 (diff)
downloadqemu-8c59f5c1b5aabbad92871bf62bb302fef017e322.tar.gz
RISC-V: Use [ms]counteren CSRs when priv ISA >= v1.10
Privileged ISA v1.9.1 defines mscounteren and mucounteren: * mscounteren contains a mask of counters available to S-mode * mucounteren contains a mask of counters available to U-mode Privileged ISA v1.10 defines mcounteren and scounteren: * mcounteren contains a mask of counters available to S-mode * scounteren contains a mask of counters available to U-mode mcounteren and scounteren CSR registers were implemented however they were not honoured for counter accesses when the privilege ISA was >= v1.10. This fix solves the issue by coalescing the counter enable registers. In addition the code now generates illegal instruction exceptions for accesses to the counter enabled registers depending on the privileged ISA version. - Coalesce mscounteren and mcounteren into one variable - Coalesce mucounteren and scounteren into one variable - Makes mcounteren and scounteren CSR accesses generate illegal instructions when the privileged ISA <= v1.9.1 - Makes mscounteren and mucounteren CSR accesses generate illegal instructions when the privileged ISA >= v1.10 Cc: Sagar Karandikar <sagark@eecs.berkeley.edu> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Cc: Palmer Dabbelt <palmer@sifive.com> Cc: Alistair Francis <Alistair.Francis@wdc.com> Signed-off-by: Michael Clark <mjc@sifive.com>
Diffstat (limited to 'target/riscv/cpu.h')
-rw-r--r--target/riscv/cpu.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index 1dcbdbe6f7..34abc383e3 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -151,10 +151,8 @@ struct CPURISCVState {
target_ulong mcause;
target_ulong mtval; /* since: priv-1.10.0 */
- uint32_t mucounteren;
- uint32_t mscounteren;
- target_ulong scounteren; /* since: priv-1.10.0 */
- target_ulong mcounteren; /* since: priv-1.10.0 */
+ target_ulong scounteren;
+ target_ulong mcounteren;
target_ulong sscratch;
target_ulong mscratch;