diff --git a/softmmu/icount.c b/softmmu/icount.c index 21341a4ce49eccb8bf8699ce056d1f8d1dae16d4..7cda8b6c314eb2e7590e8824e635a3c46ec4e47a 100644 --- a/softmmu/icount.c +++ b/softmmu/icount.c @@ -261,10 +261,15 @@ static void icount_warp_rt(void) if (icount_enabled() == 2) { /* * In adaptive mode, do not let QEMU_CLOCK_VIRTUAL run too - * far ahead of real time. + * far ahead of real time.(it might already be ahead so careful not + * to go backwards). */ int64_t cur_icount = icount_get_locked(); int64_t delta = clock - cur_icount; + + if (delta < 0) { + delta = 0; + } warp_delta = MIN(warp_delta, delta); } qatomic_set_i64(&timers_state.qemu_icount_bias,