]> Git Repo - qemu.git/commitdiff
target/i386: implement undocumented "smsw r32" behavior
authorPaolo Bonzini <[email protected]>
Fri, 26 Jun 2020 09:53:36 +0000 (05:53 -0400)
committerPaolo Bonzini <[email protected]>
Fri, 10 Jul 2020 22:02:22 +0000 (18:02 -0400)
In 32-bit mode, the higher 16 bits of the destination
register are undefined.  In practice CR0[31:0] is stored,
just like in 64-bit mode, so just remove the "if" that
currently differentiates the behavior.

Reviewed-by: Richard Henderson <[email protected]>
Reported-by: Roman Bolshakov <[email protected]>
Reviewed-by: Roman Bolshakov <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
target/i386/translate.c

index 5ef72ff401e896cc0bca1619bfbdfba167b06a3f..a1d31f09c139bbfe96df483731bf5a16c71a2bfc 100644 (file)
@@ -7579,12 +7579,13 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
         CASE_MODRM_OP(4): /* smsw */
             gen_svm_check_intercept(s, pc_start, SVM_EXIT_READ_CR0);
             tcg_gen_ld_tl(s->T0, cpu_env, offsetof(CPUX86State, cr[0]));
-            if (CODE64(s)) {
-                mod = (modrm >> 6) & 3;
-                ot = (mod != 3 ? MO_16 : s->dflag);
-            } else {
-                ot = MO_16;
-            }
+            /*
+             * In 32-bit mode, the higher 16 bits of the destination
+             * register are undefined.  In practice CR0[31:0] is stored
+             * just like in 64-bit mode.
+             */
+            mod = (modrm >> 6) & 3;
+            ot = (mod != 3 ? MO_16 : s->dflag);
             gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 1);
             break;
         case 0xee: /* rdpkru */
This page took 0.037223 seconds and 4 git commands to generate.