diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -3,9 +3,6 @@ # .include -CFLAGS+=-I${.CURDIR}/../../contrib/lib9p -CFLAGS+=-I${SRCTOP}/sys -.PATH: ${SRCTOP}/sys/libkern ${SRCTOP}/sys/cam/ctl PROG= bhyve PACKAGE= bhyve @@ -14,6 +11,9 @@ BHYVE_SYSDIR?=${SRCTOP} +.PATH: ${SRCTOP}/sys/libkern \ + ${SRCTOP}/sys/cam/ctl + SRCS= \ acpi.c \ acpi_device.c \ @@ -30,7 +30,6 @@ ctl_scsi_all.c \ ctl_util.c \ e820.c \ - fwctl.c \ gdb.c \ hda_codec.c \ inout.c \ @@ -73,7 +72,6 @@ smbiostbl.c \ sockstream.c \ spinup_ap.c \ - task_switch.c \ tpm_device.c \ uart_emul.c \ usb_emul.c \ @@ -87,11 +85,16 @@ SRCS+= snapshot.c .endif -CFLAGS.kernemu_dev.c+= -I${SRCTOP}/sys/amd64 - .PATH: ${BHYVE_SYSDIR}/sys/amd64/vmm SRCS+= vmm_instruction_emul.c +.include "${MACHINE_CPUARCH}/Makefile.inc" + +CFLAGS.kernemu_dev.c+= -I${SRCTOP}/sys/amd64 + +CFLAGS+=-I${.CURDIR}/../../contrib/lib9p \ + -I${SRCTOP}/sys + LIBADD= vmmapi md nv pthread z util sbuf cam 9p .if ${MK_BHYVE_SNAPSHOT} != "no" diff --git a/usr.sbin/bhyve/amd64/Makefile.inc b/usr.sbin/bhyve/amd64/Makefile.inc new file mode 100644 --- /dev/null +++ b/usr.sbin/bhyve/amd64/Makefile.inc @@ -0,0 +1,7 @@ +.PATH: ${.CURDIR}/${MACHINE_CPUARCH} + +SRCS+= \ + fwctl.c \ + task_switch.c + +CFLAGS+= -I${.CURDIR} diff --git a/usr.sbin/bhyve/fwctl.h b/usr.sbin/bhyve/amd64/fwctl.h rename from usr.sbin/bhyve/fwctl.h rename to usr.sbin/bhyve/amd64/fwctl.h diff --git a/usr.sbin/bhyve/fwctl.c b/usr.sbin/bhyve/amd64/fwctl.c rename from usr.sbin/bhyve/fwctl.c rename to usr.sbin/bhyve/amd64/fwctl.c diff --git a/usr.sbin/bhyve/task_switch.c b/usr.sbin/bhyve/amd64/task_switch.c rename from usr.sbin/bhyve/task_switch.c rename to usr.sbin/bhyve/amd64/task_switch.c --- a/usr.sbin/bhyve/task_switch.c +++ b/usr.sbin/bhyve/amd64/task_switch.c @@ -702,6 +702,8 @@ return (VMEXIT_CONTINUE); \ } while (0) +int vmexit_task_switch(struct vmctx *, struct vcpu *, struct vm_run *); + int vmexit_task_switch(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun) { diff --git a/usr.sbin/bhyve/bhyverun.h b/usr.sbin/bhyve/bhyverun.h --- a/usr.sbin/bhyve/bhyverun.h +++ b/usr.sbin/bhyve/bhyverun.h @@ -48,6 +48,4 @@ int fbsdrun_virtio_msix(void); -int vmexit_task_switch(struct vmctx *, struct vcpu *, struct vm_run *); - #endif diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -92,7 +92,9 @@ #include "inout.h" #include "debug.h" #include "e820.h" -#include "fwctl.h" +#ifdef __amd64__ +#include "amd64/fwctl.h" +#endif #include "gdb.h" #include "ioapic.h" #include "kernemu_dev.h" @@ -924,6 +926,8 @@ return (error); } +int vmexit_task_switch(struct vmctx *, struct vcpu *, struct vm_run *); + static const vmexit_handler_t handler[VM_EXITCODE_MAX] = { [VM_EXITCODE_INOUT] = vmexit_inout, [VM_EXITCODE_INOUT_STR] = vmexit_inout, @@ -1574,9 +1578,11 @@ } free(e820_fwcfg_item); +#ifdef __amd64__ if (lpc_bootrom() && strcmp(lpc_fwcfg(), "bhyve") == 0) { fwctl_init(); } +#endif /* * Change the proc title to include the VM name. diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -81,7 +81,6 @@ #include "debug.h" #include "inout.h" #include "ipc.h" -#include "fwctl.h" #include "ioapic.h" #include "mem.h" #include "mevent.h"