From 81f8a1be804e116c15aff1bc04884222fabbc6b2 Mon Sep 17 00:00:00 2001 From: Andrew Dutcher Date: Fri, 7 Sep 2018 21:39:51 -0400 Subject: [PATCH] eflags patch Preserves EFLAGS across basic blocks. Reapplies commit 3a1f231e8fbbe51cfd9898dce7efa83e70a17587 from qemu --- qemu/target/i386/cpu.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qemu/target/i386/cpu.h b/qemu/target/i386/cpu.h index b332cfe9..46e386f6 100644 --- a/qemu/target/i386/cpu.h +++ b/qemu/target/i386/cpu.h @@ -1709,9 +1709,10 @@ uint32_t cpu_cc_compute_all(CPUX86State *env1, int op); static inline uint32_t cpu_compute_eflags(CPUX86State *env) { - uint32_t eflags = env->eflags; + // Unicorn: Modified to use eflags0 instead of eflags + uint32_t eflags = env->eflags0; if (tcg_enabled(env->uc)) { - eflags |= cpu_cc_compute_all(env, CC_OP) | (env->df & DF_MASK); + eflags = (eflags & ~(CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C | DF_MASK)) | cpu_cc_compute_all(env, CC_OP) | (env->df & DF_MASK); } return eflags; }