1# 2# This file and its contents are supplied under the terms of the 3# Common Development and Distribution License ("CDDL"), version 1.0. 4# You may only use this file in accordance with the terms of version 5# 1.0 of the CDDL. 6# 7# A full copy of the text of the CDDL should have accompanied this 8# source. A copy of the CDDL is also available via the Internet at 9# http://www.illumos.org/license/CDDL. 10# 11 12# Copyright 2023 Oxide Computer Company 13 14include $(SRC)/cmd/Makefile.cmd 15include $(SRC)/cmd/Makefile.cmd.64 16include $(SRC)/test/Makefile.com 17 18PROG = vpmtmr_freq \ 19 vhpet_freq \ 20 vlapic_freq \ 21 vlapic_freq_periodic \ 22 vlapic_mmio_access \ 23 vlapic_msr_access \ 24 vatpit_freq 25 26# These should probably go in the `vmm` tests, but since they depend on 27# in-guest payloads, it is easier to build them here. 28PROG += guest_tsc_adjust \ 29 tsc_freq_ctrl \ 30 wrmsr_tsc \ 31 rdmsr_tsc 32 33PAYLOADS = $(PROG) 34include ../Makefile.in_guest 35 36COMMON_OBJS = in_guest.o common.o 37 38CLEANFILES = $(COMMON_OBJS) $(PAYLOAD_CLEANFILES) payload_utils.o 39CLOBBERFILES = $(PROG) 40 41ROOTOPTPKG = $(ROOT)/opt/bhyve-tests 42TESTDIR = $(ROOTOPTPKG)/tests/kdev 43 44CMDS = $(PROG:%=$(TESTDIR)/%) 45$(CMDS) := FILEMODE = 0555 46 47CSTD= $(CSTD_GNU99) 48CPPFLAGS = -I$(COMPAT)/bhyve -I$(CONTRIB)/bhyve \ 49 -I$(COMPAT)/bhyve/amd64 -I$(CONTRIB)/bhyve/amd64 \ 50 $(CPPFLAGS.master) \ 51 -I$(SRC)/uts/intel/io/vmm \ 52 -I$(SRC)/uts/intel \ 53 -I../common 54 55ASFLAGS += -D_ASM 56ASFLAGS64 += -D_ASM 57 58 59CFLAGS = -m64 60$(PROG) := LDLIBS += -lvmmapi 61 62all: $(PROG) 63 64install: all $(CMDS) 65 66clean: 67 -$(RM) $(CLEANFILES) 68clobber: clean 69 -$(RM) $(CLOBBERFILES) 70 71$(CMDS): $(TESTDIR) $(PROG) 72 73$(TESTDIR): 74 $(INS.dir) 75 76$(TESTDIR)/%: % 77 $(INS.file) 78 79%: %.c pobj_%.o $(COMMON_OBJS) 80 $(LINK.c) -o $@ $^ $(LDLIBS) 81 $(POST_PROCESS) 82 83%: %.o 84 $(LINK.c) -o $@ $^ $(LDLIBS) 85 $(POST_PROCESS) 86 87$(PAYLOADS:%=payload_%): payload_utils.o 88