@@ -20,18 +20,21 @@ use crate::kernel::{self, ExecutionError, Kernel, SyscallError};
20
20
pub ( super ) trait BindSyscall < Args , Ret , Func > {
21
21
/// Bind a syscall to the linker.
22
22
///
23
- /// The return type will be automatically adjusted to return `Result<(u32, ...), Trap>` where
24
- /// `u32` is the error code and `...` is the previous return type. For example:
23
+ /// 1. The return type will be automatically adjusted to return `Result<u32, Trap>` where
24
+ /// `u32` is the error code.
25
+ /// 2. If the return type is non-empty (i.e., not `()`), an out-pointer will be prepended to the
26
+ /// arguments for the return-value.
25
27
///
26
- /// - `kernel::Result<()>` will become `kernel::Result<u32>`.
27
- /// - `kernel::Result<i64>` will become `Result<(u32, i64), Trap>`.
28
- /// - `kernel::Result<(i32, i32)>` will become `Result<(u32, i32, i32), Trap>`.
28
+ /// By example:
29
+ ///
30
+ /// - `fn(u32) -> kernel::Result<()>` will become `fn(u32) -> Result<u32, Trap>`.
31
+ /// - `fn(u32) -> kernel::Result<i64>` will become `fn(u32, u32) -> Result<u32, Trap>`.
29
32
///
30
33
/// # Example
31
34
///
32
35
/// ```ignore
33
36
/// mod my_module {
34
- /// pub fn zero(kernel: & mut impl Kernel, memory: &mut [u8] , arg: i32) -> crate::fvm::kernel::Result<i32> {
37
+ /// pub fn zero(mut context: Context<'_, impl Kernel> , arg: i32) -> crate::fvm::kernel::Result<i32> {
35
38
/// Ok(0)
36
39
/// }
37
40
/// }
0 commit comments