diff options
author | neel <neel@FreeBSD.org> | 2012-10-27 22:33:23 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2012-10-27 22:33:23 +0000 |
commit | 86d868af7f0eb18ca829186c66cecc7117189f41 (patch) | |
tree | 208d8099a474084b1b4c9e95639dce6db60149f4 | |
parent | bd0ca87b04ee4089d4f0c5b34c5791f80c353d21 (diff) | |
download | FreeBSD-src-86d868af7f0eb18ca829186c66cecc7117189f41.zip FreeBSD-src-86d868af7f0eb18ca829186c66cecc7117189f41.tar.gz |
Present the bvm console device to the guest only when explicitly requested via
the "-b" command line option.
Reviewed by: grehan
Obtained from: NetApp
-rw-r--r-- | usr.sbin/bhyve/consport.c | 15 | ||||
-rw-r--r-- | usr.sbin/bhyve/fbsdrun.c | 11 | ||||
-rw-r--r-- | usr.sbin/bhyve/inout.h | 2 |
3 files changed, 25 insertions, 3 deletions
diff --git a/usr.sbin/bhyve/consport.c b/usr.sbin/bhyve/consport.c index 8e2156a..3915b6d 100644 --- a/usr.sbin/bhyve/consport.c +++ b/usr.sbin/bhyve/consport.c @@ -124,4 +124,17 @@ console_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, 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); +} diff --git a/usr.sbin/bhyve/fbsdrun.c b/usr.sbin/bhyve/fbsdrun.c index 9905f19..9d604ce 100644 --- a/usr.sbin/bhyve/fbsdrun.c +++ b/usr.sbin/bhyve/fbsdrun.c @@ -563,21 +563,25 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip) 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); diff --git a/usr.sbin/bhyve/inout.h b/usr.sbin/bhyve/inout.h index f6a8db2..a73b78d 100644 --- a/usr.sbin/bhyve/inout.h +++ b/usr.sbin/bhyve/inout.h @@ -62,4 +62,6 @@ int emulate_inout(struct vmctx *, int vcpu, int in, int port, int bytes, uint32_t *eax, int strict); int register_inout(struct inout_port *iop); +void init_bvmcons(void); + #endif /* _INOUT_H_ */ |