]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 May 2013 03:08:24 +0000 (20:08 -0700)
commit 660696d1d16a71e15549ce1bf74953be1592bcd3 upstream.

Source operand for one byte mov[zs]x is decoded incorrectly if it is in
high byte register. Fix that.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/emulate.c

index a27e763711087df9e095f440b7e6aaf76cfeff5b..d330b3c619f8f2abc903ad8605a9d36ed20ea110 100644 (file)
@@ -4030,6 +4030,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;