KVM: x86 emulator: fix Src2CL decode
authorAvi Kivity <avi@redhat.com>
Tue, 13 Sep 2011 07:45:38 +0000 (10:45 +0300)
committerAvi Kivity <avi@redhat.com>
Sun, 25 Sep 2011 16:14:58 +0000 (19:14 +0300)
Src2CL decode (used for double width shifts) erronously decodes only bit 3
of %rcx, instead of bits 7:0.

Fix by decoding %cl in its entirety.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/emulate.c

index 6f08bc940fa8051426ffa67531f548951f6dc7c4..8b4cc5f067de5977595d2cf43d139b10acf9e2d0 100644 (file)
@@ -3603,7 +3603,7 @@ done_prefixes:
                break;
        case Src2CL:
                ctxt->src2.bytes = 1;
-               ctxt->src2.val = ctxt->regs[VCPU_REGS_RCX] & 0x8;
+               ctxt->src2.val = ctxt->regs[VCPU_REGS_RCX] & 0xff;
                break;
        case Src2ImmByte:
                rc = decode_imm(ctxt, &ctxt->src2, 1, true);