Skip to content

Commit 9f44898

Browse files
authored
Merge pull request #899 from riscv/multistate
AR: Clarify triggers and multiple state changes
2 parents 4aad021 + 1b81755 commit 9f44898

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

Sdtrig.tex

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,24 @@ \subsection{Cache Operations}
319319
\end{steps}
320320
\end{commentary}
321321

322+
\section{Multiple State Change Instructions} \label{sec:multistate}
323+
324+
An instruction that performs multiple architectural state changes (e.g.,
325+
register updates and/or memory accesses) might cause a trigger to fire at an
326+
intermediate point in its execution. As a result, architectural state changes up
327+
to that point might have been performed, while subsequent state changes,
328+
starting from the event that activated the trigger, might not have been. The
329+
definition of such an instruction will specify the order in which architectural
330+
state changes take place. Alternatively, it may state that partial execution is
331+
not allowed, implying that a mid-execution trigger must prevent any
332+
architectural state changes from occurring.
333+
334+
Debuggers won't be aware if an instruction has been partially executed. When
335+
they resume execution, they will execute the same instruction once more.
336+
Therefore, it's crucial that partially executing the instruction and then
337+
executing it again leaves the hart in a state closely resembling the state it
338+
would have been in if the instruction had only been executed once.
339+
322340
\section{Trigger Registers}
323341

324342
These registers are CSRs, accessible using the RISC-V {\tt csr} opcodes and

xml/hwbp_registers.xml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -754,21 +754,11 @@
754754
<value v="1" name="before">
755755
The trigger fired before the instruction that matched it was
756756
retired, but after all preceding instructions are retired. This
757-
explicitly allows for instructions to be partially executed.
757+
explicitly allows for instructions to be partially executed, as
758+
described in Section \ref{sec:multistate}.
759+
758760
\Rxepc or \RcsrDpc (depending on \FcsrMcontrolSixAction) must be set
759761
to the virtual address of the instruction that matched.
760-
761-
An instruction that caused a trigger to fire might be executed
762-
partially. In that case not all memory accesses may have been
763-
performed, and some registers may not have been updated. Executing
764-
that instruction again must have the same result as fully executing
765-
it the first time would have, except for any effects due to
766-
non-idempotent memory. Implementations should avoid partial
767-
instruction execution, but it might be unavoidable for instructions
768-
that perform a large number of operations.
769-
770-
For vector instructions, the vstart mechanism can be used to handle
771-
partial execution without duplicating memory accesses.
772762
</value>
773763

774764
<value v="2" name="after">

0 commit comments

Comments
 (0)