Skip to content

Commit ad5679c

Browse files
authored
Solidify description of how tval is populated on EBREAK (riscv#2136)
We tried to fix this in riscv#601, but the text doesn't quite cover the intended case, because the breakpoint exception does not occur on a fetch, load, or store: it occurs as a result of executing a non-memory instruction. Fix by listing this case explicitly.
1 parent d5fd7ff commit ad5679c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/machine.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,6 +1990,14 @@ occurs on an
19901990
instruction fetch, load, or store, then `mtval` will contain the
19911991
faulting virtual address.
19921992

1993+
On a breakpoint exception raised by an EBREAK or C.EBREAK instruction, `mtval`
1994+
is written with either zero or the virtual address of the instruction.
1995+
1996+
NOTE: For breakpoint exceptions raised by [C.]EBREAK, the virtual address of
1997+
the instruction is already recorded in `mepc`.
1998+
Recording the same address in `mtval` is redundant; the option is provided for
1999+
backwards compatibility.
2000+
19932001
When page-based virtual memory is enabled, `mtval` is written with the
19942002
faulting virtual address, even for physical-memory access-fault
19952003
exceptions. This design reduces datapath cost for most implementations,

src/supervisor.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,9 @@ occurs on an
673673
instruction fetch, load, or store, then `stval` will contain the
674674
faulting virtual address.
675675

676+
On a breakpoint exception raised by an EBREAK or C.EBREAK instruction, `stval`
677+
is written with either zero or the virtual address of the instruction.
678+
676679
[[stvalreg]]
677680
.Supervisor Trap Value register.
678681
include::images/bytefield/stvalreg.edn[]

0 commit comments

Comments
 (0)