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# 13# Copyright 2026 Oxide Computer Company 14# 15 16PROGS = \ 17 bad_xregs \ 18 fpregs \ 19 fpregs_xbv \ 20 proc_xregs_set \ 21 setcontext_replace \ 22 setcontext_restore \ 23 spawn_fpu \ 24 swapcontext_extd \ 25 signal_restore \ 26 xregs_dump \ 27 xregs_roundtrip \ 28 xregs_set \ 29 xsave_baducontext \ 30 xsu_hwtype 31 32SCRIPTS = mdb_xregs proc_writes xsave_baducontext 33 34DATAFILES = \ 35 mdb_xregs.ymm.32 \ 36 mdb_xregs.ymm.64 \ 37 mdb_xregs.zmm.32 \ 38 mdb_xregs.zmm.64 \ 39 proc_writes.fpregs.ymm.32 \ 40 proc_writes.fpregs.ymm.64 \ 41 proc_writes.fpregs.zmm.32 \ 42 proc_writes.fpregs.zmm.64 \ 43 proc_writes.xregs.ymm.32 \ 44 proc_writes.xregs.ymm.64 \ 45 proc_writes.xregs.zmm.32 \ 46 proc_writes.xregs.zmm.64 47 48PROGS32 = $(PROGS:%=%.32) 49PROGS64 = $(PROGS:%=%.64) 50 51ROOTOPTDIR = $(ROOT)/opt/os-tests/tests 52ROOTOPTXSAVE = $(ROOTOPTDIR)/xsave 53ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTXSAVE)/%) \ 54 $(PROGS64:%=$(ROOTOPTXSAVE)/%) \ 55 $(SCRIPTS:%=$(ROOTOPTXSAVE)/%) 56ROOTOPTDATADIR = $(ROOTOPTXSAVE)/data 57ROOTOPTDATA = $(DATAFILES:%=$(ROOTOPTDATADIR)/%) 58 59COMMOBJS32 = xsave_util.32.o xsave_asm32.32.o 60COMMOBJS64 = xsave_util.64.o xsave_asm64.64.o 61 62OBJS32 = $(COMMOBJS32) $(PROGS:%=%.32.o) 63OBJS64 = $(COMMOBJS64) $(PROGS:%=%.64.o) 64 65# 66# To simplify things we always link in the support files to programs 67# even though in some case (e.g. xsave_baducontext) they aren't needed. 68# This also drives a requirement that everything links against libproc 69# (seen below). 70# 71EXTRA_OBJS32 = $(COMMOBJS32) 72EXTRA_OBJS64 = $(COMMOBJS64) 73 74include $(SRC)/cmd/Makefile.cmd 75 76# 77# These are required to get COMPILE.s to work as Makefile.master puts 78# some things in AS_CPPFLAGS, but not what we need to make it work. 79# 80AS_CPPFLAGS += -D_ASM 81 82$(ROOTOPTDATA) := FILEMODE = 0444 83 84LDLIBS += -lproc 85LDLIBS64 += -lproc 86 87CSTD = $(CSTD_GNU17) 88 89.KEEP_STATE: 90 91all: $(PROGS32) $(PROGS64) 92 93install: $(ROOTOPTPROGS) $(ROOTOPTDATA) 94 95clean: 96 $(RM) $(OBJS32) $(OBJS64) 97 98$(PROGS32): $(OBJS32) 99$(PROGS64): $(OBJS64) 100 101$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTXSAVE) 102$(ROOTOPTDATA): $(ROOTOPTDATADIR) 103 104$(ROOTOPTDIR): 105 $(INS.dir) 106 107$(ROOTOPTXSAVE): $(ROOTOPTDIR) 108 $(INS.dir) 109 110$(ROOTOPTDATADIR): $(ROOTOPTXSAVE) 111 $(INS.dir) 112 113$(ROOTOPTXSAVE)/%: % 114 $(INS.file) 115 116$(ROOTOPTXSAVE)/%: %.ksh 117 $(INS.rename) 118 119%.32.o: %.c 120 $(COMPILE.c) -o $@ $< 121 $(POST_PROCESS_O) 122 123%.64.o: %.c 124 $(COMPILE64.c) -o $@ $< 125 $(POST_PROCESS_O) 126 127%.32.o: %.S 128 $(COMPILE.s) -o $@ $< 129 $(POST_PROCESS_S_0) 130 131%.64.o: %.S 132 $(COMPILE64.s) -o $@ $< 133 $(POST_PROCESS_S_0) 134 135%.64: %.64.o 136 $(LINK64.c) -o $@ $< $(LDLIBS64) $(EXTRA_OBJS64) 137 $(POST_PROCESS) 138 139%.32: %.32.o 140 $(LINK.c) -o $@ $< $(LDLIBS) $(EXTRA_OBJS32) 141 $(POST_PROCESS) 142 143clobber: clean 144 $(RM) $(PROGS32) $(PROGS64) 145 146FRC: 147