Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 215906
b: refs/heads/master
c: 6399565
h: refs/heads/master
v: v3
  • Loading branch information
Mohammed Gamal authored and Avi Kivity committed Oct 24, 2010
1 parent c39235c commit 02f92b2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4ab8e02404fcbc16beefac66de24dbb2706fe2f3
refs/heads/master: 63995653ade16deacaea5b49ceaf6376314593ac
29 changes: 29 additions & 0 deletions trunk/arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -4188,6 +4188,35 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu)
memcpy(c->regs, vcpu->arch.regs, sizeof c->regs);
}

int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq)
{
struct decode_cache *c = &vcpu->arch.emulate_ctxt.decode;
int ret;

init_emulate_ctxt(vcpu);

vcpu->arch.emulate_ctxt.decode.op_bytes = 2;
vcpu->arch.emulate_ctxt.decode.ad_bytes = 2;
vcpu->arch.emulate_ctxt.decode.eip = vcpu->arch.emulate_ctxt.eip;
ret = emulate_int_real(&vcpu->arch.emulate_ctxt, &emulate_ops, irq);

if (ret != X86EMUL_CONTINUE)
return EMULATE_FAIL;

vcpu->arch.emulate_ctxt.eip = c->eip;
memcpy(vcpu->arch.regs, c->regs, sizeof c->regs);
kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.eip);
kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags);

if (irq == NMI_VECTOR)
vcpu->arch.nmi_pending = false;
else
vcpu->arch.interrupt.pending = false;

return EMULATE_DONE;
}
EXPORT_SYMBOL_GPL(kvm_inject_realmode_interrupt);

static int handle_emulation_failure(struct kvm_vcpu *vcpu)
{
++vcpu->stat.insn_emulation_fail;
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/x86/kvm/x86.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static inline int is_paging(struct kvm_vcpu *vcpu)

void kvm_before_handle_nmi(struct kvm_vcpu *vcpu);
void kvm_after_handle_nmi(struct kvm_vcpu *vcpu);
int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq);

void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data);

Expand Down

0 comments on commit 02f92b2

Please sign in to comment.