aboutsummaryrefslogtreecommitdiff
path: root/target-i386/exec.h
diff options
context:
space:
mode:
Diffstat (limited to 'target-i386/exec.h')
-rw-r--r--target-i386/exec.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/target-i386/exec.h b/target-i386/exec.h
index 377f7bd28b..f1cf2b9234 100644
--- a/target-i386/exec.h
+++ b/target-i386/exec.h
@@ -575,3 +575,16 @@ static inline void regs_to_env(void)
env->regs[R_EDI] = EDI;
#endif
}
+
+static inline int cpu_halted(CPUState *env) {
+ /* handle exit of HALTED state */
+ if (env->hflags & HF_HALTED_MASK)
+ return 0;
+ /* disable halt condition */
+ if ((env->interrupt_request & CPU_INTERRUPT_HARD) &&
+ (env->eflags & IF_MASK)) {
+ env->hflags &= ~HF_HALTED_MASK;
+ return 0;
+ }
+ return EXCP_HALTED;
+}