pub unsafe fn semihost_command(
command: usize,
arg0: usize,
arg1: usize,
) -> usize
Expand description
RISC-V semihosting needs three exact instructions in uncompressed form.
See https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc#11-semihosting-trap-instruction-sequence for more details on the three instructions.
In order to work with semihosting we include the assembly here where we are able to disable compressed instruction support. This follows the example used in the Linux kernel: https://elixir.bootlin.com/linux/v5.12.10/source/arch/riscv/include/asm/jump_label.h#L21 as suggested by the RISC-V developers: https://groups.google.com/a/groups.riscv.org/g/isa-dev/c/XKkYacERM04/m/CdpOcqtRAgAJ