aboutsummaryrefslogtreecommitdiff
path: root/src/supervisor.tex
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2021-10-05 19:15:45 -0700
committerAndrew Waterman <andrew@sifive.com>2021-10-05 19:15:45 -0700
commit399c9a759eb4540a65c60e2cc236164821ff2346 (patch)
tree48c25a05998554cf657d251251d91ea41d99461c /src/supervisor.tex
parent22c8813c7a05bd9d54892995b43e95f25f9df883 (diff)
downloadriscv-isa-manual-399c9a759eb4540a65c60e2cc236164821ff2346.zip
riscv-isa-manual-399c9a759eb4540a65c60e2cc236164821ff2346.tar.gz
riscv-isa-manual-399c9a759eb4540a65c60e2cc236164821ff2346.tar.bz2
Fix editing error in mtval/stval definition
Partially introduced by 7f45777bfc3e0a6b327552a286392ccfd5c933a8 and 94ab414c4b470edae8bde4e7759163fe7ddf8ab4 The spec says that the platform will define which exceptions must populate mtval or stval with a nonzero value and which are permitted to zero it. But then later statements seem not to permit the possibility of zeroing the register, which is a contradiction. Resolve in a backwards-compatible manner by permitting zeros unless the platform says otherwise (which was the original intent, anyway). This permits e.g. zeroing mtval on an EBREAK instruction, where mepc provides sufficient information, as was the intent of 94ab414c4b470edae8bde4e7759163fe7ddf8ab4.
Diffstat (limited to 'src/supervisor.tex')
-rw-r--r--src/supervisor.tex56
1 files changed, 26 insertions, 30 deletions
diff --git a/src/supervisor.tex b/src/supervisor.tex
index 83866df..bac284d 100644
--- a/src/supervisor.tex
+++ b/src/supervisor.tex
@@ -736,14 +736,10 @@ which exceptions must set {\tt stval} informatively and which may
unconditionally set it to zero.
-When a breakpoint,
-address-misaligned, access-fault, or page-fault exception occurs
-on an instruction fetch, load, or store, {\tt stval}
-is written with the faulting virtual address. On an illegal instruction trap,
-{\tt stval} may be written with the first XLEN or ILEN bits of the faulting
-instruction as described below. For other exceptions, {\tt stval} is set to
-zero, but a future standard may redefine {\tt stval}'s setting for other
-exceptions.
+If {\tt stval} 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 {\tt stval} will contain the faulting
+virtual address.
\begin{figure}[h!]
{\footnotesize
@@ -762,31 +758,31 @@ SXLEN \\
\label{stvalreg}
\end{figure}
-For misaligned loads and stores that cause access-fault or page-fault
-exceptions, {\tt stval} will contain the virtual address of the
-portion of the access that caused the fault. For
-instruction access-fault or page-fault exceptions on systems
-with variable-length instructions, {\tt stval} will contain the
-virtual address of the portion of the instruction that caused
-the fault while {\tt sepc} will point to the beginning of the
-instruction.
-
-The {\tt stval} register can optionally also be used to return the
-faulting instruction bits on an illegal instruction exception ({\tt
- sepc} points to the faulting instruction in memory).
-
-If this feature is not provided, then {\tt stval} is set to zero on
-an illegal instruction fault.
-
-If this feature is provided, after an illegal instruction trap, {\tt stval}
-will contain the shortest of:
+If {\tt stval} is written with a nonzero value when a misaligned load or store
+causes an access-fault or page-fault exception, then {\tt stval} will contain
+the virtual address of the portion of the access that caused the fault.
+
+If {\tt stval} is written with a nonzero value when an instruction access-fault
+or page-fault exception occurs on a system with variable-length instructions,
+then {\tt stval} will contain the virtual address of the portion of the
+instruction that caused the fault, while {\tt sepc} will point to the beginning
+of the instruction.
+
+The {\tt stval} register can optionally also be used to return the faulting
+instruction bits on an illegal instruction exception ({\tt sepc} points to the
+faulting instruction in memory).
+If {\tt stval} is written with a nonzero value when an illegal-instruction
+exception occurs, then {\tt stval} will contain the shortest of:
\begin{compactitem}
\item the actual faulting instruction
\item the first ILEN bits of the faulting instruction
-\item the first XLEN bits of the faulting instruction
+\item the first SXLEN bits of the faulting instruction
\end{compactitem}
-The value loaded into {\tt stval} is right-justified and all unused upper
-bits are cleared to zero.
+The value loaded into {\tt stval} on an illegal-instruction exception is
+right-justified and all unused upper bits are cleared to zero.
+
+For other traps, {\tt stval} is set to zero, but a future standard may
+redefine {\tt stval}'s setting for other traps.
{\tt stval} is a \warl\ register that must be able to hold all valid
virtual addresses and the value 0. It need not be capable of holding all
@@ -795,7 +791,7 @@ Prior to writing {\tt stval}, implementations may convert an invalid address
into some other invalid address that {\tt stval} is capable of holding.
If the feature to return the faulting instruction bits is implemented, {\tt
stval} must also be able to hold all values less than $2^N$, where $N$ is the
-smaller of XLEN and ILEN.
+smaller of SXLEN and ILEN.
\subsection{Supervisor Environment Configuration Register ({\tt senvcfg})}