Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jun 2012 07:45:11 +0000
From:      syuu@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r237669 - soc2012/syuu/bhyve-bios/usr.sbin/bhyve
Message-ID:  <20120614074511.4696B1065670@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: syuu
Date: Thu Jun 14 07:45:10 2012
New Revision: 237669
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237669

Log:
  adding bios compatible mode

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	Thu Jun 14 06:55:40 2012	(r237668)
+++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c	Thu Jun 14 07:45:10 2012	(r237669)
@@ -99,6 +99,8 @@
 static void *oem_tbl_start;
 static int oem_tbl_size;
 
+static int bios_mode;
+
 static void vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip);
 
 struct vm_exit vmexit[VM_MAXCPU];
@@ -126,7 +128,7 @@
 {
 
         fprintf(stderr,
-                "Usage: %s [-ehBHP][-g <gdb port>][-z <hz>][-s <pci>][-p pincpu]"
+                "Usage: %s [-ehBHPb][-g <gdb port>][-z <hz>][-s <pci>][-p pincpu]"
 		"[-n <pci>][-m lowmem][-M highmem] <vm>\n"
 		"       -g: gdb port (default is %d and 0 means don't open)\n"
 		"       -c: # cpus (default 1)\n"
@@ -143,7 +145,8 @@
 		"       -m: lowmem in MB\n"
 		"       -M: highmem in MB\n"
 		"       -x: mux vcpus to 1 hcpu\n"
-		"       -t: mux vcpu timeslice hz (default %d)\n",
+		"       -t: mux vcpu timeslice hz (default %d)\n"
+		"	-b: BIOS compatible mode\n",
 		progname, DEFAULT_GDB_PORT, DEFAULT_GUEST_HZ,
 		DEFAULT_GUEST_TSLICE);
 	exit(code);
@@ -429,6 +432,15 @@
 	return (VMEXIT_CONTINUE);
 }
 
+static int
+vmexit_vmcall(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
+{
+	printf("VMCALL handled\n");
+	exit(1);
+
+	return (VMEXIT_RESTART);
+}
+
 static void
 sigalrm(int sig)
 {
@@ -469,7 +481,8 @@
 	[VM_EXITCODE_RDMSR]  = vmexit_rdmsr,
 	[VM_EXITCODE_WRMSR]  = vmexit_wrmsr,
 	[VM_EXITCODE_MTRAP]  = vmexit_mtrap,
-	[VM_EXITCODE_PAGING] = vmexit_paging
+	[VM_EXITCODE_PAGING] = vmexit_paging,
+	[VM_EXITCODE_VMCALL] = vmexit_vmcall,
 };
 
 static void
@@ -531,7 +544,7 @@
 	gdb_port = DEFAULT_GDB_PORT;
 	guest_ncpus = 1;
 
-	while ((c = getopt(argc, argv, "ehBHPxp:g:c:z:s:S:n:m:M:")) != -1) {
+	while ((c = getopt(argc, argv, "ehBHPxbp:g:c:z:s:S:n:m:M:")) != -1) {
 		switch (c) {
 		case 'B':
 			inject_bkpt = 1;
@@ -578,6 +591,9 @@
 		case 'e':
 			strictio = 1;
 			break;
+		case 'b':
+			bios_mode = 1;
+			break;
 		case 'h':
 			usage(0);			
 		default:
@@ -644,6 +660,10 @@
 		}
 	}
 
+	if (bios_mode != 0) {
+		vm_set_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST, 1);
+	}
+
 	init_inout();
 	init_pci(ctx);
 



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