mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-24 13:58:16 +00:00
tcg: rename tcg_current_cpu to tcg_current_rr_cpu
..and make the definition local to cpus. In preparation for MTTCG the concept of a global tcg_current_cpu will no longer make sense. However we still need to keep track of it in the single-threaded case to be able to exit quickly when required. qemu_cpu_kick_no_halt() moves and becomes qemu_cpu_kick_rr_cpu() to emphasise its use-case. qemu_cpu_kick now kicks the relevant cpu as well as qemu_kick_rr_cpu() which will become a no-op in MTTCG. For the time being the setting of the global exit_request remains. Backports commit 791158d93b27f22a17c2ada06621831d54f09a2c from qemu Also atomically sets the unicorn equivalents
This commit is contained in:
parent
18a229a69f
commit
4d90497d14
2 changed files with 5 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue