fn sidevm_ocall(
    env: &Env,
    task_id: i32,
    func_id: i32,
    p0: IntPtr,
    p1: IntPtr,
    p2: IntPtr,
    p3: IntPtr,
) -> IntRet {
    let mut env = env.inner.lock().unwrap();
    let env = &mut *env;

    env.state.current_task = task_id;
    let result = set_task_env(env.state.awake_tasks.clone(), task_id, || {
        env::dispatch_call(&mut env.state, &env.memory, func_id, p0, p1, p2, p3)
    });
    if env.state.ocall_trace_enabled {
        let func_name = env::ocall_id2name(func_id);
        let vm_id = env.state.short_id();
        log::trace!(
            target: "sidevm",
            "[vm:{vm_id:<8}][{task_id:<3}](S) {func_name}({p0}, {p1}, {p2}, {p3}) = {result:?}"
        );
    }
    result.encode_ret()
}
// Support all ocalls. Put the result into a temporary vec and wait for next fetch_result ocall to fetch the result.
Support all ocalls. Put the result into a temporary vec and wait for next fetch_result ocall to fetch the result.
Support all ocalls . Put the result into a temporary vec and wait for next fetch_result ocall to fetch the result .
fn sidevm_ocall(
    env: &Env,
    task_id: i32,
    func_id: i32,
    p0: IntPtr,
    p1: IntPtr,
    p2: IntPtr,
    p3: IntPtr,
) -> IntRet {
    let mut env = env.inner.lock().unwrap();
    let env = &mut *env;
    env.state.current_task = task_id;
    let result = set_task_env(env.state.awake_tasks.clone(), task_id, || {
        env::dispatch_call(&mut env.state, &env.memory, func_id, p0, p1, p2, p3)
    });
    if env.state.ocall_trace_enabled {
        let func_name = env::ocall_id2name(func_id);
        let vm_id = env.state.short_id();
        log::trace!(
            target: "sidevm",
            "[vm:{vm_id:<8}][{task_id:<3}](S) {func_name}({p0}, {p1}, {p2}, {p3}) = {result:?}"
        );
    }
    result.encode_ret()
}
fn sidevm_ocall ( env : & Env , task_id : i32 , func_id : i32 , p0 : IntPtr , p1 : IntPtr , p2 : IntPtr , p3 : IntPtr , ) -> IntRet { let mut env = env . inner . lock ( ) . unwrap ( ) ; let env = & mut * env ; env . state . current_task = task_id ; let result = set_task_env ( env . state . awake_tasks . clone ( ) , task_id , | | { env :: dispatch_call ( & mut env . state , & env . memory , func_id , p0 , p1 , p2 , p3 ) } ) ; if env . state . ocall_trace_enabled { let func_name = env :: ocall_id2name ( func_id ) ; let vm_id = env . state . short_id ( ) ; log :: trace ! ( target " " " " ) ; } result . encode_ret ( ) }
Support all ocalls.
Support all ocalls .
env
&Env
task_id
i32
func_id
i32
p0
IntPtr
p1
IntPtr
p2
IntPtr
p3
IntPtr
env
&Env
task_id
i32
func_id
i32
p0
IntPtr
p1
IntPtr
p2
IntPtr
p3
IntPtr