Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68433
b: refs/heads/master
c: 054b136
h: refs/heads/master
i:
  68431: 0c303e1
v: v3
  • Loading branch information
Avi Kivity committed Oct 13, 2007
1 parent b7d6d7f commit 3d21c5c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 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: fd2a76086527cbe074b08a8820253228cd919ece
refs/heads/master: 054b1369679fb97582fc77f25a700d4290ff3e89
1 change: 1 addition & 0 deletions trunk/drivers/kvm/kvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ enum emulation_result {

int emulate_instruction(struct kvm_vcpu *vcpu, struct kvm_run *run,
unsigned long cr2, u16 error_code);
void kvm_report_emulation_failure(struct kvm_vcpu *cvpu, const char *context);
void realmode_lgdt(struct kvm_vcpu *vcpu, u16 size, unsigned long address);
void realmode_lidt(struct kvm_vcpu *vcpu, u16 size, unsigned long address);
void realmode_lmsw(struct kvm_vcpu *vcpu, unsigned long msw,
Expand Down
16 changes: 8 additions & 8 deletions trunk/drivers/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1240,25 +1240,25 @@ int emulator_set_dr(struct x86_emulate_ctxt *ctxt, int dr, unsigned long value)
return X86EMUL_CONTINUE;
}

static void report_emulation_failure(struct x86_emulate_ctxt *ctxt)
void kvm_report_emulation_failure(struct kvm_vcpu *vcpu, const char *context)
{
static int reported;
u8 opcodes[4];
unsigned long rip = ctxt->vcpu->rip;
unsigned long rip = vcpu->rip;
unsigned long rip_linear;

rip_linear = rip + get_segment_base(ctxt->vcpu, VCPU_SREG_CS);
rip_linear = rip + get_segment_base(vcpu, VCPU_SREG_CS);

if (reported)
return;

emulator_read_std(rip_linear, (void *)opcodes, 4, ctxt->vcpu);
emulator_read_std(rip_linear, (void *)opcodes, 4, vcpu);

printk(KERN_ERR "emulation failed but !mmio_needed?"
" rip %lx %02x %02x %02x %02x\n",
rip, opcodes[0], opcodes[1], opcodes[2], opcodes[3]);
printk(KERN_ERR "emulation failed (%s) rip %lx %02x %02x %02x %02x\n",
context, rip, opcodes[0], opcodes[1], opcodes[2], opcodes[3]);
reported = 1;
}
EXPORT_SYMBOL_GPL(kvm_report_emulation_failure);

struct x86_emulate_ops emulate_ops = {
.read_std = emulator_read_std,
Expand Down Expand Up @@ -1323,7 +1323,7 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
if (kvm_mmu_unprotect_page_virt(vcpu, cr2))
return EMULATE_DONE;
if (!vcpu->mmio_needed) {
report_emulation_failure(&emulate_ctxt);
kvm_report_emulation_failure(vcpu, "mmio");
return EMULATE_FAIL;
}
return EMULATE_DO_MMIO;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ static int pf_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
++svm->vcpu.stat.mmio_exits;
return 0;
case EMULATE_FAIL:
vcpu_printf(&svm->vcpu, "%s: emulate fail\n", __FUNCTION__);
kvm_report_emulation_failure(&svm->vcpu, "pagetable");
break;
default:
BUG();
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/kvm/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,7 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
++vcpu->stat.mmio_exits;
return 0;
case EMULATE_FAIL:
vcpu_printf(vcpu, "%s: emulate fail\n", __FUNCTION__);
kvm_report_emulation_failure(vcpu, "pagetable");
break;
default:
BUG();
Expand Down

0 comments on commit 3d21c5c

Please sign in to comment.