-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sample semihost trap function which avoids page-crossing
This function is aligned to a 16-byte boundary, which is the size of the function, so that the semihosting instruction sequence doesn't cross a page boundary. Signed-off-by: Keith Packard <[email protected]>
- Loading branch information
1 parent
cfc7969
commit 941a577
Showing
1 changed file
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
= RISC-V Semihosting | ||
Krste Asanovic <krste@sifive.com>; Palmer Dabbelt <palmer@dabbelt.com>; Liviu Ionescu <ilg@livius.net>; Keith Packard <keith[email protected]>; Megan Wachs <megan@sifive.com> | ||
:title-logo-image: image:Semifreddo_dessert.jpg[Semifreddo desert] | ||
:title-page: | ||
:version: 0.1 | ||
:revnumber: v{version} | ||
:revdate: 1 Jan 1970 | ||
|
@@ -62,7 +63,24 @@ not be compressed 16-bit instructions. This same sequence is used on | |
all RISC-V architectures. On systems with paging support, 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. | ||
from potentially missing pages. <<function>> shows how this can be done | ||
by placing the sequence in a separate function and aligning that to | ||
prevent that from spanning a page boundary. | ||
|
||
.RISC-V Semihosting Trap Function | ||
[#function] | ||
---- | ||
.option norvc | ||
.text | ||
.align 16 | ||
.global sys_semihost | ||
.type sys_semihost @function | ||
sys_semihost: | ||
slli zero, zero, 0x1f | ||
ebreak | ||
srai zero, zero, 0x7 | ||
ret | ||
---- | ||
|
||
=== Semihosting Register Definitions | ||
|
||
|