aboutsummaryrefslogtreecommitdiff
path: root/target-i386/helper.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2014-09-13 09:45:14 -0700
committerPeter Maydell <peter.maydell@linaro.org>2014-09-25 18:54:21 +0100
commit374e0cd4db321d51ed5fa24498a974085e3f1b6d (patch)
tree369b58030ab7078ced9fcfa56d64e1430e015c80 /target-i386/helper.c
parent1039e1290feb03b331af55d939554bd03ffd3906 (diff)
target-i386: Use cpu_exec_enter/exit qom hooks
Note that the code that was within the "exit" ifdef block was identical to the cpu_compute_eflags inline, so make that simplification at the same time. Signed-off-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1410626734-3804-4-git-send-email-rth@twiddle.net Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target-i386/helper.c')
-rw-r--r--target-i386/helper.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 28fefe0a1f..345bda188d 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1262,3 +1262,24 @@ void do_cpu_sipi(X86CPU *cpu)
{
}
#endif
+
+/* Frob eflags into and out of the CPU temporary format. */
+
+void x86_cpu_exec_enter(CPUState *cs)
+{
+ X86CPU *cpu = X86_CPU(cs);
+ CPUX86State *env = &cpu->env;
+
+ CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
+ env->df = 1 - (2 * ((env->eflags >> 10) & 1));
+ CC_OP = CC_OP_EFLAGS;
+ env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
+}
+
+void x86_cpu_exec_exit(CPUState *cs)
+{
+ X86CPU *cpu = X86_CPU(cs);
+ CPUX86State *env = &cpu->env;
+
+ env->eflags = cpu_compute_eflags(env);
+}