Skip to content

Commit 650bf7c

Browse files
authored
Merge pull request #38 from riscv/kersten1-patch-1
doc team edit
2 parents cb1ddbd + 442d3bd commit 650bf7c

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/riscv-double-trap.adoc

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ An `SRET` instruction sets the `SDT` bit to 0.
137137

138138
[NOTE]
139139
====
140-
A trap handler after saving the state needed for resuming from the trap,
141-
including `scause`, `sepc`, and `stval` among others, should clear the `SDT` bit
142-
when it is reentrant.
140+
After a trap handler has saved the state, such as `scause`, `sepc`,
141+
and `stval`, needed for resuming from the trap and is reentrant, it
142+
should clear the `SDT` bit.
143143
144-
Resetting of the `SDT` by an `SRET` enables the trap handler to detect double
145-
trap occuring during the tail phase, where it restores critical state to return
146-
from a trap.
144+
Resetting the `SDT` by an SRET enables the trap handler to detect a double
145+
trap that may occur during the tail phase, where it restores critical state
146+
to return from a trap.
147147
148148
The consequence of this specification is that if a critical error condition was
149149
caused by a guest page-fault, then the GPA will not be available in `mtval2`
@@ -154,7 +154,7 @@ instruction in this phase of trap handling is not common. However, not recording
154154
the GPA is considered benign because, if required, it can still be obtained
155155
-- albeit with added effort -- through the process of walking the page tables.
156156
157-
For a double trap originating in VS-mode, M-mode should redirect the exception
157+
For a double trap that originates in VS-mode, M-mode should redirect the exception
158158
to HS-mode by copying the values of M-mode CSRs updated by the trap to HS-mode
159159
CSRs and should use an `MRET` to resume execution at the address in `stvec`.
160160
@@ -188,8 +188,8 @@ When a trap is to be taken into M-mode, if the `MDT` bit is currently 0, it is
188188
then set to 1, and the trap is delivered as expected. However, if `MDT` is
189189
already set to 1, then this is an _unexpected trap_. Additionally, when the
190190
Smrnmi extension is implemented, a trap that occurs when executing in M-mode
191-
with the `mnstatus.NMIE` set to 0 is an _unexpected trap_. The handling of an
192-
_unexpected trap_ is as follows:
191+
with the `mnstatus.NMIE` set to 0 is an _unexpected trap_. The _unexpected trap_
192+
is handled as follows:
193193

194194
* When the Smrnmi extension is implemented and `mnstatus.NMIE` is 1, the hart
195195
traps to the RNMI handler. To deliver this trap, the `mnepc` and `mncause`
@@ -200,24 +200,24 @@ _unexpected trap_ is as follows:
200200

201201
[NOTE]
202202
====
203-
The consequence of this specification is that on occurrence of double trap the
204-
RNMI handler is not provided with information that a trap would report in the
205-
`mtval` and the `mtval2` registers. This information, if needed, may be obtained
203+
The consequence of this specification is that on occurrence of double trap, the
204+
RNMI handler is not provided with information that a trap reports in the
205+
`mtval` and the `mtval2` registers. This information, if needed, can be obtained
206206
by the RNMI handler by decoding the instruction at the address in `mnepc` and
207207
examining its source register contents.
208208
====
209209

210210
* When the Smrnmi extension is not implemented, or if the Smrnmi extension is
211211
implemented and `mnstatus.NMIE` is 0, the hart enters a critical-error state
212-
without updating any architectural state including the `pc`. This state
212+
without updating any architectural state, including the `pc`. This state
213213
involves ceasing execution, disabling all interrupts (including NMIs), and
214214
asserting a `critical-error` signal to the platform.
215215

216216
[NOTE]
217217
====
218-
The actions performed by the platform on assertion of a `critical-error` signal
219-
by a hart are platform specific. The range of possible actions include restarting
220-
the affected hart or restarting the entire platform among others.
218+
The actions performed by the platform when a hart asserts a `critical-error` signal
219+
are platform-specific. The range of possible actions include restarting
220+
the affected hart or restarting the entire platform, among others.
221221
====
222222

223223
The `MRET` and `SRET` instructions set the `MDT` bit to 0.
@@ -238,10 +238,10 @@ than VS-mode, `vsstatus.SDT` is set to 0.
238238
[NOTE]
239239
====
240240
The implication of this specification is that resuming from Debug Mode,
241-
following an entry due to a critical error, will either result in an immediate
241+
following an entry due to a critical error will either result in an immediate
242242
re-entry into Debug Mode due to the critical error if `cetrig` is set to 1, or
243243
it will cause the critical-error signal to be asserted to the platform. The
244-
debugger may resume with `cetrig` set to 0 to allow the platform defined actions
244+
debugger can resume with `cetrig` set to 0 to allow the platform-defined actions
245245
on critical-error signal to occur. Other possible actions include initiating a
246246
hart or platform reset using the Debug Module reset control.
247247
====

0 commit comments

Comments
 (0)