Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/bhyverun.c
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | |||||||||||
#include "ioapic.h" | #include "ioapic.h" | ||||||||||
#include "kernemu_dev.h" | #include "kernemu_dev.h" | ||||||||||
#include "mem.h" | #include "mem.h" | ||||||||||
#include "mevent.h" | #include "mevent.h" | ||||||||||
#include "mptbl.h" | #include "mptbl.h" | ||||||||||
#include "pci_emul.h" | #include "pci_emul.h" | ||||||||||
#include "pci_irq.h" | #include "pci_irq.h" | ||||||||||
#include "pci_lpc.h" | #include "pci_lpc.h" | ||||||||||
#include "qemu_fwcfg.h" | |||||||||||
#include "smbiostbl.h" | #include "smbiostbl.h" | ||||||||||
#ifdef BHYVE_SNAPSHOT | #ifdef BHYVE_SNAPSHOT | ||||||||||
#include "snapshot.h" | #include "snapshot.h" | ||||||||||
#endif | #endif | ||||||||||
#include "xmsr.h" | #include "xmsr.h" | ||||||||||
#include "spinup_ap.h" | #include "spinup_ap.h" | ||||||||||
#include "rtc.h" | #include "rtc.h" | ||||||||||
#include "vmgenc.h" | #include "vmgenc.h" | ||||||||||
▲ Show 20 Lines • Show All 1,114 Lines • ▼ Show 20 Lines | |||||||||||
static void | static void | ||||||||||
set_defaults(void) | set_defaults(void) | ||||||||||
{ | { | ||||||||||
set_config_bool("acpi_tables", false); | set_config_bool("acpi_tables", false); | ||||||||||
set_config_value("memory.size", "256M"); | set_config_value("memory.size", "256M"); | ||||||||||
set_config_bool("x86.strictmsr", true); | set_config_bool("x86.strictmsr", true); | ||||||||||
set_config_value("lpc.fwcfg", "bhyve"); | |||||||||||
} | } | ||||||||||
int | int | ||||||||||
main(int argc, char *argv[]) | main(int argc, char *argv[]) | ||||||||||
{ | { | ||||||||||
int c, error; | int c, error; | ||||||||||
int max_vcpus, memflags; | int max_vcpus, memflags; | ||||||||||
struct vmctx *ctx; | struct vmctx *ctx; | ||||||||||
▲ Show 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | #endif | ||||||||||
init_bootrom(ctx); | init_bootrom(ctx); | ||||||||||
atkbdc_init(ctx); | atkbdc_init(ctx); | ||||||||||
pci_irq_init(ctx); | pci_irq_init(ctx); | ||||||||||
ioapic_init(ctx); | ioapic_init(ctx); | ||||||||||
rtc_init(ctx); | rtc_init(ctx); | ||||||||||
sci_init(ctx); | sci_init(ctx); | ||||||||||
if (qemu_fwcfg_init(ctx) != 0) { | |||||||||||
fprintf(stderr, "qemu fwcfg initialization error"); | |||||||||||
exit(4); | |||||||||||
} | |||||||||||
if (qemu_fwcfg_add_file("opt/bhyve/hw.ncpu", sizeof(guest_ncpus), | |||||||||||
&guest_ncpus) != 0) { | |||||||||||
markjUnsubmitted Done Inline Actions
markj: | |||||||||||
fprintf(stderr, "Could not add qemu fwcfg opt/bhyve/hw.ncpu"); | |||||||||||
exit(4); | |||||||||||
} | |||||||||||
/* | /* | ||||||||||
* Exit if a device emulation finds an error in its initilization | * Exit if a device emulation finds an error in its initilization | ||||||||||
*/ | */ | ||||||||||
if (init_pci(ctx) != 0) { | if (init_pci(ctx) != 0) { | ||||||||||
perror("device emulation initialization error"); | perror("device emulation initialization error"); | ||||||||||
exit(4); | exit(4); | ||||||||||
} | } | ||||||||||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | #endif | ||||||||||
if (error != 0) | if (error != 0) | ||||||||||
exit(4); | exit(4); | ||||||||||
if (get_config_bool("acpi_tables")) { | if (get_config_bool("acpi_tables")) { | ||||||||||
error = acpi_build(ctx, guest_ncpus); | error = acpi_build(ctx, guest_ncpus); | ||||||||||
assert(error == 0); | assert(error == 0); | ||||||||||
} | } | ||||||||||
if (lpc_bootrom()) | if (lpc_bootrom() && strcmp(lpc_fwcfg(), "bhyve") == 0) { | ||||||||||
Done Inline Actions
markj: | |||||||||||
fwctl_init(); | fwctl_init(); | ||||||||||
} | |||||||||||
/* | /* | ||||||||||
* Change the proc title to include the VM name. | * Change the proc title to include the VM name. | ||||||||||
*/ | */ | ||||||||||
setproctitle("%s", vmname); | setproctitle("%s", vmname); | ||||||||||
#ifdef BHYVE_SNAPSHOT | #ifdef BHYVE_SNAPSHOT | ||||||||||
/* initialize mutex/cond variables */ | /* initialize mutex/cond variables */ | ||||||||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |