aboutsummaryrefslogtreecommitdiff
path: root/rust/qemu-api-macros/src/utils.rs
diff options
context:
space:
mode:
authorCharalampos Mitrodimas <charmitro@posteo.net>2025-07-03 18:21:43 +0000
committerAlistair Francis <alistair.francis@wdc.com>2025-07-04 21:09:49 +1000
commitb3452452e64be647fef98d2dce16c3f5c149235a (patch)
tree66a3068850854815a294ec2bb5919e0d1a8868d4 /rust/qemu-api-macros/src/utils.rs
parentbc2200134c1229a83bbcd8e75ab541ca110609f6 (diff)
downloadqemu-b3452452e64be647fef98d2dce16c3f5c149235a.zip
qemu-b3452452e64be647fef98d2dce16c3f5c149235a.tar.gz
qemu-b3452452e64be647fef98d2dce16c3f5c149235a.tar.bz2
target/riscv: Fix MEPC/SEPC bit masking for IALIGN
According to the RISC-V Privileged Architecture specification, the low bit of MEPC/SEPC must always be zero. When IALIGN=32, the two low bits must be zero. This commit fixes the behavior of MEPC/SEPC CSR reads and writes, and the implicit reads by MRET/SRET instructions to properly mask the lowest bit(s) based on whether the C extension is enabled: - When C extension is enabled (IALIGN=16): mask bit 0 - When C extension is disabled (IALIGN=32): mask bits [1:0] Previously, when vectored mode bits from STVEC (which sets bit 0 for vectored mode) were written to MEPC, the bits would not be cleared correctly, causing incorrect behavior on MRET. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2855 Signed-off-by: Charalampos Mitrodimas <charmitro@posteo.net> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Message-ID: <20250703182157.281320-2-charmitro@posteo.net> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'rust/qemu-api-macros/src/utils.rs')
0 files changed, 0 insertions, 0 deletions