[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v11 3/5] x86emul: Add return code information to error messages
- print the return code of the last failed emulator operation in hvm_dump_emulation_state. - print the return code in sh_page_fault (SHADOW_PRINTK) to make the distiction between X86EMUL_UNHANDLEABLE and X86EMUL_UNIMPLEMENTED. Signed-off-by: Petre Pircalabu <ppircalabu@xxxxxxxxxxxxxxx> --- xen/arch/x86/hvm/emulate.c | 13 +++++++------ xen/arch/x86/hvm/io.c | 2 +- xen/arch/x86/hvm/vmx/realmode.c | 2 +- xen/arch/x86/mm/shadow/multi.c | 4 ++-- xen/include/asm-x86/hvm/emulate.h | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index bf12593..05b0453 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -2055,7 +2055,7 @@ int hvm_emulate_one_mmio(unsigned long mfn, unsigned long gla) { case X86EMUL_UNHANDLEABLE: case X86EMUL_UNIMPLEMENTED: - hvm_dump_emulation_state(XENLOG_G_WARNING, "MMCFG", &ctxt); + hvm_dump_emulation_state(XENLOG_G_WARNING, "MMCFG", &ctxt, rc); break; case X86EMUL_EXCEPTION: hvm_inject_event(&ctxt.ctxt.event); @@ -2114,7 +2114,7 @@ void hvm_emulate_one_vm_event(enum emul_kind kind, unsigned int trapnr, return; case X86EMUL_UNIMPLEMENTED: case X86EMUL_UNHANDLEABLE: - hvm_dump_emulation_state(XENLOG_G_DEBUG, "Mem event", &ctx); + hvm_dump_emulation_state(XENLOG_G_DEBUG, "Mem event", &ctx, rc); hvm_inject_hw_exception(trapnr, errcode); break; case X86EMUL_EXCEPTION: @@ -2242,16 +2242,17 @@ static const char *guest_x86_mode_to_str(int mode) } void hvm_dump_emulation_state(const char *loglvl, const char *prefix, - struct hvm_emulate_ctxt *hvmemul_ctxt) + struct hvm_emulate_ctxt *hvmemul_ctxt, int rc) { struct vcpu *curr = current; const char *mode_str = guest_x86_mode_to_str(hvm_guest_x86_mode(curr)); const struct segment_register *cs = hvmemul_get_seg_reg(x86_seg_cs, hvmemul_ctxt); - printk("%s%s emulation failed: %pv %s @ %04x:%08lx -> %*ph\n", - loglvl, prefix, curr, mode_str, cs->sel, hvmemul_ctxt->insn_buf_eip, - hvmemul_ctxt->insn_buf_bytes, hvmemul_ctxt->insn_buf); + printk("%s%s emulation failed (rc=%d): %pv %s @ %04x:%08lx -> %*ph\n", + loglvl, prefix, rc, curr, mode_str, cs->sel, + hvmemul_ctxt->insn_buf_eip, hvmemul_ctxt->insn_buf_bytes, + hvmemul_ctxt->insn_buf); } /* diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c index 984db21..7152c28 100644 --- a/xen/arch/x86/hvm/io.c +++ b/xen/arch/x86/hvm/io.c @@ -97,7 +97,7 @@ bool hvm_emulate_one_insn(hvm_emulate_validate_t *validate, const char *descr) { case X86EMUL_UNHANDLEABLE: case X86EMUL_UNIMPLEMENTED: - hvm_dump_emulation_state(XENLOG_G_WARNING, descr, &ctxt); + hvm_dump_emulation_state(XENLOG_G_WARNING, descr, &ctxt, rc); return false; case X86EMUL_EXCEPTION: diff --git a/xen/arch/x86/hvm/vmx/realmode.c b/xen/arch/x86/hvm/vmx/realmode.c index fdbbee2..c4815ed 100644 --- a/xen/arch/x86/hvm/vmx/realmode.c +++ b/xen/arch/x86/hvm/vmx/realmode.c @@ -138,7 +138,7 @@ void vmx_realmode_emulate_one(struct hvm_emulate_ctxt *hvmemul_ctxt) return; fail: - hvm_dump_emulation_state(XENLOG_G_ERR, "Real-mode", hvmemul_ctxt); + hvm_dump_emulation_state(XENLOG_G_ERR, "Real-mode", hvmemul_ctxt, rc); domain_crash(curr->domain); } diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c index 2557e21..28030ac 100644 --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -3498,8 +3498,8 @@ static int sh_page_fault(struct vcpu *v, v->arch.paging.last_write_emul_ok = 0; } #endif - SHADOW_PRINTK("emulator failure, unshadowing mfn %#lx\n", - mfn_x(gmfn)); + SHADOW_PRINTK("emulator failure (rc=%d), unshadowing mfn %#lx\n", + r, mfn_x(gmfn)); /* If this is actually a page table, then we have a bug, and need * to support more operations in the emulator. More likely, * though, this is a hint that this page should not be shadowed. */ diff --git a/xen/include/asm-x86/hvm/emulate.h b/xen/include/asm-x86/hvm/emulate.h index 8864775..58d17c4 100644 --- a/xen/include/asm-x86/hvm/emulate.h +++ b/xen/include/asm-x86/hvm/emulate.h @@ -92,7 +92,7 @@ int hvmemul_do_pio_buffer(uint16_t port, void *buffer); void hvm_dump_emulation_state(const char *loglvl, const char *prefix, - struct hvm_emulate_ctxt *hvmemul_ctxt); + struct hvm_emulate_ctxt *hvmemul_ctxt, int rc); #endif /* __ASM_X86_HVM_EMULATE_H__ */ -- 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |