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