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