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

Method run

icicle-cortexm/src/lib.rs:443–480  ·  view source on GitHub ↗
(&mut self, vm: &mut icicle_vm::Vm)

Source from the content-addressed store, hash-verified

441 }
442
443 fn run(&mut self, vm: &mut icicle_vm::Vm) -> anyhow::Result<VmExit> {
444 let (icicle_exit, fuzzware_exit) = self.with_uc_ptr(vm, |uc| {
445 let ctx = unsafe { &mut *(*uc).ctx.cast::<Context>() };
446 let vm = unsafe { &mut *ctx.vm };
447
448 let exit = vm.run();
449
450 if let Some(fuzzware_exit) =
451 vm.env_mut::<FuzzwareEnvironment>().unwrap().fuzzware_exit.take()
452 {
453 let icicle_exit = match fuzzware_exit {
454 fuzzware::uc_err::UC_ERR_OK => VmExit::Halt,
455
456 fuzzware::uc_err::UC_ERR_BLOCK_LIMIT
457 | fuzzware::uc_err::UC_ERR_NO_FUZZ_CONSUMPTION
458 | fuzzware::uc_err::UC_ERR_INTERRUPT_LIMIT => VmExit::InstructionLimit,
459
460 fuzzware::uc_err::UC_ERR_NVIC_ASSERTION => {
461 VmExit::UnhandledException((ExceptionCode::InternalError, 0))
462 }
463
464 fuzzware::uc_err::UC_ERR_NVIC_RESET => VmExit::Killed,
465
466 fuzzware::uc_err::UC_ERR_FETCH_PROT => VmExit::UnhandledException((
467 ExceptionCode::InvalidInstruction,
468 vm.cpu.read_pc(),
469 )),
470
471 x => VmExit::UnhandledException((ExceptionCode::UnknownError, x as u64)),
472 };
473 return (icicle_exit, fuzzware_exit);
474 }
475 (exit, fuzzware::uc_err::UC_ERR_OK)
476 });
477
478 self.fuzzware_exit = fuzzware_exit;
479 Ok(icicle_exit)
480 }
481}
482
483impl<T> icicle_fuzzing::FuzzTarget for CortexmTarget<T> {

Callers

nothing calls this directly

Calls 2

with_uc_ptrMethod · 0.80
takeMethod · 0.80

Tested by

no test coverage detected