Describe the bug
isa_mmio_misalign_data_addr_check() in src/memory/paddr.c raises EX_LAM/EX_SAM for misaligned accesses to MMIO regions. RISC-V Privileged Spec §3.6.1 non-idempotent regions should raise *AccessFault instead, to prevent OS trap handlers from emulating the access via multiple smaller MMIO accesses.
This is the NEMU-side counterpart of XiangShan #5695.
Expected behavior
Misaligned access to MMIO → EX_LAF (load) / EX_SAF (store), consistent with spec recommendation:
Non-idempotent regions might not support misaligned accesses. Misaligned accesses to such regions should raise access-fault exceptions rather than address-misaligned exceptions.
Code location
src/memory/paddr.c:173:
int ex = cpu.amo || type == MEM_TYPE_WRITE ? EX_SAM : EX_LAM; // should be EX_SAF / EX_LAF
Necessary information on versions
- NEMU version: master branch
Describe the bug
isa_mmio_misalign_data_addr_check()insrc/memory/paddr.craisesEX_LAM/EX_SAMfor misaligned accesses to MMIO regions. RISC-V Privileged Spec §3.6.1 non-idempotent regions should raise*AccessFaultinstead, to prevent OS trap handlers from emulating the access via multiple smaller MMIO accesses.This is the NEMU-side counterpart of XiangShan #5695.
Expected behavior
Misaligned access to MMIO →
EX_LAF(load) /EX_SAF(store), consistent with spec recommendation:Code location
src/memory/paddr.c:173:Necessary information on versions