target-i386: Move cpu_has_work to cpu.h

+ Remove obsolete cpu_halted() function.

Change-Id: I9d723919b085137c77fd57b9571f7257bb41f159
diff --git a/target-arm/exec.h b/target-arm/exec.h
index ec8e4c0..261d659 100644
--- a/target-arm/exec.h
+++ b/target-arm/exec.h
@@ -24,19 +24,6 @@
 #include "cpu.h"
 #include "exec/exec-all.h"
 
-static inline int cpu_halted(CPUARMState *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 "exec/softmmu_exec.h"
 #endif
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 3fb0544..28932a6 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -1086,13 +1086,24 @@
 }
 #endif
 
-//#include "exec/cpu-all.h"
-#include "exec/exec-all.h"
-
-struct TranslationBlock;
-
+#include "exec/cpu-all.h"
 #include "svm.h"
 
+static inline bool cpu_has_work(CPUX86State *env)
+{
+    int work;
+
+    work = (env->interrupt_request & CPU_INTERRUPT_HARD) &&
+           (env->eflags & IF_MASK);
+    work |= env->interrupt_request & CPU_INTERRUPT_NMI;
+    work |= env->interrupt_request & CPU_INTERRUPT_INIT;
+    work |= env->interrupt_request & CPU_INTERRUPT_SIPI;
+
+    return work;
+}
+
+#include "exec/exec-all.h"
+
 static inline void cpu_pc_from_tb(CPUX86State *env, TranslationBlock *tb)
 {
     env->eip = tb->pc - tb->cs_base;
diff --git a/target-i386/exec.h b/target-i386/exec.h
index 596a276..761a9a7 100644
--- a/target-i386/exec.h
+++ b/target-i386/exec.h
@@ -127,31 +127,6 @@
         (eflags & update_mask) | 0x2;
 }
 
-static inline bool cpu_has_work(CPUX86State *env)
-{
-    int work;
-
-    work = (env->interrupt_request & CPU_INTERRUPT_HARD) &&
-           (env->eflags & IF_MASK);
-    work |= env->interrupt_request & CPU_INTERRUPT_NMI;
-    work |= env->interrupt_request & CPU_INTERRUPT_INIT;
-    work |= env->interrupt_request & CPU_INTERRUPT_SIPI;
-
-    return work;
-}
-
-static inline int cpu_halted(CPUX86State *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(CPUX86State *env, uint64_t val)
diff --git a/target-mips/exec.h b/target-mips/exec.h
index 3467c50..99a47c4 100644
--- a/target-mips/exec.h
+++ b/target-mips/exec.h
@@ -25,17 +25,6 @@
 void cpu_mips_clock_init (CPUMIPSState *env);
 void cpu_mips_tlb_flush (CPUMIPSState *env, int flush_global);
 
-static inline int cpu_halted(CPUMIPSState *env)
-{
-    if (!env->halted)
-        return 0;
-    if (cpu_has_work(env)) {
-        env->halted = 0;
-        return 0;
-    }
-    return EXCP_HALTED;
-}
-
 static inline void compute_hflags(CPUMIPSState *env)
 {
     env->hflags &= ~(MIPS_HFLAG_COP1X | MIPS_HFLAG_64 | MIPS_HFLAG_CP0 |