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 2022 Oxide Computer Company 13 14include $(SRC)/cmd/Makefile.cmd 15include $(SRC)/cmd/Makefile.cmd.64 16include $(SRC)/test/Makefile.com 17 18PROG = rdmsr \ 19 wrmsr \ 20 imul \ 21 cpuid 22 23# These should probably go in the `vmm` tests, but since they depend on 24# in-guest payloads, it is easier to build them here. 25PROG += triple_fault \ 26 exit_paging \ 27 page_dirty 28 29# C-based payloads need additional utils object 30CPAYLOADS = cpuid 31 32PAYLOADS = $(PROG) 33include ../Makefile.in_guest 34 35COMMON_OBJS = in_guest.o common.o 36 37CLEANFILES = $(COMMON_OBJS) $(PAYLOAD_CLEANFILES) payload_utils.o 38CLOBBERFILES = $(PROG) 39 40ROOTOPTPKG = $(ROOT)/opt/bhyve-tests 41TESTDIR = $(ROOTOPTPKG)/tests/inst_emul 42 43CMDS = $(PROG:%=$(TESTDIR)/%) 44$(CMDS) := FILEMODE = 0555 45 46CSTD= $(CSTD_GNU99) 47CPPFLAGS = -I$(COMPAT)/bhyve -I$(CONTRIB)/bhyve \ 48 -I$(COMPAT)/bhyve/amd64 -I$(CONTRIB)/bhyve/amd64 \ 49 $(CPPFLAGS.master) \ 50 -I$(SRC)/uts/intel/io/vmm \ 51 -I$(SRC)/uts/intel \ 52 -I../common 53 54ASFLAGS += -P -D__STDC__ -D_ASM 55 56 57$(PROG) := LDLIBS += -lvmmapi 58 59all: $(PROG) 60 61install: all $(CMDS) 62 63clean: 64 -$(RM) $(CLEANFILES) 65clobber: clean 66 -$(RM) $(CLOBBERFILES) 67 68$(CMDS): $(TESTDIR) $(PROG) 69 70$(TESTDIR): 71 $(INS.dir) 72 73$(TESTDIR)/%: % 74 $(INS.file) 75 76%: %.c pobj_%.o $(COMMON_OBJS) 77 $(LINK.c) -o $@ $^ $(LDLIBS) 78 $(POST_PROCESS) 79 80%: %.o 81 $(LINK.c) -o $@ $^ $(LDLIBS) 82 $(POST_PROCESS) 83 84$(CPAYLOADS:%=payload_%): payload_utils.o 85