diff options
author | Wei Yongjun <yjwei@cn.fujitsu.com> | 2010-08-18 04:43:13 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-10-24 04:51:11 -0400 |
commit | e8b6fa70e3545f0afd63434dbd0c5220d47205f6 (patch) | |
tree | 5652fa297eace73170a72acc06b534afef29c039 /arch/x86/kvm/emulate.c | |
parent | 0fa6ccbd281221bc7d46aff82d846e1f4c1985df (diff) |
KVM: x86 emulator: add CBW/CWDE/CDQE instruction emulation
Add CBW/CWDE/CDQE instruction emulation.(opcode 0x98)
Used by FreeBSD's boot loader.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r-- | arch/x86/kvm/emulate.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index aab62d50752e..312dda57f93b 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -2300,7 +2300,7 @@ static struct opcode opcode_table[256] = { | |||
2300 | /* 0x90 - 0x97 */ | 2300 | /* 0x90 - 0x97 */ |
2301 | X8(D(SrcAcc | DstReg)), | 2301 | X8(D(SrcAcc | DstReg)), |
2302 | /* 0x98 - 0x9F */ | 2302 | /* 0x98 - 0x9F */ |
2303 | N, N, D(SrcImmFAddr | No64), N, | 2303 | D(DstAcc | SrcNone), N, D(SrcImmFAddr | No64), N, |
2304 | D(ImplicitOps | Stack), D(ImplicitOps | Stack), N, N, | 2304 | D(ImplicitOps | Stack), D(ImplicitOps | Stack), N, N, |
2305 | /* 0xA0 - 0xA7 */ | 2305 | /* 0xA0 - 0xA7 */ |
2306 | D(ByteOp | DstAcc | SrcMem | Mov | MemAbs), D(DstAcc | SrcMem | Mov | MemAbs), | 2306 | D(ByteOp | DstAcc | SrcMem | Mov | MemAbs), D(DstAcc | SrcMem | Mov | MemAbs), |
@@ -3003,6 +3003,13 @@ special_insn: | |||
3003 | if (c->dst.addr.reg == &c->regs[VCPU_REGS_RAX]) | 3003 | if (c->dst.addr.reg == &c->regs[VCPU_REGS_RAX]) |
3004 | break; | 3004 | break; |
3005 | goto xchg; | 3005 | goto xchg; |
3006 | case 0x98: /* cbw/cwde/cdqe */ | ||
3007 | switch (c->op_bytes) { | ||
3008 | case 2: c->dst.val = (s8)c->dst.val; break; | ||
3009 | case 4: c->dst.val = (s16)c->dst.val; break; | ||
3010 | case 8: c->dst.val = (s32)c->dst.val; break; | ||
3011 | } | ||
3012 | break; | ||
3006 | case 0x9c: /* pushf */ | 3013 | case 0x9c: /* pushf */ |
3007 | c->src.val = (unsigned long) ctxt->eflags; | 3014 | c->src.val = (unsigned long) ctxt->eflags; |
3008 | emulate_push(ctxt, ops); | 3015 | emulate_push(ctxt, ops); |