MCPcopy Create free account
hub / github.com/PLSysSec/wave / wasm2c_marshal_and_writeback_u32

Function wasm2c_marshal_and_writeback_u32

src/writeback.rs:20–36  ·  view source on GitHub ↗
(
    ctx: &mut VmCtx,
    addr: usize,
    res: RuntimeResult<u32>,
)

Source from the content-addressed store, hash-verified

18#[ensures(ctx_safe(ctx))]
19#[ensures(trace_safe(trace, ctx))]
20pub fn wasm2c_marshal_and_writeback_u32(
21 ctx: &mut VmCtx,
22 addr: usize,
23 res: RuntimeResult<u32>,
24) -> u32 {
25 if !ctx.fits_in_lin_mem_usize(addr, 4) {
26 return RuntimeError::Eoverflow.into();
27 }
28 //log::debug!("wasm2c_marshal_and_writeback_u32: {:?}", result);
29 match res {
30 Ok(r) => {
31 ctx.write_u32(addr, r); // writeback result
32 0
33 }
34 Err(err) => err.into(),
35 }
36}
37
38#[with_ghost_var(trace: &mut Trace)]
39#[requires(ctx_safe(ctx))]

Calls 2

fits_in_lin_mem_usizeMethod · 0.80
write_u32Method · 0.80

Tested by

no test coverage detected