aboutsummaryrefslogtreecommitdiff
path: root/riscv/csrs.cc
diff options
context:
space:
mode:
authorBrendan Sweeney <brs@eecs.berkeley.edu>2022-07-26 14:36:01 -0500
committerGitHub <noreply@github.com>2022-07-26 12:36:01 -0700
commit8d016bffdbc8d7cbeb253cc4f2ee9e5d4bf0a626 (patch)
treed8eba81ea4fd778aa6a8a82a0c33be022d0b5049 /riscv/csrs.cc
parentcdc05e6719f30e6e9192dc92f8cd8d5b22f53417 (diff)
downloadriscv-isa-sim-8d016bffdbc8d7cbeb253cc4f2ee9e5d4bf0a626.zip
riscv-isa-sim-8d016bffdbc8d7cbeb253cc4f2ee9e5d4bf0a626.tar.gz
riscv-isa-sim-8d016bffdbc8d7cbeb253cc4f2ee9e5d4bf0a626.tar.bz2
Add additional bits to medeleg (#1050)
Pursuant to https://github.com/riscv-software-src/riscv-isa-sim/issues/668 and https://github.com/riscv-software-src/riscv-isa-sim/issues/194, allowing for additional exceptions to be delegated from M-mode. It is implementation-defined whether these bits are defined or are read-only-zero. QEMU implements the added bits (Fetch/Load/StoreAMO access, Load/StoreAMO misalignment, and illegal instruction). (https://github.com/qemu/qemu/blob/f6cce6bcb2ef959cdd4da0e368f7c72045f21d6d/target/riscv/csr.c#L813) ECALL_FROM_M is not implemented here because it would have no effect, although QEMU does implement it. This allows Spike to emulate QEMU and other systems which allow for the delegation of such exceptions. Signed-off-by: Brendan Sweeney <mehnadnerd@gmail.com>
Diffstat (limited to 'riscv/csrs.cc')
-rw-r--r--riscv/csrs.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/riscv/csrs.cc b/riscv/csrs.cc
index 3cb6af2..d02212b 100644
--- a/riscv/csrs.cc
+++ b/riscv/csrs.cc
@@ -822,7 +822,13 @@ void medeleg_csr_t::verify_permissions(insn_t insn, bool write) const {
bool medeleg_csr_t::unlogged_write(const reg_t val) noexcept {
const reg_t mask = 0
| (1 << CAUSE_MISALIGNED_FETCH)
+ | (1 << CAUSE_FETCH_ACCESS)
+ | (1 << CAUSE_ILLEGAL_INSTRUCTION)
| (1 << CAUSE_BREAKPOINT)
+ | (1 << CAUSE_MISALIGNED_LOAD)
+ | (1 << CAUSE_LOAD_ACCESS)
+ | (1 << CAUSE_MISALIGNED_STORE)
+ | (1 << CAUSE_STORE_ACCESS)
| (1 << CAUSE_USER_ECALL)
| (1 << CAUSE_SUPERVISOR_ECALL)
| (1 << CAUSE_FETCH_PAGE_FAULT)