@@ -2421,7 +2421,7 @@ 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), D(ImplicitOps), 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),
@@ -3161,6 +3161,20 @@ special_insn:
case 8: c->dst.val = (s32)c->dst.val; break;
}
break;
+ case 0x99: /* cwd/cdq/cqo */ {
+ unsigned long rax = c->regs[VCPU_REGS_RAX];
+ unsigned long sign_bit = 1 << ((c->op_bytes * 8) - 1);
+
+ if (rax & sign_bit) {
+ switch (c->op_bytes) {
+ case 2: c->regs[VCPU_REGS_RDX] = 0xffff; break;
+ case 4: c->regs[VCPU_REGS_RDX] = 0xffffffff; break;
+ case 8: c->regs[VCPU_REGS_RDX] = 0xffffffffffffffff; break;
+ }
+ } else
+ c->regs[VCPU_REGS_RDX] = 0;
+ }
+ break;
case 0x9c: /* pushf */
c->src.val = (unsigned long) ctxt->eflags;
emulate_push(ctxt, ops);