aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/emulate.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-06-11 12:40:15 -0400
committerAvi Kivity <avi@redhat.com>2012-07-09 07:19:03 -0400
commit361cad2b50a2c92b91b6f568db860fabad3bf149 (patch)
tree1be8ea835650139140e3d1ee39bb1e556f53c813 /arch/x86/kvm/emulate.c
parent2dd7caa092f0b1200a885a418e5d33b222183a71 (diff)
KVM: x86 emulator: fix byte-sized MOVZX/MOVSX
Commit 2adb5ad9fe1 removed ByteOp from MOVZX/MOVSX, replacing them by SrcMem8, but neglected to fix the dependency in the emulation code on ByteOp. This caused the instruction not to have any effect in some circumstances. Fix by replacing the check for ByteOp with the equivalent src.op_bytes == 1. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r--arch/x86/kvm/emulate.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 90b549ed8997..30f4912c6a67 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -4517,12 +4517,12 @@ twobyte_insn:
4517 break; 4517 break;
4518 case 0xb6 ... 0xb7: /* movzx */ 4518 case 0xb6 ... 0xb7: /* movzx */
4519 ctxt->dst.bytes = ctxt->op_bytes; 4519 ctxt->dst.bytes = ctxt->op_bytes;
4520 ctxt->dst.val = (ctxt->d & ByteOp) ? (u8) ctxt->src.val 4520 ctxt->dst.val = (ctxt->src.bytes == 1) ? (u8) ctxt->src.val
4521 : (u16) ctxt->src.val; 4521 : (u16) ctxt->src.val;
4522 break; 4522 break;
4523 case 0xbe ... 0xbf: /* movsx */ 4523 case 0xbe ... 0xbf: /* movsx */
4524 ctxt->dst.bytes = ctxt->op_bytes; 4524 ctxt->dst.bytes = ctxt->op_bytes;
4525 ctxt->dst.val = (ctxt->d & ByteOp) ? (s8) ctxt->src.val : 4525 ctxt->dst.val = (ctxt->src.bytes == 1) ? (s8) ctxt->src.val :
4526 (s16) ctxt->src.val; 4526 (s16) ctxt->src.val;
4527 break; 4527 break;
4528 case 0xc0 ... 0xc1: /* xadd */ 4528 case 0xc0 ... 0xc1: /* xadd */