Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Apr 2015 20:36:07 +0000 (UTC)
From:      Tycho Nightingale <tychon@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r280968 - head/usr.sbin/bhyve
Message-ID:  <201504012036.t31Ka7p8089916@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tychon
Date: Wed Apr  1 20:36:07 2015
New Revision: 280968
URL: https://svnweb.freebsd.org/changeset/base/280968

Log:
  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

Modified:
  head/usr.sbin/bhyve/bhyverun.c

Modified: head/usr.sbin/bhyve/bhyverun.c
==============================================================================
--- head/usr.sbin/bhyve/bhyverun.c	Wed Apr  1 20:14:00 2015	(r280967)
+++ head/usr.sbin/bhyve/bhyverun.c	Wed Apr  1 20:36:07 2015	(r280968)
@@ -495,22 +495,27 @@ vmexit_mtrap(struct vmctx *ctx, struct v
 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);
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504012036.t31Ka7p8089916>