Skip to content

Commit 3f73353

Browse files
authored
Merge pull request #896 from riscv/icount
AR: Clarify why icount matches on every trap.
2 parents 6df3674 + a83e118 commit 3f73353

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Sdext.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ \subsection{Step Bit In Dcsr} \label{stepBit}
141141
instead the instruction is treated as a {\tt nop}. This includes {\tt wfi},
142142
{\tt wrs.sto}, and {\tt wrs.nto}.
143143

144-
\subsection{Icount Trigger}
144+
\subsection{Icount Trigger} \label{stepIcount}
145145

146146
Native debuggers won't have access to \RcsrDcsr, but can use the \RcsrIcount
147147
trigger by setting \FcsrIcountCount to 1.

xml/hwbp_registers.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,19 @@
10091009
If more than one of the above events occur during a single instruction
10101010
execution, the trigger still only matches once for that instruction.
10111011

1012+
\begin{commentary}
1013+
For use in single step, icount must match for traps where the
1014+
instruction will not be reexecuted after the handler, such as
1015+
illegal instructions that are emulated by privileged software and
1016+
the instruction being emulated never retires. Ideally, icount would
1017+
not match for traps where the instruction will later be retried by
1018+
the handler, such as page faults where privileged software modifies
1019+
the page tables and returns to the faulting instruction which
1020+
ultimately retires. Trying to distinguish the two cases leads to
1021+
complex rules, so instead the rule is simply that all traps match.
1022+
See also Section~\ref{stepIcount}.
1023+
\end{commentary}
1024+
10121025
When \FcsrIcountCount is greater than 1 and the trigger matches, then
10131026
\FcsrIcountCount is decremented by 1.
10141027

0 commit comments

Comments
 (0)