mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-03 17:05:47 +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
|
@ -194,7 +194,7 @@ struct uc_struct {
|
||||||
// qemu/cpu-exec.c
|
// qemu/cpu-exec.c
|
||||||
BounceBuffer bounce;
|
BounceBuffer bounce;
|
||||||
volatile sig_atomic_t exit_request;
|
volatile sig_atomic_t exit_request;
|
||||||
CPUState *tcg_current_cpu;
|
CPUState *tcg_current_rr_cpu;
|
||||||
|
|
||||||
// qemu/memory.c
|
// qemu/memory.c
|
||||||
bool global_dirty_log;
|
bool global_dirty_log;
|
||||||
|
|
|
@ -491,8 +491,8 @@ int cpu_exec(struct uc_struct *uc, CPUState *cpu)
|
||||||
return EXCP_HALTED;
|
return EXCP_HALTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
uc->current_cpu = cpu;
|
atomic_mb_set(&uc->current_cpu, cpu);
|
||||||
atomic_mb_set(&uc->tcg_current_cpu, cpu);
|
atomic_mb_set(&uc->tcg_current_rr_cpu, cpu);
|
||||||
|
|
||||||
if (unlikely(atomic_mb_read(&uc->exit_request))) {
|
if (unlikely(atomic_mb_read(&uc->exit_request))) {
|
||||||
cpu->exit_request = 1;
|
cpu->exit_request = 1;
|
||||||
|
@ -546,8 +546,8 @@ int cpu_exec(struct uc_struct *uc, CPUState *cpu)
|
||||||
tb_flush(cpu);
|
tb_flush(cpu);
|
||||||
|
|
||||||
/* fail safe : never use current_cpu outside cpu_exec() */
|
/* 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. */
|
/* 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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue