Skip to contentSkip to conversation

target-i386: Don't modify env->eflags around cpu_dump_state

PATCH Applied Richard Henderson 2 participants 2 messages Mar 19, 2013 – Mar 23, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-i386: Don't modify env->eflags around cpu_dump_state

We can compute the value in cpu_dump_state anyway, and gratuitous modifications to eflags creates heisenbugs.

---
 cpu-exec.c           | 3 ---
 target-i386/helper.c | 2 +-
 2 files changed, 1 insertion(+), 4 deletions(-)
cpu-exec.c +0 -3
index 94fedc5..c3ac8f5 100644
@@ -570,10 +570,7 @@ int cpu_exec(CPUArchState *env)
                 if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) {
                     /* restore flags in standard format */
 #if defined(TARGET_I386)
-                    env->eflags = env->eflags | cpu_cc_compute_all(env, CC_OP)
-                        | (DF & DF_MASK);
                     log_cpu_state(env, CPU_DUMP_CCOP);
-                    env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
 #elif defined(TARGET_M68K)
                     cpu_m68k_flush_flags(env, env->cc_op);
                     env->cc_op = CC_OP_FLAGS;
target-i386/helper.c +1 -1
index 9449a0c..282494f 100644
@@ -189,7 +189,7 @@ void cpu_dump_state(CPUX86State *env, FILE *f, fprintf_function cpu_fprintf,
 
     cpu_synchronize_state(env);
 
-    eflags = env->eflags;
+    eflags = cpu_compute_eflags(env);
 #ifdef TARGET_X86_64
     if (env->hflags & HF_CS64_MASK) {
         cpu_fprintf(f,
Signature · 1 line
1.8.1.4
Applied
#1 lore raw

Thanks, applied.

Quoted 41 lines · Richard Henderson

We can compute the value in cpu_dump_state anyway, and gratuitous modifications to eflags creates heisenbugs.

---
 cpu-exec.c           | 3 ---
 target-i386/helper.c | 2 +-
 2 files changed, 1 insertion(+), 4 deletions(-)
cpu-exec.c +0 -3
index 94fedc5..c3ac8f5 100644
@@ -570,10 +570,7 @@ int cpu_exec(CPUArchState *env)
                 if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) {
                     /* restore flags in standard format */
 #if defined(TARGET_I386)
-                    env->eflags = env->eflags | cpu_cc_compute_all(env, CC_OP)
-                        | (DF & DF_MASK);
                     log_cpu_state(env, CPU_DUMP_CCOP);
-                    env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
 #elif defined(TARGET_M68K)
                     cpu_m68k_flush_flags(env, env->cc_op);
                     env->cc_op = CC_OP_FLAGS;
target-i386/helper.c +1 -2
index 9449a0c..282494f 100644
@@ -189,7 +189,7 @@ void cpu_dump_state(CPUX86State *env, FILE *f, fprintf_function cpu_fprintf,
 
     cpu_synchronize_state(env);
 
-    eflags = env->eflags;
+    eflags = cpu_compute_eflags(env);
 #ifdef TARGET_X86_64
     if (env->hflags & HF_CS64_MASK) {
         cpu_fprintf(f,
--

1.8.1.4