This helps distinguishing the call paths leading there.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Release-acked-by: Julien Grall <julien.grall@arm.com>
switch ( rc )
{
case X86EMUL_UNHANDLEABLE:
- hvm_dump_emulation_state(XENLOG_G_WARNING "MMCFG", &ctxt);
+ hvm_dump_emulation_state(XENLOG_G_WARNING, "MMCFG", &ctxt);
break;
case X86EMUL_EXCEPTION:
hvm_inject_event(&ctxt.ctxt.event);
*/
return;
case X86EMUL_UNHANDLEABLE:
- hvm_dump_emulation_state(XENLOG_G_DEBUG "Mem event", &ctx);
+ hvm_dump_emulation_state(XENLOG_G_DEBUG, "Mem event", &ctx);
hvm_inject_hw_exception(trapnr, errcode);
break;
case X86EMUL_EXCEPTION:
}
}
-void hvm_dump_emulation_state(const char *prefix,
+void hvm_dump_emulation_state(const char *loglvl, const char *prefix,
struct hvm_emulate_ctxt *hvmemul_ctxt)
{
struct vcpu *curr = current;
const struct segment_register *cs =
hvmemul_get_seg_reg(x86_seg_cs, hvmemul_ctxt);
- printk("%s emulation failed: %pv %s @ %04x:%08lx -> %*ph\n",
- prefix, curr, mode_str, cs->sel, hvmemul_ctxt->insn_buf_eip,
+ 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);
}
hvm_monitor_descriptor_access(exit_info, vmx_exit_qualification,
descriptor, is_write);
}
- else if ( !hvm_emulate_one_insn(is_sysdesc_access) )
+ else if ( !hvm_emulate_one_insn(is_sysdesc_access, "sysdesc access") )
domain_crash(currd);
return X86EMUL_OKAY;
gprintk(XENLOG_ERR, "Unsuccessful map-cache invalidate\n");
}
-bool hvm_emulate_one_insn(hvm_emulate_validate_t *validate)
+bool hvm_emulate_one_insn(hvm_emulate_validate_t *validate, const char *descr)
{
struct hvm_emulate_ctxt ctxt;
struct vcpu *curr = current;
switch ( rc )
{
case X86EMUL_UNHANDLEABLE:
- hvm_dump_emulation_state(XENLOG_G_WARNING "MMIO", &ctxt);
+ hvm_dump_emulation_state(XENLOG_G_WARNING, descr, &ctxt);
return false;
case X86EMUL_EXCEPTION:
if ( handle_pio(port, bytes, dir) )
__update_guest_eip(regs, vmcb->exitinfo2 - vmcb->rip);
}
- else if ( !hvm_emulate_one_insn(x86_insn_is_portio) )
+ else if ( !hvm_emulate_one_insn(x86_insn_is_portio, "port I/O") )
hvm_inject_hw_exception(TRAP_gp_fault, 0);
break;
case VMEXIT_CR0_WRITE ... VMEXIT_CR15_WRITE:
if ( cpu_has_svm_decode && (vmcb->exitinfo1 & (1ULL << 63)) )
svm_vmexit_do_cr_access(vmcb, regs);
- else if ( !hvm_emulate_one_insn(x86_insn_is_cr_access) )
+ else if ( !hvm_emulate_one_insn(x86_insn_is_cr_access, "CR access") )
hvm_inject_hw_exception(TRAP_gp_fault, 0);
break;
svm_invlpg_intercept(vmcb->exitinfo1);
__update_guest_eip(regs, vmcb->nextrip - vmcb->rip);
}
- else if ( !hvm_emulate_one_insn(is_invlpg) )
+ else if ( !hvm_emulate_one_insn(is_invlpg, "invlpg") )
hvm_inject_hw_exception(TRAP_gp_fault, 0);
break;
return;
fail:
- hvm_dump_emulation_state(XENLOG_G_ERR "Real-mode", hvmemul_ctxt);
+ hvm_dump_emulation_state(XENLOG_G_ERR, "Real-mode", hvmemul_ctxt);
domain_crash(curr->domain);
}
if ( exit_qualification & 0x10 )
{
/* INS, OUTS */
- if ( !hvm_emulate_one_insn(x86_insn_is_portio) )
+ if ( !hvm_emulate_one_insn(x86_insn_is_portio, "port I/O") )
hvm_inject_hw_exception(TRAP_gp_fault, 0);
}
else
EMUL_KIND_SET_CONTEXT_INSN
};
-bool __nonnull(1) hvm_emulate_one_insn(
- hvm_emulate_validate_t *validate);
+bool __nonnull(1, 2) hvm_emulate_one_insn(
+ hvm_emulate_validate_t *validate,
+ const char *descr);
int hvm_emulate_one(
struct hvm_emulate_ctxt *hvmemul_ctxt);
void hvm_emulate_one_vm_event(enum emul_kind kind,
static inline bool handle_mmio(void)
{
- return hvm_emulate_one_insn(x86_insn_is_mem_access);
+ return hvm_emulate_one_insn(x86_insn_is_mem_access, "MMIO");
}
int hvmemul_insn_fetch(enum x86_segment seg,
uint8_t dir,
void *buffer);
-void hvm_dump_emulation_state(const char *prefix,
+void hvm_dump_emulation_state(const char *loglvl, const char *prefix,
struct hvm_emulate_ctxt *hvmemul_ctxt);
#endif /* __ASM_X86_HVM_EMULATE_H__ */