@samitouri / QOSamiQemu / commits / a0946caf1d

target/riscv: Fix medeleg[11] read-only zero bit for M-mode ECALL

RISC-V Privileged Specification 3.1.8 (Machine Trap Delegation Registers (medeleg and mideleg)) mentions: "For exceptions that cannot occur in less privileged modes, the corresponding medeleg bits should be read-only zero. In particular, medeleg[11] is read-only zero." QEMU incorrectly included RISCV_EXCP_M_ECALL in DELEGABLE_EXCPS. It allowed the 11th bit to be written and read as set. Fixed by removing it from the DELEGABLE_EXCPS mask, adhering to the specification. Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3438 Signed-off-by: Abhigyan Kumar <314abh@gmail.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20260427060849.749179-2-314abh@gmail.com> [ Changes by AF: - Remove comment ] Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

Abhigyan Kumar committed Apr 27, 2026 at 11:38 UTC a0946caf1d9ec21446ebdcb5eab2400baa4323ae
1 file changed -1
target/riscv/csr.c
-1
@@ -1802,7 +1802,6 @@ static const uint64_t all_ints = M_MODE_INTERRUPTS | S_MODE_INTERRUPTS |
1802 (1ULL << (RISCV_EXCP_U_ECALL)) | \
1803 (1ULL << (RISCV_EXCP_S_ECALL)) | \
1804 (1ULL << (RISCV_EXCP_VS_ECALL)) | \
1805 - (1ULL << (RISCV_EXCP_M_ECALL)) | \
1805 (1ULL << (RISCV_EXCP_INST_PAGE_FAULT)) | \
1806 (1ULL << (RISCV_EXCP_LOAD_PAGE_FAULT)) | \
1807 (1ULL << (RISCV_EXCP_STORE_PAGE_FAULT)) | \