On 08/19/2010 05:25 PM, Mohammed Gamal wrote:
Signed-off-by: Mohammed Gamal<m.gamal005@xxxxxxxxx> --- arch/x86/kvm/emulate.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index ee4bb69..fddf76d 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -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;
Again I have something (a bit simpler) in my queue, will push it soon. I applied your test case.
We need to work out a way of not duplicating this work. -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html