]> git.karo-electronics.de Git - linux-beck.git/commitdiff
KVM: x86 emulator: implement CWD (opcode 99)
authorAvi Kivity <avi@redhat.com>
Thu, 19 Aug 2010 12:13:00 +0000 (15:13 +0300)
committerAvi Kivity <avi@redhat.com>
Sun, 24 Oct 2010 08:51:16 +0000 (10:51 +0200)
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/emulate.c

index 55849c3d5d8c1fc64b50e7e531bd2ef2caebbd3c..e257f22868663caf1f9f1ebb09fbafd8f8b0f3db 100644 (file)
@@ -2280,6 +2280,18 @@ static int em_imul_3op(struct x86_emulate_ctxt *ctxt)
        return em_imul(ctxt);
 }
 
+static int em_cwd(struct x86_emulate_ctxt *ctxt)
+{
+       struct decode_cache *c = &ctxt->decode;
+
+       c->dst.type = OP_REG;
+       c->dst.bytes = c->src.bytes;
+       c->dst.addr.reg = &c->regs[VCPU_REGS_RDX];
+       c->dst.val = ~((c->src.val >> (c->src.bytes * 8 - 1)) - 1);
+
+       return X86EMUL_CONTINUE;
+}
+
 static int em_rdtsc(struct x86_emulate_ctxt *ctxt)
 {
        unsigned cpl = ctxt->ops->cpl(ctxt->vcpu);
@@ -2425,7 +2437,8 @@ static struct opcode opcode_table[256] = {
        /* 0x90 - 0x97 */
        X8(D(SrcAcc | DstReg)),
        /* 0x98 - 0x9F */
-       D(DstAcc | SrcNone), N, D(SrcImmFAddr | No64), N,
+       D(DstAcc | SrcNone), I(ImplicitOps | SrcAcc, em_cwd),
+       D(SrcImmFAddr | No64), N,
        D(ImplicitOps | Stack), D(ImplicitOps | Stack), N, N,
        /* 0xA0 - 0xA7 */
        D(ByteOp | DstAcc | SrcMem | Mov | MemAbs), D(DstAcc | SrcMem | Mov | MemAbs),