22 lines
570 B
Rust
22 lines
570 B
Rust
use crate::host_context::HostContext;
|
|
use crate::host_return::HostReturn;
|
|
use crate::vm_fault::VmFault;
|
|
use prometeu_bytecode::Value;
|
|
|
|
pub type SyscallId = u32;
|
|
|
|
pub trait NativeInterface {
|
|
/// Dispatches a syscall from the Virtual Machine to the native implementation.
|
|
///
|
|
/// ABI Rule: Arguments for the syscall are passed in `args`.
|
|
///
|
|
/// Returns are written via `ret`.
|
|
fn syscall(
|
|
&mut self,
|
|
id: SyscallId,
|
|
args: &[Value],
|
|
ret: &mut HostReturn,
|
|
ctx: &mut HostContext,
|
|
) -> Result<(), VmFault>;
|
|
}
|