Skip to main content

Crate thruput_syscall

Crate thruput_syscall 

Source
Expand description

§Thruput syscall dispatch

The raw guest-exit boundary for Thruput syscalls. This crate contains the single dispatch chokepoint, syscall_wrapper, which leaves the guest and executes a system call. It speaks only in integer words (SyscallWord) and raw i32 error codes — the typed SyscallNo / SysErr layer lives in thruput-xdr.

A dispatch path exists only when the target is riscv32, or when the syscalls_mock feature is enabled. On any other target (a plain host without the mock) there is no way to leave the guest, so the dispatch chokepoint syscall_wrapper is not exported. This keeps a feature-less host build (and cargo build -p, cargo hack, rust-analyzer) clean without a compile_error! guard. The SyscallWord type alias, by contrast, is a pure pointer-width type with no dispatch dependency, so it is always defined.

There are two guest dispatch paths, selected by target:

  • riscv32: syscall_wrapper issues the RISC-V ecall trap instruction directly, passing the syscall number in a0 and arguments in a1..a7 (the host returns the error code in a0).
  • native mock (syscalls_mock): syscall_wrapper calls a native syscall_wrapper_impl symbol, used by native_exec in the SDK and by the syscall tests.

You should never need to invoke syscall_wrapper directly; instead use the typed bindings generated in thruput-xdr.

Functions§

syscall_wrapper
The single dispatch chokepoint: leaves the guest and executes a syscall.

Type Aliases§

SyscallWord