[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 30/53] target/i386: implement undocumented "smsw r32" behavior
From: |
Paolo Bonzini |
Subject: |
[PULL 30/53] target/i386: implement undocumented "smsw r32" behavior |
Date: |
Mon, 6 Jul 2020 12:41:32 -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 <richard.henderson@linaro.org>
Reported-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/translate.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/target/i386/translate.c b/target/i386/translate.c
index 5ef72ff401..a1d31f09c1 100644
--- a/target/i386/translate.c
+++ b/target/i386/translate.c
@@ -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 */
--
2.26.2
- [PULL 16/53] i386: hvf: Move Guest LMA reset to macvm_set_cr0(), (continued)
- [PULL 16/53] i386: hvf: Move Guest LMA reset to macvm_set_cr0(), Paolo Bonzini, 2020/07/06
- [PULL 25/53] accel/Kconfig: Extract accel selectors into their own config, Paolo Bonzini, 2020/07/06
- [PULL 01/53] tcg/svm: use host cr4 during NPT page table walk, Paolo Bonzini, 2020/07/06
- [PULL 19/53] MAINTAINERS: Add Cameron as HVF co-maintainer, Paolo Bonzini, 2020/07/06
- [PULL 11/53] coverity: provide Coverity-friendly MIN_CONST and MAX_CONST, Paolo Bonzini, 2020/07/06
- [PULL 31/53] KVM: x86: believe what KVM says about WAITPKG, Paolo Bonzini, 2020/07/06
- [PULL 13/53] i386: hvf: Move synchronize functions to sysemu, Paolo Bonzini, 2020/07/06
- [PULL 15/53] i386: hvf: Make long mode enter and exit clearer, Paolo Bonzini, 2020/07/06
- [PULL 30/53] target/i386: implement undocumented "smsw r32" behavior,
Paolo Bonzini <=
- [PULL 20/53] MAINTAINERS: Fix KVM path expansion glob, Paolo Bonzini, 2020/07/06
- [PULL 32/53] target/i386: sev: provide proper error reporting for query-sev-capabilities, Paolo Bonzini, 2020/07/06
- [PULL 26/53] accel/Kconfig: Add the TCG selector, Paolo Bonzini, 2020/07/06
- [PULL 40/53] pc: fix leak in pc_system_flash_cleanup_unused, Paolo Bonzini, 2020/07/06
- [PULL 29/53] target/i386: remove gen_io_end, Paolo Bonzini, 2020/07/06
- [PULL 33/53] target/i386: sev: fail query-sev-capabilities if QEMU cannot use SEV, Paolo Bonzini, 2020/07/06
- [PULL 35/53] iscsi: return -EIO when sense fields are meaningless, Paolo Bonzini, 2020/07/06
- [PULL 37/53] checkpatch: Change occurences of 'kernel' to 'qemu' in user messages, Paolo Bonzini, 2020/07/06
- [PULL 38/53] target/i386: Correct the warning message of Intel PT, Paolo Bonzini, 2020/07/06
- [PULL 41/53] softmmu: move softmmu only files from root, Paolo Bonzini, 2020/07/06