]> git.kernelconcepts.de Git - karo-tx-linux.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 02:51:57 +0000 (19:51 -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 83756223f8aa770b049f980f81fa5b640f697f72..8c45818c732f1fa26871bf0d9f97cb217f1420e3 100644 (file)
@@ -3737,6 +3737,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;