From 52c39ee6436cddae38e6f1b5d51e71dc1fa10028 Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Wed, 15 Apr 2020 02:34:44 +0000 Subject: [PATCH] bhyve(8): Minor cosmetic niceties in instemul failure Print the failed instruction stream as a contiguous stream of hex. This is closer to something you could throw at a disassembler than 0xHH 0xHH 0xHH. Also, use the debug.h 'raw' stdio-aware printf helper to avoid the cascading line effect. --- usr.sbin/bhyve/bhyverun.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index ff1472dba548..324e40d2cda2 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include "bootrom.h" #include "inout.h" #include "dbgport.h" +#include "debug.h" #include "fwctl.h" #include "gdb.h" #include "ioapic.h" @@ -718,16 +719,14 @@ vmexit_inst_emul(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) if (err) { if (err == ESRCH) { - fprintf(stderr, "Unhandled memory access to 0x%lx\n", + EPRINTLN("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); + fprintf(stderr, "Failed to emulate instruction sequence [ "); + for (i = 0; i < vie->num_valid; i++) + fprintf(stderr, "%02x", vie->inst[i]); + FPRINTLN(stderr, " ] at 0x%lx", vmexit->rip); return (VMEXIT_ABORT); }