Present the bvm console device to the guest only when explicitly requested via

the "-b" command line option.

Reviewed by:	grehan
Obtained from:	NetApp
This commit is contained in:
Neel Natu 2012-10-27 22:33:23 +00:00
parent 90415e0b4e
commit e365fca6c8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/bhyve/; revision=242192
3 changed files with 25 additions and 3 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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_ */