Spec says branch exception "reported on the target inst". But csr epc description says "written with virtual address of the inst that was interrupted..." So, we have a branch that tries to branch to an invalid address. If we put the bogus target address in the epc, then how can we find the bad branch inst? If the put address of branch in epc, that seems to contradict the "on next inst" statement. Or, do we put address following the branch inst, that seems to contradict "reported on the target". What is correct behavior?
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/0202a1c1-df23-495e-9c4a-7c0e1a87fa8en%40groups.riscv.org.
Priv section 3.1.16 says:
If mtval is written with a nonzero value
when a breakpoint, address-misaligned, access-fault, or
page-fault exception occurs on an instruction fetch, load, or store,
then mtval will contain the
faulting virtual address (note that in bare mode, virtual==physical)
when a misaligned load or store causes an access-fault or
page-fault exception,
then mtval will contain the virtual address of the portion of the access that
caused the fault.
(note that "portion" could be the effective address, or if it was misaligned, the address of the half that failed)
on an illegal
instruction exception
then mtval can optionally also be used to return the faulting instruction bits (details of which bits are returned is in the spec)
(note that the latter case is different because the the faulting instruction bits can be all zero)
Spec says branch exception "reported on the target inst". But csr epc description says "written with virtual address of the inst that was interrupted..." So, we have a branch that tries to branch to an invalid address. If we put the bogus target address in the epc, then how can we find the bad branch inst? If the put address of branch in epc, that seems to contradict the "on next inst" statement. Or, do we put address following the branch inst, that seems to contradict "reported on the target". What is correct behavior?
--
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/CA%2B%2B6G0AvN6Yh5RfL5hm%2Bm8s_EVOhheukLDaH%3DoCPT1Fe-%2BD1tA%40mail.gmail.com.