diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 7f67c5bf0489..02a1f67d66eb 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -29,6 +29,7 @@ SRCS= \ crc16.c \ ctl_util.c \ ctl_scsi_all.c \ + e820.c \ fwctl.c \ gdb.c \ hda_codec.c \ diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index d447a9ee60e4..627a86d71e0e 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -91,6 +91,7 @@ __FBSDID("$FreeBSD$"); #include "config.h" #include "inout.h" #include "debug.h" +#include "e820.h" #include "fwctl.h" #include "gdb.h" #include "ioapic.h" @@ -1242,6 +1243,7 @@ main(int argc, char *argv[]) int max_vcpus, memflags; struct vcpu *bsp; struct vmctx *ctx; + struct qemu_fwcfg_item *e820_fwcfg_item; uint64_t rip; size_t memsize; const char *optstr, *value, *vmname; @@ -1486,6 +1488,11 @@ main(int argc, char *argv[]) exit(4); } + if (e820_init(ctx) != 0) { + fprintf(stderr, "Unable to setup E820"); + exit(4); + } + /* * Exit if a device emulation finds an error in its initilization */ @@ -1576,6 +1583,18 @@ main(int argc, char *argv[]) assert(error == 0); } + e820_fwcfg_item = e820_get_fwcfg_item(); + if (e820_fwcfg_item == NULL) { + fprintf(stderr, "invalid e820 table"); + exit(4); + } + if (qemu_fwcfg_add_file("etc/e820", e820_fwcfg_item->size, + e820_fwcfg_item->data) != 0) { + fprintf(stderr, "could not add qemu fwcfg etc/e820"); + exit(4); + } + free(e820_fwcfg_item); + if (lpc_bootrom() && strcmp(lpc_fwcfg(), "bhyve") == 0) { fwctl_init(); }