[PATCH] KVM: Fix MOVSX emulation

From: Nadav Amit
Date: Sat Jan 14 2012 - 13:34:32 EST


The destination register of MOVSX should be decoded similarily to MOVZX.

Signed-off-by: Nadav Amit <nadav.amit@xxxxxxxxx>
---
arch/x86/kvm/emulate.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 05a562b..7644a83 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -3553,7 +3553,8 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
case OpReg:
decode_register_operand(ctxt, op,
op == &ctxt->dst &&
- ctxt->twobyte && (ctxt->b == 0xb6 || ctxt->b == 0xb7));
+ ctxt->twobyte && ((ctxt->b & 0xfe) == 0xb6 ||
+ (ctxt->b & 0xfe) == 0xbe));
break;
case OpImmUByte:
rc = decode_imm(ctxt, op, 1, false);
--
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/