aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-09-11 04:23:02 -0400
committerAvi Kivity <avi@redhat.com>2011-09-25 12:52:40 -0400
commitcaa8a168e35650961b9b0d43b9b6fc2279351949 (patch)
treeff416cf45a7721c67789dd32b7bcb49f3151d5f0 /arch/x86
parentc61fa9d63b40b06522c5f1d940b084323a090688 (diff)
KVM: x86 emulator: disable writeback for TEST
The TEST instruction doesn't write its destination operand. This could cause problems if an MMIO register was accessed using the TEST instruction. Recently Windows XP was observed to use TEST against the APIC ICR; this can cause spurious IPIs. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/emulate.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index e10fd3732d1..af06539369b 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -1670,6 +1670,8 @@ static int em_grp3(struct x86_emulate_ctxt *ctxt)
1670 switch (ctxt->modrm_reg) { 1670 switch (ctxt->modrm_reg) {
1671 case 0 ... 1: /* test */ 1671 case 0 ... 1: /* test */
1672 emulate_2op_SrcV(ctxt, "test"); 1672 emulate_2op_SrcV(ctxt, "test");
1673 /* Disable writeback. */
1674 ctxt->dst.type = OP_NONE;
1673 break; 1675 break;
1674 case 2: /* not */ 1676 case 2: /* not */
1675 ctxt->dst.val = ~ctxt->dst.val; 1677 ctxt->dst.val = ~ctxt->dst.val;
@@ -2513,6 +2515,8 @@ static int em_cmp(struct x86_emulate_ctxt *ctxt)
2513static int em_test(struct x86_emulate_ctxt *ctxt) 2515static int em_test(struct x86_emulate_ctxt *ctxt)
2514{ 2516{
2515 emulate_2op_SrcV(ctxt, "test"); 2517 emulate_2op_SrcV(ctxt, "test");
2518 /* Disable writeback. */
2519 ctxt->dst.type = OP_NONE;
2516 return X86EMUL_CONTINUE; 2520 return X86EMUL_CONTINUE;
2517} 2521}
2518 2522