summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authortychon <tychon@FreeBSD.org>2015-04-01 20:36:07 +0000
committertychon <tychon@FreeBSD.org>2015-04-01 20:36:07 +0000
commit0b17a7a51280703aa776930b14f0bec4020f5e55 (patch)
tree9204222640e3ea1a86cc911a26eea0647c55a8cc /usr.sbin
parented03b6d5102f3b90b14d8f51eaeeab10f558a170 (diff)
downloadFreeBSD-src-0b17a7a51280703aa776930b14f0bec4020f5e55.zip
FreeBSD-src-0b17a7a51280703aa776930b14f0bec4020f5e55.tar.gz
Prior to aborting due to an instruction emulation error, it is always
interesting to see what the guest's %rip and instruction bytes are. Reviewed by: grehan
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bhyve/bhyverun.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
index 97ed046..271f67c 100644
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -495,22 +495,27 @@ vmexit_mtrap(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
static int
vmexit_inst_emul(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
{
- int err;
+ int err, i;
+ struct vie *vie;
+
stats.vmexit_inst_emul++;
+ vie = &vmexit->u.inst_emul.vie;
err = emulate_mem(ctx, *pvcpu, vmexit->u.inst_emul.gpa,
- &vmexit->u.inst_emul.vie, &vmexit->u.inst_emul.paging);
+ vie, &vmexit->u.inst_emul.paging);
if (err) {
- if (err == EINVAL) {
- fprintf(stderr,
- "Failed to emulate instruction at 0x%lx\n",
- vmexit->rip);
- } else if (err == ESRCH) {
+ if (err == ESRCH) {
fprintf(stderr, "Unhandled memory access to 0x%lx\n",
vmexit->u.inst_emul.gpa);
}
+ fprintf(stderr, "Failed to emulate instruction [");
+ for (i = 0; i < vie->num_valid; i++) {
+ fprintf(stderr, "0x%02x%s", vie->inst[i],
+ i != (vie->num_valid - 1) ? " " : "");
+ }
+ fprintf(stderr, "] at 0x%lx\n", vmexit->rip);
return (VMEXIT_ABORT);
}
OpenPOWER on IntegriCloud