diff --git a/include/uc_priv.h b/include/uc_priv.h index e3a98ec2..a3036ada 100644 --- a/include/uc_priv.h +++ b/include/uc_priv.h @@ -194,7 +194,7 @@ struct uc_struct { // qemu/cpu-exec.c BounceBuffer bounce; volatile sig_atomic_t exit_request; - CPUState *tcg_current_cpu; + CPUState *tcg_current_rr_cpu; // qemu/memory.c bool global_dirty_log; diff --git a/qemu/cpu-exec.c b/qemu/cpu-exec.c index f5387062..9419e48e 100644 --- a/qemu/cpu-exec.c +++ b/qemu/cpu-exec.c @@ -491,8 +491,8 @@ int cpu_exec(struct uc_struct *uc, CPUState *cpu) return EXCP_HALTED; } - uc->current_cpu = cpu; - atomic_mb_set(&uc->tcg_current_cpu, cpu); + atomic_mb_set(&uc->current_cpu, cpu); + atomic_mb_set(&uc->tcg_current_rr_cpu, cpu); if (unlikely(atomic_mb_read(&uc->exit_request))) { cpu->exit_request = 1; @@ -546,8 +546,8 @@ int cpu_exec(struct uc_struct *uc, CPUState *cpu) tb_flush(cpu); /* fail safe : never use current_cpu outside cpu_exec() */ - uc->current_cpu = NULL; + atomic_set(&uc->current_cpu, NULL); /* Does not need atomic_mb_set because a spurious wakeup is okay. */ - atomic_set(&uc->tcg_current_cpu, NULL); + atomic_set(&uc->tcg_current_rr_cpu, NULL); return ret; }