KVM: x86: movnti minimum op size of 32-bit is not kept
authorNadav Amit <namit@cs.technion.ac.il>
Mon, 2 Jun 2014 15:34:08 +0000 (18:34 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 18 Jun 2014 15:46:18 +0000 (17:46 +0200)
If the operand-size prefix (0x66) is used in 64-bit mode, the emulator would
assume the destination operand is 64-bit, when it should be 32-bit.

Reminder: movnti does not support 16-bit operands and its default operand size
is 32-bit.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/emulate.c

index 4cb0da66028391a93ecb6fe508340f6220724291..be3f7645e39d7b86f77e63130d771eebe231d1fa 100644 (file)
@@ -4836,8 +4836,8 @@ twobyte_insn:
                break;
        case 0xc3:              /* movnti */
                ctxt->dst.bytes = ctxt->op_bytes;
-               ctxt->dst.val = (ctxt->op_bytes == 4) ? (u32) ctxt->src.val :
-                                                       (u64) ctxt->src.val;
+               ctxt->dst.val = (ctxt->op_bytes == 8) ? (u64) ctxt->src.val :
+                                                       (u32) ctxt->src.val;
                break;
        default:
                goto cannot_emulate;