KVM: X86 emulator: fix source operand decoding for 8bit mov[zs]x instructions
authorGleb Natapov <gleb@redhat.com>
Wed, 24 Apr 2013 10:38:36 +0000 (13:38 +0300)
committerGleb Natapov <gleb@redhat.com>
Thu, 25 Apr 2013 07:03:50 +0000 (10:03 +0300)
Source operand for one byte mov[zs]x is decoded incorrectly if it is in
high byte register. Fix that.

Cc: stable@vger.kernel.org
Signed-off-by: Gleb Natapov <gleb@redhat.com>
arch/x86/kvm/emulate.c

index 46f63b8d09f43e8887c134f61e347a2181ab3ca3..8e517bba6a7c9434099139ecbb82a5017ca49cbf 100644 (file)
@@ -4172,6 +4172,10 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
                break;
        case OpMem8:
                ctxt->memop.bytes = 1;
+               if (ctxt->memop.type == OP_REG) {
+                       ctxt->memop.addr.reg = decode_register(ctxt, ctxt->modrm_rm, 1);
+                       fetch_register_operand(&ctxt->memop);
+               }
                goto mem_common;
        case OpMem16:
                ctxt->memop.bytes = 2;