void sim_engine_run (SIM_DESC sd, int next_cpu_nr, /* ignore */ int nr_cpus, /* ignore */ int siggnal) /* ignore */ { sim_cpu *cpu; SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); cpu = STATE_CPU (sd, 0); while (1) { cpu_single_step (cpu); /* process any events */ if (sim_events_tickn (sd, cpu->cpu_current_cycle)) { sim_events_process (sd); } } }
void MY (f_model_insn_after) (SIM_CPU *current_cpu, int last_p ATTRIBUTE_UNUSED, int cycles) { PROFILE_DATA *p = CPU_PROFILE_DATA (current_cpu); PROFILE_MODEL_TOTAL_CYCLES (p) += cycles; CPU_CRIS_MISC_PROFILE (current_cpu)->basic_cycle_count += cycles; PROFILE_MODEL_CUR_INSN_CYCLES (p) = cycles; #if WITH_HW /* For some reason, we don't get to the sim_events_tick call in cgen-run.c:engine_run_1. Besides, more than one cycle has passed, so we want sim_events_tickn anyway. The "events we want to process" is usually to initiate an interrupt, but might also be other events. We can't do the former until the main loop is at point where it accepts changing the PC without internal inconsistency, so just set a flag and wait. */ if (sim_events_tickn (CPU_STATE (current_cpu), cycles)) STATE_EVENTS (CPU_STATE (current_cpu))->work_pending = 1; #endif }