mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-23 06:25:12 +00:00
cpu-exec: Move halt handling out of cpu_exec()
Simplify cpu_exec() by extracting CPU halt state handling code out of cpu_exec() into a new static inline function cpu_handle_halt(). Backports commit 8b2d34e997371c9729a0f41e3cc624d4300bbe78 from qemu
This commit is contained in:
parent
88d00a75ca
commit
fc3d135dac
|
@ -176,6 +176,19 @@ static inline TranslationBlock *tb_find_fast(CPUState *cpu,
|
|||
return tb;
|
||||
}
|
||||
|
||||
static inline bool cpu_handle_halt(CPUState *cpu)
|
||||
{
|
||||
if (cpu->halted) {
|
||||
if (!cpu_has_work(cpu)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
cpu->halted = 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void cpu_handle_debug_exception(CPUState *cpu)
|
||||
{
|
||||
CPUClass *cc = CPU_GET_CLASS(cpu->uc, cpu);
|
||||
|
@ -204,12 +217,8 @@ int cpu_exec(struct uc_struct *uc, CPUState *cpu)
|
|||
int tb_exit = 0;
|
||||
struct hook *hook;
|
||||
|
||||
if (cpu->halted) {
|
||||
if (!cpu_has_work(cpu)) {
|
||||
return EXCP_HALTED;
|
||||
}
|
||||
|
||||
cpu->halted = 0;
|
||||
if (cpu_handle_halt(cpu)) {
|
||||
return EXCP_HALTED;
|
||||
}
|
||||
|
||||
uc->current_cpu = cpu;
|
||||
|
|
Loading…
Reference in a new issue