Commit 243c5f77 authored by Alex Bennée's avatar Alex Bennée
Browse files

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: default avatarAlex Bennée <alex.bennee@linaro.org>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: default avatarRichard Henderson <rth@twiddle.net>
parent bf51c720
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);