Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 [rtl] fix MEPC value for instruction access faults #458

Merged
merged 7 commits into from Dec 17, 2022

Conversation

stnolting
Copy link
Owner

According to RISC-V priv. spec. the xEPC CSRs have to point to the address that caused an "instruction access fault" exception:

3.1.16 Machine Trap Value Register (mtval)
[...]
If mtval is written with a nonzero value when an instruction access-fault or page-fault exception occurs on a system with variable-length instructions, then mtval will contain the virtual address of the portion of the instruction that caused the fault, while mepc will point to the beginning of the instruction.

See riscv/riscv-isa-manual#938

for instruction fetch access exceptions MEPC has to point to the address that caused the exception (i.e. the failing instruction fetch itself)
@stnolting stnolting added bug Something isn't working risc-v compliance Modification to comply with official RISC-V specs. HW hardware-related labels Dec 17, 2022
@stnolting stnolting self-assigned this Dec 17, 2022
@stnolting stnolting marked this pull request as ready for review December 17, 2022 20:43
@stnolting stnolting merged commit 2b92a7c into main Dec 17, 2022
@stnolting stnolting deleted the iacc_mepc_fix branch December 17, 2022 20:53
cronomantic pushed a commit to cronomantic/neorv32 that referenced this pull request Dec 17, 2022
* [sw/lib] RTE: minor optimizations

* [sw/example] modify i-access exception test

for instruction fetch access exceptions MEPC has to point to the address that caused the exception (i.e. the failing instruction fetch itself)

* [docs] add warning regarding non-resumable exceptions

* [CHANGELOG] add v1.7.8.8

* [sw/example] processor_check: minor cleanup

* 馃悰 [rtl] fix xEPC value on instruction access fault

* [rtl] minor edit

add missing default level dcsr.cause CSR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working HW hardware-related risc-v compliance Modification to comply with official RISC-V specs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant