diff --git a/cpu-exec.c b/cpu-exec.c index 70c3e5ae1..34eaedca0 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -208,8 +208,13 @@ int cpu_exec(CPUState *env1) uint8_t *tc_ptr; unsigned long next_tb; - if (cpu_halted(env1) == EXCP_HALTED) - return EXCP_HALTED; + if (env1->halted) { + if (!cpu_has_work(env1)) { + return EXCP_HALTED; + } + + env1->halted = 0; + } cpu_single_env = env1; diff --git a/target-alpha/exec.h b/target-alpha/exec.h index a8a38d29f..6ae96d148 100644 --- a/target-alpha/exec.h +++ b/target-alpha/exec.h @@ -42,17 +42,6 @@ static inline int cpu_has_work(CPUState *env) return (env->interrupt_request & CPU_INTERRUPT_HARD); } -static inline int cpu_halted(CPUState *env) -{ - if (!env->halted) - return 0; - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) { env->pc = tb->pc; diff --git a/target-arm/exec.h b/target-arm/exec.h index e4c35a33e..44e1b55aa 100644 --- a/target-arm/exec.h +++ b/target-arm/exec.h @@ -32,19 +32,6 @@ static inline int cpu_has_work(CPUState *env) (CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXITTB)); } -static inline int cpu_halted(CPUState *env) { - if (!env->halted) - return 0; - /* An interrupt wakes the CPU even if the I and F CPSR bits are - set. We use EXITTB to silently wake CPU without causing an - actual interrupt. */ - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - #if !defined(CONFIG_USER_ONLY) #include "softmmu_exec.h" #endif diff --git a/target-cris/exec.h b/target-cris/exec.h index 34c0132ce..2d5d297e1 100644 --- a/target-cris/exec.h +++ b/target-cris/exec.h @@ -33,17 +33,6 @@ static inline int cpu_has_work(CPUState *env) return (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI)); } -static inline int cpu_halted(CPUState *env) { - if (!env->halted) - return 0; - - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) { env->pc = tb->pc; diff --git a/target-i386/exec.h b/target-i386/exec.h index fc8945b96..3e7386e91 100644 --- a/target-i386/exec.h +++ b/target-i386/exec.h @@ -304,18 +304,6 @@ static inline int cpu_has_work(CPUState *env) return work; } -static inline int cpu_halted(CPUState *env) { - /* handle exit of HALTED state */ - if (!env->halted) - return 0; - /* disable halt condition */ - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - /* load efer and update the corresponding hflags. XXX: do consistency checks with cpuid bits ? */ static inline void cpu_load_efer(CPUState *env, uint64_t val) diff --git a/target-m68k/exec.h b/target-m68k/exec.h index f31e06ed9..91daa6bac 100644 --- a/target-m68k/exec.h +++ b/target-m68k/exec.h @@ -33,16 +33,6 @@ static inline int cpu_has_work(CPUState *env) return (env->interrupt_request & (CPU_INTERRUPT_HARD)); } -static inline int cpu_halted(CPUState *env) { - if (!env->halted) - return 0; - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) { env->pc = tb->pc; diff --git a/target-microblaze/exec.h b/target-microblaze/exec.h index ab1982847..1efff3062 100644 --- a/target-microblaze/exec.h +++ b/target-microblaze/exec.h @@ -32,17 +32,6 @@ static inline int cpu_has_work(CPUState *env) return (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI)); } -static inline int cpu_halted(CPUState *env) { - if (!env->halted) - return 0; - - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) { env->sregs[SR_PC] = tb->pc; diff --git a/target-mips/exec.h b/target-mips/exec.h index 12736543a..b3c5a13f5 100644 --- a/target-mips/exec.h +++ b/target-mips/exec.h @@ -36,17 +36,6 @@ static inline int cpu_has_work(CPUState *env) return has_work; } -static inline int cpu_halted(CPUState *env) -{ - if (!env->halted) - return 0; - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void compute_hflags(CPUState *env) { env->hflags &= ~(MIPS_HFLAG_COP1X | MIPS_HFLAG_64 | MIPS_HFLAG_CP0 | diff --git a/target-ppc/exec.h b/target-ppc/exec.h index 4688ef571..f87847acb 100644 --- a/target-ppc/exec.h +++ b/target-ppc/exec.h @@ -38,17 +38,6 @@ static inline int cpu_has_work(CPUState *env) } -static inline int cpu_halted(CPUState *env) -{ - if (!env->halted) - return 0; - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) { env->nip = tb->pc; diff --git a/target-s390x/exec.h b/target-s390x/exec.h index bf3f26402..f7893f387 100644 --- a/target-s390x/exec.h +++ b/target-s390x/exec.h @@ -34,18 +34,6 @@ static inline int cpu_has_work(CPUState *env) return env->interrupt_request & CPU_INTERRUPT_HARD; // guess } -static inline int cpu_halted(CPUState *env) -{ - if (!env->halted) { - return 0; - } - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock* tb) { env->psw.addr = tb->pc; diff --git a/target-sh4/exec.h b/target-sh4/exec.h index 61bc1211d..9f1c1f6a0 100644 --- a/target-sh4/exec.h +++ b/target-sh4/exec.h @@ -32,16 +32,6 @@ static inline int cpu_has_work(CPUState *env) return (env->interrupt_request & CPU_INTERRUPT_HARD); } -static inline int cpu_halted(CPUState *env) { - if (!env->halted) - return 0; - if (cpu_has_work(env)) { - env->halted = 0; - return 0; - } - return EXCP_HALTED; -} - #ifndef CONFIG_USER_ONLY #include "softmmu_exec.h" #endif diff --git a/target-sparc/exec.h b/target-sparc/exec.h index f8115716e..f5c221e48 100644 --- a/target-sparc/exec.h +++ b/target-sparc/exec.h @@ -22,16 +22,6 @@ static inline int cpu_has_work(CPUState *env1) } -static inline int cpu_halted(CPUState *env1) { - if (!env1->halted) - return 0; - if (cpu_has_work(env1)) { - env1->halted = 0; - return 0; - } - return EXCP_HALTED; -} - static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) { env->pc = tb->pc;