Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 215796
b: refs/heads/master
c: 34d1f49
h: refs/heads/master
v: v3
  • Loading branch information
Avi Kivity committed Oct 24, 2010
1 parent dd8d629 commit 944769e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f6b3597bded9ed261b42fdcb5e741489cb5ccbfe
refs/heads/master: 34d1f4905eb66478a890ea808ec58bc842e6e589
20 changes: 16 additions & 4 deletions trunk/arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,12 @@ static void emulate_ts(struct x86_emulate_ctxt *ctxt, int err)
emulate_exception(ctxt, TS_VECTOR, err, true);
}

static int emulate_de(struct x86_emulate_ctxt *ctxt)
{
emulate_exception(ctxt, DE_VECTOR, 0, false);
return X86EMUL_PROPAGATE_FAULT;
}

static int do_fetch_insn_byte(struct x86_emulate_ctxt *ctxt,
struct x86_emulate_ops *ops,
unsigned long eip, u8 *dest)
Expand Down Expand Up @@ -1458,6 +1464,7 @@ static inline int emulate_grp3(struct x86_emulate_ctxt *ctxt,
struct decode_cache *c = &ctxt->decode;
unsigned long *rax = &c->regs[VCPU_REGS_RAX];
unsigned long *rdx = &c->regs[VCPU_REGS_RDX];
u8 de = 0;

switch (c->modrm_reg) {
case 0 ... 1: /* test */
Expand All @@ -1476,14 +1483,18 @@ static inline int emulate_grp3(struct x86_emulate_ctxt *ctxt,
emulate_1op_rax_rdx("imul", c->src, *rax, *rdx, ctxt->eflags);
break;
case 6: /* div */
emulate_1op_rax_rdx("div", c->src, *rax, *rdx, ctxt->eflags);
emulate_1op_rax_rdx_ex("div", c->src, *rax, *rdx,
ctxt->eflags, de);
break;
case 7: /* idiv */
emulate_1op_rax_rdx("idiv", c->src, *rax, *rdx, ctxt->eflags);
emulate_1op_rax_rdx_ex("idiv", c->src, *rax, *rdx,
ctxt->eflags, de);
break;
default:
return X86EMUL_UNHANDLEABLE;
}
if (de)
return emulate_de(ctxt);
return X86EMUL_CONTINUE;
}

Expand Down Expand Up @@ -3413,8 +3424,9 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
ctxt->eflags ^= EFLG_CF;
break;
case 0xf6 ... 0xf7: /* Grp3 */
if (emulate_grp3(ctxt, ops) != X86EMUL_CONTINUE)
goto cannot_emulate;
rc = emulate_grp3(ctxt, ops);
if (rc != X86EMUL_CONTINUE)
goto done;
break;
case 0xf8: /* clc */
ctxt->eflags &= ~EFLG_CF;
Expand Down

0 comments on commit 944769e

Please sign in to comment.