1.include <kmod.opts.mk> 2 3KMOD= vmm 4 5.if ${MACHINE_CPUARCH} == "amd64" 6SRCS+= opt_acpi.h \ 7 opt_bhyve_snapshot.h \ 8 opt_ddb.h 9.endif 10 11SRCS+= acpi_if.h bus_if.h device_if.h pci_if.h pcib_if.h vnode_if.h 12 13CFLAGS+= -DVMM_KEEP_STATS 14CFLAGS+= -I${SRCTOP}/sys/${MACHINE}/vmm 15CFLAGS+= -I${SRCTOP}/sys/${MACHINE}/vmm/io 16 17# generic vmm support 18.PATH: ${SRCTOP}/sys/${MACHINE}/vmm 19SRCS+= vmm.c \ 20 vmm_dev.c \ 21 vmm_instruction_emul.c \ 22 vmm_stat.c 23 24.if ${MACHINE_CPUARCH} == "aarch64" 25DPSRCS+= assym.inc 26 27# TODO: Add the new EL2 code 28SRCS+= vmm_arm64.c \ 29 vmm_reset.c \ 30 vmm_call.S \ 31 vmm_mmu.c \ 32 vmm_hyp_el2.S 33 34.PATH: ${SRCTOP}/sys/${MACHINE}/vmm/io 35SRCS+= vgic.c \ 36 vgic_if.h \ 37 vgic_if.c \ 38 vgic_v3.c \ 39 vtimer.c 40 41CLEANFILES+= vmm_hyp_exception.o vmm_hyp.o 42CLEANFILES+= vmm_hyp_blob.elf.full 43CLEANFILES+= vmm_hyp_blob.elf vmm_hyp_blob.bin 44 45vmm_hyp_exception.o: vmm_hyp_exception.S 46 ${CC} -c -x assembler-with-cpp -DLOCORE \ 47 ${CFLAGS:N-fsanitize*:N-fno-sanitize*:N-mbranch-protection*} \ 48 ${.IMPSRC} -o ${.TARGET} -fpie 49 50vmm_hyp.o: vmm_hyp.c 51 ${CC} -c ${CFLAGS:N-fsanitize*:N-fno-sanitize*:N-mbranch-protection*} \ 52 ${.IMPSRC} -o ${.TARGET} -fpie 53 54vmm_hyp_blob.elf.full: vmm_hyp_exception.o vmm_hyp.o 55 ${LD} -m ${LD_EMULATION} -Bdynamic -L ${SYSDIR}/conf -T ${SYSDIR}/conf/ldscript.arm64 \ 56 ${_LDFLAGS:N-zbti-report*} --no-warn-mismatch --warn-common --export-dynamic \ 57 --dynamic-linker /red/herring -X -o ${.TARGET} ${.ALLSRC} \ 58 --defsym=_start='0x0' --defsym=text_start='0x0' 59 60vmm_hyp_blob.elf: vmm_hyp_blob.elf.full 61 ${OBJCOPY} --strip-debug ${.ALLSRC} ${.TARGET} 62 63vmm_hyp_blob.bin: vmm_hyp_blob.elf 64 ${OBJCOPY} --output-target=binary ${.ALLSRC} ${.TARGET} 65 66vmm_hyp_el2.o: vmm_hyp_blob.bin 67 68.elif ${MACHINE_CPUARCH} == "amd64" 69DPSRCS+= vmx_assym.h svm_assym.h 70DPSRCS+= vmx_genassym.c svm_genassym.c offset.inc 71 72CFLAGS+= -I${SRCTOP}/sys/amd64/vmm/intel 73CFLAGS+= -I${SRCTOP}/sys/amd64/vmm/amd 74 75SRCS+= vmm_host.c \ 76 vmm_ioport.c \ 77 vmm_lapic.c \ 78 vmm_mem.c \ 79 vmm_util.c \ 80 x86.c 81 82.PATH: ${SRCTOP}/sys/${MACHINE}/vmm/io 83SRCS+= iommu.c \ 84 ppt.c \ 85 vatpic.c \ 86 vatpit.c \ 87 vhpet.c \ 88 vioapic.c \ 89 vlapic.c \ 90 vpmtmr.c \ 91 vrtc.c 92 93# intel-specific files 94.PATH: ${SRCTOP}/sys/amd64/vmm/intel 95SRCS+= ept.c \ 96 vmcs.c \ 97 vmx_msr.c \ 98 vmx_support.S \ 99 vmx.c \ 100 vtd.c 101 102# amd-specific files 103.PATH: ${SRCTOP}/sys/amd64/vmm/amd 104SRCS+= vmcb.c \ 105 amdiommu.c \ 106 ivhd_if.c \ 107 ivhd_if.h \ 108 svm.c \ 109 svm_support.S \ 110 npt.c \ 111 ivrs_drv.c \ 112 amdvi_hw.c \ 113 svm_msr.c 114 115SRCS.BHYVE_SNAPSHOT= vmm_snapshot.c 116 117CLEANFILES+= vmx_assym.h vmx_genassym.o svm_assym.h svm_genassym.o 118 119OBJS_DEPEND_GUESS.vmx_support.o+= vmx_assym.h 120OBJS_DEPEND_GUESS.svm_support.o+= svm_assym.h 121.endif 122 123vmx_assym.h: vmx_genassym.o 124 sh ${SYSDIR}/kern/genassym.sh vmx_genassym.o > ${.TARGET} 125 126svm_assym.h: svm_genassym.o 127 sh ${SYSDIR}/kern/genassym.sh svm_genassym.o > ${.TARGET} 128 129vmx_support.o: 130 ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ 131 ${.IMPSRC} -o ${.TARGET} 132 133svm_support.o: 134 ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ 135 ${.IMPSRC} -o ${.TARGET} 136 137hyp_genassym.o: offset.inc 138 ${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon ${.IMPSRC} 139 140vmx_genassym.o: offset.inc 141 ${CC} -c ${CFLAGS:N-flto*:N-fno-common:N-fsanitize*:N-fno-sanitize*} \ 142 -fcommon ${.IMPSRC} 143 144svm_genassym.o: offset.inc 145 ${CC} -c ${CFLAGS:N-flto*:N-fno-common:N-fsanitize*:N-fno-sanitize*} \ 146 -fcommon ${.IMPSRC} 147 148.include <bsd.kmod.mk> 149