Skip to content

Commit

Permalink
clarify trap handler expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
ved-rivos committed Oct 30, 2023
1 parent f781c46 commit b389045
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions cfi_forward.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,9 @@ of the following conditions are true:
* The `ELP` is `LP_EXPECTED` and the `LPL` is not zero and the `LPL` does not
match the expected landing pad label in bits 31:12 of the `x7` register.

If the instruction causes an software-check exception, the `ELP` does not
change. The behavior of the trap caused by this software-check exception is
specified in section <<FORWARD_TRAPS>>. If a software-check exception is not
caused then the `ELP` is updated to `NO_LP_EXPECTED`.
The behavior of the trap if a software-check exception is raised by this
instruction is specified in section <<FORWARD_TRAPS>>. If a software-check
exception is not caused then the `ELP` is updated to `NO_LP_EXPECTED`.

[wavedrom, ,svg]
....
Expand Down Expand Up @@ -579,9 +578,9 @@ that specified by `pelp` in `dcsr`.
[NOTE]
====
The trap handler in privilege mode `x` must save the `xPELP` bit and the `x7`
register before performing an indirect call/jump. If the privilege mode `x`
can respond to interrupts, then the trap handler should also save these values
before enabling interrupts.
register before performing an indirect call/jump if `xLPE=1`. If the privilege
mode `x` can respond to interrupts and `xLPE=1`, then the trap handler should
also save these values before enabling interrupts.
The trap handler in privilege mode `x` must restore the saved `xPELP` bit and
the `x7` register before executing the `xRET` instruction to return from a
Expand Down

0 comments on commit b389045

Please sign in to comment.