Skip to content

Commit

Permalink
KVM: x86 emulator: fix INTn emulation not pushing EFLAGS and CS
Browse files Browse the repository at this point in the history
emulate_push() only schedules a push; it doesn't actually push anything.
Call writeback() to flush out the write.

Signed-off-by: Avi Kivity <avi@redhat.com>
  • Loading branch information
Avi Kivity committed Oct 24, 2010
1 parent a13a63f commit 5c56e1c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ int emulate_int_real(struct x86_emulate_ctxt *ctxt,
struct x86_emulate_ops *ops, int irq)
{
struct decode_cache *c = &ctxt->decode;
int rc = X86EMUL_CONTINUE;
int rc;
struct desc_ptr dt;
gva_t cs_addr;
gva_t eip_addr;
Expand All @@ -1242,14 +1242,25 @@ int emulate_int_real(struct x86_emulate_ctxt *ctxt,
/* TODO: Add limit checks */
c->src.val = ctxt->eflags;
emulate_push(ctxt, ops);
rc = writeback(ctxt, ops);
if (rc != X86EMUL_CONTINUE)
return rc;

ctxt->eflags &= ~(EFLG_IF | EFLG_TF | EFLG_AC);

c->src.val = ops->get_segment_selector(VCPU_SREG_CS, ctxt->vcpu);
emulate_push(ctxt, ops);
rc = writeback(ctxt, ops);
if (rc != X86EMUL_CONTINUE)
return rc;

c->src.val = c->eip;
emulate_push(ctxt, ops);
rc = writeback(ctxt, ops);
if (rc != X86EMUL_CONTINUE)
return rc;

c->dst.type = OP_NONE;

ops->get_idt(&dt, ctxt->vcpu);

Expand Down

0 comments on commit 5c56e1c

Please sign in to comment.