MCPcopy Create free account
hub / github.com/MultiFuzz/MultiFuzz / mem_write

Function mem_write

icicle-cortexm/src/unicorn_api.rs:320–343  ·  view source on GitHub ↗
(
    ctx: *mut c_void,
    address: u64,
    buf: *const c_void,
    count: usize,
)

Source from the content-addressed store, hash-verified

318}
319
320pub unsafe extern "C" fn mem_write(
321 ctx: *mut c_void,
322 address: u64,
323 buf: *const c_void,
324 count: usize,
325) -> uc_err {
326 let ctx = &mut *ctx.cast::<Context>();
327 let vm = unsafe { &mut *ctx.vm };
328
329 let result = match count {
330 1 => vm.cpu.mem.write_u8(address, *buf.cast(), perm::NONE),
331 2 => vm.cpu.mem.write_u16(address, *buf.cast(), perm::NONE),
332 4 => vm.cpu.mem.write_u32(address, *buf.cast(), perm::NONE),
333 8 => vm.cpu.mem.write_u64(address, *buf.cast(), perm::NONE),
334 _ => {
335 let buf = std::slice::from_raw_parts(buf.cast::<u8>(), count);
336 vm.cpu.mem.write_bytes(address, buf, perm::NONE)
337 }
338 };
339 match result {
340 Ok(_) => UC_ERR_OK,
341 Err(err) => write_err_to_uc_err(err),
342 }
343}
344
345pub unsafe extern "C" fn set_timer_countdown(ctx: *mut c_void, value: u64) -> uc_err {
346 let ctx = &mut *ctx.cast::<Context>();

Callers

nothing calls this directly

Calls 1

write_err_to_uc_errFunction · 0.85

Tested by

no test coverage detected