aboutsummaryrefslogtreecommitdiff
path: root/src/machine.tex
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2017-09-20 12:34:49 -0700
committerAndrew Waterman <andrew@sifive.com>2017-09-20 12:34:49 -0700
commite2ae148dcca7f725a577ca911059edb337b1ef25 (patch)
tree842a9dc6ba6e1e09e616682f25e07d384d984686 /src/machine.tex
parenteff624dea22dd5039636b7e84c692cccc8db5834 (diff)
downloadriscv-isa-manual-e2ae148dcca7f725a577ca911059edb337b1ef25.zip
riscv-isa-manual-e2ae148dcca7f725a577ca911059edb337b1ef25.tar.gz
riscv-isa-manual-e2ae148dcca7f725a577ca911059edb337b1ef25.tar.bz2
Clarify mtval; allow platform to specify when it's written
Diffstat (limited to 'src/machine.tex')
-rw-r--r--src/machine.tex22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/machine.tex b/src/machine.tex
index e7afbce..0a7a14c 100644
--- a/src/machine.tex
+++ b/src/machine.tex
@@ -1756,13 +1756,15 @@ vector table.
The {\tt mtval} register is an XLEN-bit read-write register formatted as shown
in Figure~\ref{mtvalreg}. When a trap is taken into M-mode, {\tt mtval} is
-written with exception-specific information to assist software in handling the
-trap. Otherwise, {\tt mtval} is never written by the implementation, though
-it may be explicitly written by software.
+either set to zero or written with exception-specific information to assist
+software in handling the trap. Otherwise, {\tt mtval} is never written by the
+implementation, though it may be explicitly written by software. The hardware
+platform will specify which exceptions must set {\tt mtval} informatively and
+which may unconditionally set it to zero.
When a hardware breakpoint is triggered, or an instruction-fetch, load, or
store address-misaligned, access, or page-fault exception occurs, {\tt
- mtval} is written with the faulting effective address. On an illegal
+ mtval} is written with the faulting virtual address. On an illegal
instruction trap, {\tt mtval} may be written with the first XLEN or ILEN
bits of the faulting instruction as described below. For other exceptions,
{\tt mtval} is set to zero, but a future standard may redefine {\tt
@@ -1801,10 +1803,12 @@ XLEN \\
\label{mtvalreg}
\end{figure}
-For instruction-fetch access faults on RISC-V systems with
-variable-length instructions, {\tt mtval} will contain a pointer to
-the portion of the instruction that caused the fault while {\tt mepc}
-will point to the beginning of the instruction.
+For misaligned loads and stores that cause access or page-fault exceptions,
+{\tt mtval} will contain the virtual address of the portion of the access that
+caused the fault. For instruction-fetch access or page-fault exceptions on
+systems with variable-length instructions, {\tt mtval} will contain the
+virtual address of the portion of the instruction that caused the fault while
+{\tt mepc} will point to the beginning of the instruction.
The {\tt mtval} register can optionally also be used to return the
faulting instruction bits on an illegal instruction exception ({\tt
@@ -1846,6 +1850,8 @@ bits are cleared to zero.
appropriate trap handling before runtime).
\end{commentary}
+If the hardware platform specifies that no exceptions set {\tt mtval} to a
+nonzero value, then it may be hardwired to zero. Otherwise,
{\tt mtval} is a \warl\ register that must be able to hold all valid physical
and virtual addresses and the value 0. It need not be capable of holding all
possible invalid addresses. Implementations may convert some invalid address