mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
cpus: check cpu->running in cpu_get_icount_raw()
The lifetime of current_cpu is now the lifetime of the vCPU thread. However get_icount_raw() can apply a fudge factor if called while code is running to take into account the current executed instruction count. To ensure this is always the case we also check cpu->running. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
parent
bf51c7206f
commit
243c5f77f6
1 changed files with 1 additions and 1 deletions
2
cpus.c
2
cpus.c
|
@ -229,7 +229,7 @@ int64_t cpu_get_icount_raw(void)
|
|||
CPUState *cpu = current_cpu;
|
||||
|
||||
icount = timers_state.qemu_icount;
|
||||
if (cpu) {
|
||||
if (cpu && cpu->running) {
|
||||
if (!cpu->can_do_io) {
|
||||
fprintf(stderr, "Bad icount read\n");
|
||||
exit(1);
|
||||
|
|
Loading…
Reference in a new issue