socsvn commit: r238852 - soc2012/syuu/bhyve-bios/usr.sbin/bhyve

syuu at FreeBSD.org syuu at FreeBSD.org
Mon Jul 2 21:21:57 UTC 2012


Author: syuu
Date: Mon Jul  2 21:21:54 2012
New Revision: 238852
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238852

Log:
  register dump on vmcall handler

Modified:
  soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c

Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c
==============================================================================
--- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c	Mon Jul  2 21:07:39 2012	(r238851)
+++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c	Mon Jul  2 21:21:54 2012	(r238852)
@@ -43,6 +43,7 @@
 #include <errno.h>
 #include <signal.h>
 #include <pthread.h>
+#include <inttypes.h>
 
 #include <machine/vmm.h>
 #include <vmmapi.h>
@@ -435,8 +436,34 @@
 static int
 vmexit_vmcall(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
 {
+	int error;
+	uint64_t rsp, rip, rax, rbx, rcx, rdx;
+	uint64_t intr;
+
+	error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RSP, &rsp);
+	if (!error)
+		error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RIP, &rip);
+	if (!error)
+		error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RAX, &rax);
+	if (!error)
+		error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RBX, &rbx);
+	if (!error)
+		error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RCX, &rcx);
+	if (!error)
+		error = vm_get_register(ctx, *pvcpu, VM_REG_GUEST_RDX, &rdx);
+
+	if (error) {
+		printf("errno = %d\n", errno);
+		return (VMEXIT_ABORT);
+	}
+
 	printf("VMCALL handled\n");
-	exit(1);
+	printf("rsp=%"PRIx64" rip=%"PRIx64" rax=%"PRIx64" rbx=%"PRIx64" rcx=%"PRIx64" rdx=%"PRIx64"\n",
+		rsp, rip, rax, rbx, rcx, rdx);
+	intr = (rip - 0x401) / 0x10;
+	printf("intr=%"PRIu64"\n", intr);
+
+	return (VMEXIT_ABORT);
 
 	return (VMEXIT_RESTART);
 }


More information about the svn-soc-all mailing list