Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/bhyverun.c
Show First 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
typedef int (*vmexit_handler_t)(struct vmctx *, struct vm_exit *, int *vcpu); | typedef int (*vmexit_handler_t)(struct vmctx *, struct vm_exit *, int *vcpu); | ||||
extern int vmexit_task_switch(struct vmctx *, struct vm_exit *, int *vcpu); | extern int vmexit_task_switch(struct vmctx *, struct vm_exit *, int *vcpu); | ||||
int guest_ncpus; | int guest_ncpus; | ||||
uint16_t cores, maxcpus, sockets, threads; | uint16_t cores, maxcpus, sockets, threads; | ||||
char *kbdlayout_name; | |||||
int raw_stdio = 0; | int raw_stdio = 0; | ||||
static char *progname; | static char *progname; | ||||
static const int BSP = 0; | static const int BSP = 0; | ||||
static cpuset_t cpumask; | static cpuset_t cpumask; | ||||
static void vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip); | static void vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip); | ||||
Show All 21 Lines | |||||
static void | static void | ||||
usage(int code) | usage(int code) | ||||
{ | { | ||||
fprintf(stderr, | fprintf(stderr, | ||||
"Usage: %s [-aehuwxACDHPSWY]\n" | "Usage: %s [-aehuwxACDHPSWY]\n" | ||||
" %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n" | " %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n" | ||||
" %*s [-k <file>] [-l <lpc>] [-m mem] [-o <var>=<value>]\n" | " %*s [-k <file>] [-K layout] [-l <lpc>] [-m mem] [-o <var>=<value>]\n" | ||||
" %*s [-p vcpu:hostcpu] [-s <pci>] [-U uuid] [<vm>]\n" | " %*s [-p vcpu:hostcpu] [-s <pci>] [-U uuid] [<vm>]\n" | ||||
" -a: local apic is in xAPIC mode (deprecated)\n" | " -a: local apic is in xAPIC mode (deprecated)\n" | ||||
" -A: create ACPI tables\n" | " -A: create ACPI tables\n" | ||||
" -c: number of cpus and/or topology specification\n" | " -c: number of cpus and/or topology specification\n" | ||||
" -C: include guest memory in core file\n" | " -C: include guest memory in core file\n" | ||||
" -D: destroy on power-off\n" | " -D: destroy on power-off\n" | ||||
" -e: exit on unhandled I/O access\n" | " -e: exit on unhandled I/O access\n" | ||||
" -h: help\n" | " -h: help\n" | ||||
" -H: vmexit from the guest on hlt\n" | " -H: vmexit from the guest on hlt\n" | ||||
" -k: key=value flat config file\n" | " -k: key=value flat config file\n" | ||||
" -K: PS2 keyboard layout\n" | |||||
" -l: LPC device configuration\n" | " -l: LPC device configuration\n" | ||||
" -m: memory size in MB\n" | " -m: memory size in MB\n" | ||||
" -o: set config 'var' to 'value'\n" | " -o: set config 'var' to 'value'\n" | ||||
" -p: pin 'vcpu' to 'hostcpu'\n" | " -p: pin 'vcpu' to 'hostcpu'\n" | ||||
" -P: vmexit from the guest on pause\n" | " -P: vmexit from the guest on pause\n" | ||||
#ifdef BHYVE_SNAPSHOT | #ifdef BHYVE_SNAPSHOT | ||||
" -r: path to checkpoint file\n" | " -r: path to checkpoint file\n" | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 960 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
int c, error, err; | int c, error, err; | ||||
int max_vcpus, memflags; | int max_vcpus, memflags; | ||||
struct vmctx *ctx; | struct vmctx *ctx; | ||||
uint64_t rip; | uint64_t rip; | ||||
size_t memsize; | size_t memsize; | ||||
const char *value, *vmname; | const char *value, *vmname; | ||||
char *optstr; | char *optstr; | ||||
kbdlayout_name = NULL; | |||||
#ifdef BHYVE_SNAPSHOT | #ifdef BHYVE_SNAPSHOT | ||||
char *restore_file; | char *restore_file; | ||||
struct restore_state rstate; | struct restore_state rstate; | ||||
int vcpu; | int vcpu; | ||||
restore_file = NULL; | restore_file = NULL; | ||||
#endif | #endif | ||||
init_config(); | init_config(); | ||||
set_defaults(); | set_defaults(); | ||||
progname = basename(argv[0]); | progname = basename(argv[0]); | ||||
#ifdef BHYVE_SNAPSHOT | #ifdef BHYVE_SNAPSHOT | ||||
optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:U:r:"; | optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:K:U:r:"; | ||||
#else | #else | ||||
optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:U:"; | optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:K:U:"; | ||||
#endif | #endif | ||||
while ((c = getopt(argc, argv, optstr)) != -1) { | while ((c = getopt(argc, argv, optstr)) != -1) { | ||||
switch (c) { | switch (c) { | ||||
case 'a': | case 'a': | ||||
set_config_bool("x86.x2apic", false); | set_config_bool("x86.x2apic", false); | ||||
break; | break; | ||||
case 'A': | case 'A': | ||||
set_config_bool("acpi_tables", true); | set_config_bool("acpi_tables", true); | ||||
Show All 20 Lines | case 'G': | ||||
if (optarg[0] == 'w') { | if (optarg[0] == 'w') { | ||||
set_config_bool("gdb.wait", true); | set_config_bool("gdb.wait", true); | ||||
optarg++; | optarg++; | ||||
} | } | ||||
set_config_value("gdb.port", optarg); | set_config_value("gdb.port", optarg); | ||||
break; | break; | ||||
case 'k': | case 'k': | ||||
parse_simple_config_file(optarg); | parse_simple_config_file(optarg); | ||||
break; | |||||
case 'K': | |||||
kbdlayout_name = optarg; | |||||
break; | break; | ||||
case 'l': | case 'l': | ||||
if (strncmp(optarg, "help", strlen(optarg)) == 0) { | if (strncmp(optarg, "help", strlen(optarg)) == 0) { | ||||
lpc_print_supported_devices(); | lpc_print_supported_devices(); | ||||
exit(0); | exit(0); | ||||
} else if (lpc_device_parse(optarg) != 0) { | } else if (lpc_device_parse(optarg) != 0) { | ||||
errx(EX_USAGE, "invalid lpc device " | errx(EX_USAGE, "invalid lpc device " | ||||
"configuration '%s'", optarg); | "configuration '%s'", optarg); | ||||
▲ Show 20 Lines • Show All 306 Lines • Show Last 20 Lines |