Revision a2aaa079 vl.c
b/vl.c | ||
---|---|---|
548 | 548 |
} |
549 | 549 |
} |
550 | 550 |
|
551 |
#ifndef CONFIG_IOTHREAD |
|
552 |
static int64_t qemu_icount_delta(void) |
|
553 |
{ |
|
554 |
if (!use_icount) { |
|
555 |
return 5000 * (int64_t) 1000000; |
|
556 |
} else if (use_icount == 1) { |
|
557 |
/* When not using an adaptive execution frequency |
|
558 |
we tend to get badly out of sync with real time, |
|
559 |
so just delay for a reasonable amount of time. */ |
|
560 |
return 0; |
|
561 |
} else { |
|
562 |
return cpu_get_icount() - cpu_get_clock(); |
|
563 |
} |
|
564 |
} |
|
565 |
#endif |
|
566 |
|
|
551 | 567 |
/* enable cpu_get_ticks() */ |
552 | 568 |
void cpu_enable_ticks(void) |
553 | 569 |
{ |
... | ... | |
4051 | 4067 |
timeout = 5000; |
4052 | 4068 |
else if (tcg_has_work()) |
4053 | 4069 |
timeout = 0; |
4054 |
else if (!use_icount) |
|
4055 |
timeout = 5000; |
|
4056 | 4070 |
else { |
4057 | 4071 |
/* XXX: use timeout computed from timers */ |
4058 | 4072 |
int64_t add; |
4059 | 4073 |
int64_t delta; |
4060 | 4074 |
/* Advance virtual time to the next event. */ |
4061 |
if (use_icount == 1) { |
|
4062 |
/* When not using an adaptive execution frequency |
|
4063 |
we tend to get badly out of sync with real time, |
|
4064 |
so just delay for a reasonable amount of time. */ |
|
4065 |
delta = 0; |
|
4066 |
} else { |
|
4067 |
delta = cpu_get_icount() - cpu_get_clock(); |
|
4068 |
} |
|
4075 |
delta = qemu_icount_delta(); |
|
4069 | 4076 |
if (delta > 0) { |
4070 | 4077 |
/* If virtual time is ahead of real time then just |
4071 | 4078 |
wait for IO. */ |
4072 |
timeout = (delta / 1000000) + 1;
|
|
4079 |
timeout = (delta + 999999) / 1000000;
|
|
4073 | 4080 |
} else { |
4074 | 4081 |
/* Wait for either IO to occur or the next |
4075 | 4082 |
timer event. */ |
Also available in: Unified diff