Skip to content

Commit

Permalink
Add notes about semihosting NOPs; clarify there is only one semihosti…
Browse files Browse the repository at this point in the history
…ng exit NOP (#1539)

* There is only one semihosting call, not several

The comment suggested otherwise.

* Add NOTE to HINT section about semihosting NOPs
  • Loading branch information
aswaterman committed Jul 23, 2024
1 parent 6024788 commit 3544bba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/rv32.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ ignore the _predecessor_ and _successor_ fields and always execute a
conservative fence on all operations.
====

[[ecall-ebreak]]
=== Environment Call and Breakpoints
`SYSTEM` instructions are used to access system functionality that might
require privileged access and are encoded using the I-type instruction
Expand Down Expand Up @@ -924,7 +925,7 @@ to distinguish a semihosting EBREAK from a debugger inserted EBREAK.
....
slli x0, x0, 0x1f # Entry NOP
ebreak # Break to debugger
srai x0, x0, 7 # NOP encoding the semihosting call number 7
srai x0, x0, 7 # Exit NOP
....
Note that these three instructions must be 32-bit-wide instructions,
Expand Down Expand Up @@ -1063,3 +1064,5 @@ hints, security tags, and instrumentation flags for simulation/emulation.
|SLTU |_rd_=`x0` |latexmath:[$2^{10}$]
|===

TIP: When allocating `slli x0, x0, 0x1f` or `srai x0, x0, 7` as custom HINTs,
take note of their use in semihosting calls, as described in <<ecall-ebreak>>.

0 comments on commit 3544bba

Please sign in to comment.