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