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

Function wasm2c_marshal_and_writeback_u32_pair

src/writeback.rs:169–190  ·  view source on GitHub ↗
(
    ctx: &mut VmCtx,
    addr0: usize,
    addr1: usize,
    res: RuntimeResult<(u32, u32)>,
)

Source from the content-addressed store, hash-verified

167#[ensures(ctx_safe(ctx))]
168#[ensures(trace_safe(trace, ctx))]
169pub fn wasm2c_marshal_and_writeback_u32_pair(
170 ctx: &mut VmCtx,
171 addr0: usize,
172 addr1: usize,
173 res: RuntimeResult<(u32, u32)>,
174) -> u32 {
175 if !ctx.fits_in_lin_mem_usize(addr0, 4) {
176 return RuntimeError::Eoverflow.into();
177 }
178 if !ctx.fits_in_lin_mem_usize(addr1, 4) {
179 return RuntimeError::Eoverflow.into();
180 }
181 //log::debug!("wasm2c_marshal_and_writeback_u32_pair: {:?}", result);
182 match res {
183 Ok((v0, v1)) => {
184 ctx.write_u32(addr0, v0); // writeback envc
185 ctx.write_u32(addr1, v1); // writeback environ_buf
186 0
187 }
188 Err(err) => err.into(),
189 }
190}

Calls 2

fits_in_lin_mem_usizeMethod · 0.80
write_u32Method · 0.80

Tested by

no test coverage detected