Skip to content

Commit

Permalink
Merge pull request #38 from riscv/frz-clarification
Browse files Browse the repository at this point in the history
address issue #37, adding clarification of LCOFIFRZ behavior when no LCOFI trap is raised
  • Loading branch information
bcstrongx authored Oct 4, 2024
2 parents 5fdbcfb + 21931aa commit f7dbd0c
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions body.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -731,14 +731,9 @@ When `sctrctl`.LCOFIFRZ=1 and a local counter overflow interrupt
[NOTE]
[%unbreakable]
====
_Freeze on LCOFI ensures that the execution path leading to the sampled
instruction (xepc) is preserved, and that the local counter overflow
interrupt (LCOFI) and associated Interrupt Service Routine (ISR) do not
displace any recorded transfer history state. It is the responsibility
of the ISR to clear FROZEN before xRET, if continued control transfer
recording is desired._
_LCOFI refers only to architectural traps directly caused by a local counter overflow. If a local counter overflow interrupt is recognized without a trap, for instance by reading mip, FROZEN is not automatically set._
_Freeze on LCOFI ensures that the execution path leading to the sampled instruction (`xepc`) is preserved, and that the local counter overflow interrupt (LCOFI) and associated Interrupt Service Routine (ISR) do not displace any recorded transfer history state. It is the responsibility of the ISR to clear FROZEN before xRET, if continued control transfer recording is desired._
_LCOFI refers only to architectural traps directly caused by a local counter overflow. If a local counter overflow interrupt is recognized without a trap, FROZEN is not automatically set. For instance, no freeze occurs if the LCOFI is pended while interrupts are masked, and software recognizes the LCOFI (perhaps by reading `stopi` or `sip`) and clears `sip`.LCOFIP before the trap is raised. As a result, some or all CTR history may be overwritten while handling the LCOFI. Such cases are expected to be very rare; for most usages (e.g., application profiling) privilege mode filtering is sufficient to ensure that CTR updates are inhibited while interrupts are handled in a more privileged mode._
====
Similarly, on a breakpoint exception that traps to M-mode or S-mode with `sctrctl`.BPFRZ=1, FROZEN is set by hardware. The breakpoint exception itself is not recorded.

Expand Down

0 comments on commit f7dbd0c

Please sign in to comment.