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