+
+#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