diff options
author | Avi Kivity <avi@redhat.com> | 2010-08-19 08:13:00 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-10-24 04:51:16 -0400 |
commit | 61429142802b068609ffd8ef48d891e05eeea0b9 (patch) | |
tree | aecc86a8e81fcc5f858e0bc59cbb1ee34bcdd392 /arch | |
parent | d46164dbd936bc11c7d2abed62f05b31c7a79ae7 (diff) |
KVM: x86 emulator: implement CWD (opcode 99)
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/emulate.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 55849c3d5d8c..e257f2286866 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -2280,6 +2280,18 @@ static int em_imul_3op(struct x86_emulate_ctxt *ctxt) | |||
2280 | return em_imul(ctxt); | 2280 | return em_imul(ctxt); |
2281 | } | 2281 | } |
2282 | 2282 | ||
2283 | static int em_cwd(struct x86_emulate_ctxt *ctxt) | ||
2284 | { | ||
2285 | struct decode_cache *c = &ctxt->decode; | ||
2286 | |||
2287 | c->dst.type = OP_REG; | ||
2288 | c->dst.bytes = c->src.bytes; | ||
2289 | c->dst.addr.reg = &c->regs[VCPU_REGS_RDX]; | ||
2290 | c->dst.val = ~((c->src.val >> (c->src.bytes * 8 - 1)) - 1); | ||
2291 | |||
2292 | return X86EMUL_CONTINUE; | ||
2293 | } | ||
2294 | |||
2283 | static int em_rdtsc(struct x86_emulate_ctxt *ctxt) | 2295 | static int em_rdtsc(struct x86_emulate_ctxt *ctxt) |
2284 | { | 2296 | { |
2285 | unsigned cpl = ctxt->ops->cpl(ctxt->vcpu); | 2297 | unsigned cpl = ctxt->ops->cpl(ctxt->vcpu); |
@@ -2425,7 +2437,8 @@ static struct opcode opcode_table[256] = { | |||
2425 | /* 0x90 - 0x97 */ | 2437 | /* 0x90 - 0x97 */ |
2426 | X8(D(SrcAcc | DstReg)), | 2438 | X8(D(SrcAcc | DstReg)), |
2427 | /* 0x98 - 0x9F */ | 2439 | /* 0x98 - 0x9F */ |
2428 | D(DstAcc | SrcNone), N, D(SrcImmFAddr | No64), N, | 2440 | D(DstAcc | SrcNone), I(ImplicitOps | SrcAcc, em_cwd), |
2441 | D(SrcImmFAddr | No64), N, | ||
2429 | D(ImplicitOps | Stack), D(ImplicitOps | Stack), N, N, | 2442 | D(ImplicitOps | Stack), D(ImplicitOps | Stack), N, N, |
2430 | /* 0xA0 - 0xA7 */ | 2443 | /* 0xA0 - 0xA7 */ |
2431 | D(ByteOp | DstAcc | SrcMem | Mov | MemAbs), D(DstAcc | SrcMem | Mov | MemAbs), | 2444 | D(ByteOp | DstAcc | SrcMem | Mov | MemAbs), D(DstAcc | SrcMem | Mov | MemAbs), |