svn commit: r242192 - projects/bhyve/usr.sbin/bhyve

Neel Natu neel at FreeBSD.org
Sat Oct 27 22:33:24 UTC 2012


Author: neel
Date: Sat Oct 27 22:33:23 2012
New Revision: 242192
URL: http://svn.freebsd.org/changeset/base/242192

Log:
  Present the bvm console device to the guest only when explicitly requested via
  the "-b" command line option.
  
  Reviewed by:	grehan
  Obtained from:	NetApp

Modified:
  projects/bhyve/usr.sbin/bhyve/consport.c
  projects/bhyve/usr.sbin/bhyve/fbsdrun.c
  projects/bhyve/usr.sbin/bhyve/inout.h

Modified: projects/bhyve/usr.sbin/bhyve/consport.c
==============================================================================
--- projects/bhyve/usr.sbin/bhyve/consport.c	Sat Oct 27 22:13:42 2012	(r242191)
+++ projects/bhyve/usr.sbin/bhyve/consport.c	Sat Oct 27 22:33:23 2012	(r242192)
@@ -124,4 +124,17 @@ console_handler(struct vmctx *ctx, int v
 
 	return (0);
 }
-INOUT_PORT(console, BVM_CONSOLE_PORT, IOPORT_F_INOUT, console_handler);
+
+static struct inout_port consport = {
+	"bvmcons",
+	BVM_CONSOLE_PORT,
+	IOPORT_F_INOUT,
+	console_handler
+};
+
+void
+init_bvmcons(void)
+{
+
+	register_inout(&consport);
+}

Modified: projects/bhyve/usr.sbin/bhyve/fbsdrun.c
==============================================================================
--- projects/bhyve/usr.sbin/bhyve/fbsdrun.c	Sat Oct 27 22:13:42 2012	(r242191)
+++ projects/bhyve/usr.sbin/bhyve/fbsdrun.c	Sat Oct 27 22:33:23 2012	(r242192)
@@ -563,21 +563,25 @@ vm_loop(struct vmctx *ctx, int vcpu, uin
 int
 main(int argc, char *argv[])
 {
-	int c, error, gdb_port, inject_bkpt, tmp, err, ioapic;
+	int c, error, gdb_port, inject_bkpt, tmp, err, ioapic, bvmcons;
 	struct vmctx *ctx;
 	uint64_t rip;
 
+	bvmcons = 0;
 	inject_bkpt = 0;
 	progname = basename(argv[0]);
 	gdb_port = DEFAULT_GDB_PORT;
 	guest_ncpus = 1;
 	ioapic = 0;
 
-	while ((c = getopt(argc, argv, "aehBHIPxp:g:c:z:s:S:n:m:M:")) != -1) {
+	while ((c = getopt(argc, argv, "abehBHIPxp:g:c:z:s:S:n:m:M:")) != -1) {
 		switch (c) {
 		case 'a':
 			disable_x2apic = 1;
 			break;
+		case 'b':
+			bvmcons = 1;
+			break;
 		case 'B':
 			inject_bkpt = 1;
 			break;
@@ -707,6 +711,9 @@ main(int argc, char *argv[])
 	if (gdb_port != 0)
 		init_dbgport(gdb_port);
 
+	if (bvmcons)
+		init_bvmcons();
+
 	error = vm_get_register(ctx, BSP, VM_REG_GUEST_RIP, &rip);
 	assert(error == 0);
 

Modified: projects/bhyve/usr.sbin/bhyve/inout.h
==============================================================================
--- projects/bhyve/usr.sbin/bhyve/inout.h	Sat Oct 27 22:13:42 2012	(r242191)
+++ projects/bhyve/usr.sbin/bhyve/inout.h	Sat Oct 27 22:33:23 2012	(r242192)
@@ -62,4 +62,6 @@ int	emulate_inout(struct vmctx *, int vc
 		      uint32_t *eax, int strict);
 int	register_inout(struct inout_port *iop);
 
+void	init_bvmcons(void);
+
 #endif	/* _INOUT_H_ */


More information about the svn-src-projects mailing list