Skip to content

Commit

Permalink
Improve the requirement for callers with paging enabled
Browse files Browse the repository at this point in the history
The current requirement of ensuring semihosting instruction sequence
is aligned within a single page is not suitable for RISC-V platforms
where TLB is not implemented. To address this, add more stricter
requirement where caller must ensure semihosting instruction sequence
and data passed via memory are both paged in.

Suggested-by: Ved Shanbhogue <[email protected]>
Signed-off-by: Anup Patel <[email protected]>
  • Loading branch information
avpatel committed Aug 3, 2024
1 parent 1c93c8a commit c797379
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/binary-interface.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,18 @@ srai x0, x0, 7 # 0x40705013 Exit NOP
----

These three instructions must be 32-bit wide instructions. This same sequence
is used on all RISC-V architectures. If paging is in use in the current mode,
this sequence must not cross a page boundary as the semihosting system must
be able to check for the semihosting sequence without needing data from
potentially missing pages. The <<function>> shows how this can be done by
placing the sequence in a separate assembly function and aligning that to
prevent that from spanning a page boundary.
is used on all RISC-V architectures. If address translation and protection is
enabled for the semihosting caller then the semihosting instruction sequence
and data passed via memory must be paged in else the behavior of the semihosting
call is UNSPECIFIED. The <<function>> shows an example assembly function to invoke
a semihosting service which can be used by callers with no address translation and
protection.

.RISC-V Semihosting Assembly Reference Function
[#function]
----
.option norvc
.text
.balign 16
.global sys_semihost
.type sys_semihost @function
sys_semihost:
Expand Down

0 comments on commit c797379

Please sign in to comment.