1 | # $Id: Makefile.kmk 4071 2007-08-07 17:07:59Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Sub-Makefile for the VMM testcases.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2007 innotek GmbH
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | # available from http://www.virtualbox.org. This file is free software;
|
---|
11 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | # General Public License as published by the Free Software Foundation,
|
---|
13 | # in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | # distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | # be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 |
|
---|
17 | DEPTH ?= ../../../..
|
---|
18 | SUB_DEPTH = ..
|
---|
19 | include $(PATH_KBUILD)/subheader.kmk
|
---|
20 |
|
---|
21 | #
|
---|
22 | # Target lists.
|
---|
23 | #
|
---|
24 | PROGRAMS += tstVMStructSize tstVMStructGC tstAsmStructs tstAsmStructsGC tstVMM tstVMM-HwAccm
|
---|
25 | ifdef VBOX_WITH_TESTCASES
|
---|
26 | PROGRAMS += tstCFGM tstSSM tstMMHyperHeap tstVMM-2 tstVMREQ tstMicro tstCompiler tstVMMR0CallHost-1
|
---|
27 | ifneq ($(BUILD_TARGET),l4)
|
---|
28 | PROGRAMS += tstAnimate
|
---|
29 | endif
|
---|
30 | SYSMODS += tstMicroGC
|
---|
31 | endif # VBOX_WITH_TESTCASES
|
---|
32 |
|
---|
33 | #
|
---|
34 | # We setup two 'other' targets for executing the two structure & alignment
|
---|
35 | # validation testcases. Perhaps a bit hackish, but extremely useful.
|
---|
36 | #
|
---|
37 | ifeq ($(BUILD_TARGET),$(BUILD_PLATFORM))
|
---|
38 | ifeq ($(filter-out x86.x86 amd64.amd64 x86.amd64, $(BUILD_TARGET_ARCH).$(BUILD_PLATFORM_ARCH)),)
|
---|
39 | OTHERS += \
|
---|
40 | $(PATH_TARGET)/tstAsmStructs.run \
|
---|
41 | $(PATH_TARGET)/tstVMStructSize.run
|
---|
42 | endif
|
---|
43 | endif
|
---|
44 | OTHER_CLEAN += \
|
---|
45 | $(PATH_TARGET)/tstAsmStructs.run \
|
---|
46 | $(PATH_TARGET)/tstVMStructSize.run \
|
---|
47 | $(PATH_TARGET)/tstAsmStructs.h \
|
---|
48 | $(PATH_TARGET)/tstAsmStructsAsm.o \
|
---|
49 | $(PATH_TARGET)/tstAsmStructsAsm.mac \
|
---|
50 | $(PATH_TARGET)/tstAsmStructsAsm.mac.o \
|
---|
51 | $(PATH_TARGET)/tstAsmStructsAsm.mac.lst \
|
---|
52 | $(PATH_TARGET)/tstAsmStructs.h.dump \
|
---|
53 | $(PATH_TARGET)/tstAsmStructsGC.h \
|
---|
54 | $(PATH_TARGET)/tstAsmStructsHC.h \
|
---|
55 | $(PATH_TARGET)/tstVMStructGC.h
|
---|
56 |
|
---|
57 | #
|
---|
58 | # Globals
|
---|
59 | #
|
---|
60 | VBOX_PATH_VMM_SRC = $(PATH_SUB_ROOT)
|
---|
61 |
|
---|
62 | #
|
---|
63 | # Targets
|
---|
64 | #
|
---|
65 | tstVMStructGC_TEMPLATE = VBOXGCEXE
|
---|
66 | tstVMStructGC_DEFS = IN_VMM_GC IN_PDM_GC IN_CFGM_GC IN_IOM_GC IN_VM_GC IN_CPUM_GC IN_SELM_GC IN_PGM_GC IN_TRPM_GC IN_MM_GC IN_PDM_GC IN_DBGF_GC IN_PATM_GC IN_DIS_GC IN_STAM_GC IN_VGADEVICE_GC IN_CSAM_GC IN_SSM_GC IN_REM_GC IN_RRM_GC
|
---|
67 | tstVMStructGC_SOURCES = tstVMStructGC.cpp
|
---|
68 | tstVMStructGC_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM
|
---|
69 |
|
---|
70 | tstVMStructSize_TEMPLATE= VBOXR3TSTEXE
|
---|
71 | tstVMStructSize_DEFS = IN_VMM_R3 IN_PDM_R3 IN_CFGM_R3 IN_IOM_R3 IN_VM_R3 IN_CPUM_R3 IN_SELM_R3 IN_PGM_R3 IN_TRPM_R3 IN_MM_R3 IN_PDM_R3 IN_DBGF_R3 IN_PATM_R3 IN_DIS_R3 IN_STAM_R3 IN_VGADEVICE_R3 IN_CSAM_R3 IN_SSM_R3 IN_REM_R3
|
---|
72 | tstVMStructSize_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM $(PATH_TARGET)
|
---|
73 | tstVMStructSize_SOURCES = tstVMStructSize.cpp
|
---|
74 | tstVMStructSize_LIBS.l4 = $(LIB_RUNTIME)
|
---|
75 | tstVMStructSize.cpp_DEPS= $(PATH_TARGET)/tstVMStructGC.h
|
---|
76 |
|
---|
77 | tstAsmStructs_TEMPLATE = VBOXR3TSTEXE
|
---|
78 | tstAsmStructs_DEFS = IN_VMM_R3 IN_PDM_R3 IN_CFGM_R3 IN_IOM_R3 IN_VM_R3 IN_CPUM_R3 IN_SELM_R3 IN_PGM_R3 IN_TRPM_R3 IN_MM_R3 IN_PDM_R3 IN_DBGF_R3 IN_PATM_R3 IN_DIS_R3 IN_STAM_R3 IN_VGADEVICE_R3 IN_CSAM_R3 IN_SSM_R3
|
---|
79 | tstAsmStructs_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
|
---|
80 | tstAsmStructs_SOURCES = tstAsmStructs.cpp
|
---|
81 | tstAsmStructs_LIBS.l4 = $(LIB_RUNTIME)
|
---|
82 |
|
---|
83 | tstAsmStructsGC_TEMPLATE= VBOXGCEXE
|
---|
84 | tstAsmStructsGC_DEFS = IN_VMM_GC IN_PDM_GC IN_CFGM_GC IN_IOM_GC IN_VM_GC IN_CPUM_GC IN_SELM_GC IN_PGM_GC IN_TRPM_GC IN_MM_GC IN_PDM_GC IN_DBGF_GC IN_PATM_GC IN_DIS_GC IN_STAM_GC IN_VGADEVICE_GC IN_CSAM_GC IN_SSM_GC IN_RRM_GC
|
---|
85 | tstAsmStructsGC_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
|
---|
86 | tstAsmStructsGC_SOURCES = tstAsmStructs.cpp
|
---|
87 |
|
---|
88 | tstAsmStructs.cpp_DEPS = $(PATH_TARGET)/tstAsmStructsHC.h $(PATH_TARGET)/tstAsmStructsGC.h
|
---|
89 |
|
---|
90 |
|
---|
91 | tstMMHyperHeap_TEMPLATE = VBOXR3TSTEXE
|
---|
92 | tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
|
---|
93 | tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
94 |
|
---|
95 | tstSSM_TEMPLATE = VBOXR3TSTEXE
|
---|
96 | tstSSM_SOURCES = tstSSM.cpp
|
---|
97 | tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
98 |
|
---|
99 | tstCFGM_TEMPLATE = VBOXR3TSTEXE
|
---|
100 | tstCFGM_SOURCES = tstCFGM.cpp
|
---|
101 | tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
102 |
|
---|
103 | tstVMM_TEMPLATE = VBOXR3EXE
|
---|
104 | tstVMM_SOURCES = tstVMM.cpp
|
---|
105 | tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
106 |
|
---|
107 | tstVMM-HwAccm_TEMPLATE = VBOXR3EXE
|
---|
108 | tstVMM-HwAccm_SOURCES = tstVMM-HwAccm.cpp
|
---|
109 | tstVMM-HwAccm_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
110 |
|
---|
111 | tstVMM-2_TEMPLATE = VBOXR3EXE
|
---|
112 | tstVMM-2_SOURCES = tstVMM-2.cpp
|
---|
113 | tstVMM-2_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
114 |
|
---|
115 | tstVMMR0CallHost-1_TEMPLATE = VBOXR3EXE
|
---|
116 | tstVMMR0CallHost-1_INCS = $(VBOX_PATH_VMM_SRC)
|
---|
117 | tstVMMR0CallHost-1_SOURCES = \
|
---|
118 | tstVMMR0CallHost-1.cpp \
|
---|
119 | $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0A.asm
|
---|
120 | tstVMMR0CallHost-1_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
121 |
|
---|
122 | tstVMREQ_TEMPLATE = VBOXR3EXE
|
---|
123 | tstVMREQ_SOURCES = tstVMREQ.cpp
|
---|
124 | tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
125 |
|
---|
126 | tstAnimate_TEMPLATE = VBOXR3EXE
|
---|
127 | tstAnimate_SOURCES = tstAnimate.cpp
|
---|
128 | tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
129 |
|
---|
130 | tstCompiler_TEMPLATE = VBOXR3TSTEXE
|
---|
131 | tstCompiler_SOURCES = tstCompiler.cpp
|
---|
132 | tstCompiler_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
133 |
|
---|
134 | tstMicro_TEMPLATE = VBOXR3EXE
|
---|
135 | tstMicro_SOURCES = tstMicro.cpp
|
---|
136 | tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
137 |
|
---|
138 | # tstMicroGC.gc
|
---|
139 | tstMicroGC_TEMPLATE = VBOXGC
|
---|
140 | tstMicroGC_SOURCES = tstMicroGC.cpp tstMicroGCA.asm
|
---|
141 | tstMicroGC_DEFS =
|
---|
142 | tstMicroGC_INCS = $(VBOX_PATH_VMM_SRC)/testcase
|
---|
143 | ifeq ($(VBOX_LDR_FMT32),pe)
|
---|
144 | tstMicroGC_LDFLAGS = -Entry:tstMicroGC
|
---|
145 | endif
|
---|
146 | tstMicroGC_SYSSUFF = .gc
|
---|
147 | tstMicroGC_LIBS = \
|
---|
148 | $(PATH_LIB)/DisasmGC$(VBOX_SUFF_LIB) \
|
---|
149 | $(PATH_LIB)/RuntimeGC$(VBOX_SUFF_LIB)
|
---|
150 | ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
|
---|
151 | tstMicroGC_LIBS += \
|
---|
152 | $(PATH_LIB)/VMMGCBuiltin$(VBOX_SUFF_LIB) \
|
---|
153 | $(LIB_VMMGC)
|
---|
154 | endif
|
---|
155 | tstMicroGC_SOURCES.win = tstMicroGC.def
|
---|
156 |
|
---|
157 |
|
---|
158 |
|
---|
159 |
|
---|
160 | include $(PATH_KBUILD)/subfooter.kmk
|
---|
161 |
|
---|
162 |
|
---|
163 | ifndef USE_MULTI_TARGET
|
---|
164 | # temporary hack.
|
---|
165 | .NOTPARALLEL: $(TARGET_tstMicroGC) $(LIB_VMMGC)
|
---|
166 | endif
|
---|
167 |
|
---|
168 |
|
---|
169 | #
|
---|
170 | # Some handcrafted support targets for tstAsmStructs.
|
---|
171 | #
|
---|
172 |
|
---|
173 | ifeq ($(BUILD_PLATFORM),win)
|
---|
174 | include $(PATH_KBUILD)/tools/MINGW32.kmk
|
---|
175 | VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
|
---|
176 | else
|
---|
177 | VBOX_NM ?= nm -p
|
---|
178 | endif
|
---|
179 |
|
---|
180 | # 1a. make a header file which makes all the structures+members globals.
|
---|
181 | $(PATH_TARGET)/tstAsmStructsAsm.mac: \
|
---|
182 | $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
|
---|
183 | $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed \
|
---|
184 | $(DEPTH)/include/iprt/asmdefs.mac \
|
---|
185 | $(DEPTH)/include/VBox/cpum.mac \
|
---|
186 | $(DEPTH)/include/VBox/vm.mac \
|
---|
187 | $(VBOX_PATH_VMM_SRC)/CPUMInternal.mac \
|
---|
188 | $(VBOX_PATH_VMM_SRC)/TRPMInternal.mac \
|
---|
189 | $(VBOX_PATH_VMM_SRC)/VMMInternal.mac \
|
---|
190 | $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
|
---|
191 | | $(call DIRDEP,$(PATH_TARGET))
|
---|
192 | $(call MSG_GENERATE,tstVMStructSize,$@,$<)
|
---|
193 | ifndef DONT_USE_YASM
|
---|
194 | $(QUIET)$(TOOL_YASM_AS) \
|
---|
195 | $(addprefix -D, \
|
---|
196 | $(DEFS) \
|
---|
197 | $(DEFS.$(BUILD_TYPE)) \
|
---|
198 | $(DEFS.$(BUILD_TARGET)) \
|
---|
199 | IN_RING3 \
|
---|
200 | $(DEFS.$(BUILD_TARGET_ARCH)) \
|
---|
201 | $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
202 | ) \
|
---|
203 | -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
|
---|
204 | $(foreach inc,$(INCS),-I$(inc)/) -o $@.o -l $@.lst $<
|
---|
205 | $(SED) -f $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed $@.lst > $@
|
---|
206 | else
|
---|
207 | $(QUIET)$(TOOL_NASM_AS) \
|
---|
208 | -g \
|
---|
209 | $(addprefix -D, \
|
---|
210 | $(DEFS) \
|
---|
211 | $(DEFS.$(BUILD_TYPE)) \
|
---|
212 | $(DEFS.$(BUILD_TARGET)) \
|
---|
213 | IN_RING3 \
|
---|
214 | $(DEFS.$(BUILD_TARGET_ARCH)) \
|
---|
215 | $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
216 | ) \
|
---|
217 | -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
|
---|
218 | $(foreach inc,$(INCS) $(VBOX_PATH_VMM_SRC)/testcase,-I$(inc)/) -o $@.o -l $@.lst $<
|
---|
219 | $(VBOX_NM) $@.o | $(SED) \
|
---|
220 | -e '/[0-9a-fA-F][0-9a-fA-F]* [^a] /d' \
|
---|
221 | -e 's/[0-9a-fA-F][0-9a-fA-F]* a \([^ ]*\)/global \1/' \
|
---|
222 | > $@
|
---|
223 | endif
|
---|
224 |
|
---|
225 | # 1b. make an elf/macho object containing the offsets.
|
---|
226 | $(PATH_TARGET)/tstAsmStructsAsm.o: \
|
---|
227 | $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
|
---|
228 | $(PATH_TARGET)/tstAsmStructsAsm.mac \
|
---|
229 | $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
|
---|
230 | | $(call DIRDEP,$(PATH_TARGET))
|
---|
231 | $(call MSG_COMPILE,tstAsmStructsasm,$<,$@,AS)
|
---|
232 | ifndef DONT_USE_YASM
|
---|
233 | $(QUIET)$(TOOL_YASM_AS) \
|
---|
234 | $(addprefix -D, \
|
---|
235 | DO_GLOBALS \
|
---|
236 | $(DEFS) \
|
---|
237 | $(DEFS.$(BUILD_TYPE)) \
|
---|
238 | $(DEFS.$(BUILD_TARGET)) \
|
---|
239 | IN_RING3 \
|
---|
240 | $(DEFS.$(BUILD_TARGET_ARCH)) \
|
---|
241 | $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
242 | ) \
|
---|
243 | -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf -g stabs) \
|
---|
244 | $(foreach inc,$(INCS) $(PATH_TARGET),-I$(inc)/) -o $@ $<
|
---|
245 | else
|
---|
246 | $(QUIET)$(TOOL_NASM_AS) \
|
---|
247 | $(addprefix -D, \
|
---|
248 | DO_GLOBALS \
|
---|
249 | $(DEFS) \
|
---|
250 | $(DEFS.$(BUILD_TYPE)) \
|
---|
251 | $(DEFS.$(BUILD_TARGET)) \
|
---|
252 | IN_RING3 \
|
---|
253 | $(DEFS.$(BUILD_TARGET_ARCH)) \
|
---|
254 | $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
255 | ) \
|
---|
256 | -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
|
---|
257 | $(foreach inc,$(INCS) $(PATH_TARGET) $(VBOX_PATH_VMM_SRC)/testcase,-I$(inc)/) -o $@ $<
|
---|
258 | endif
|
---|
259 |
|
---|
260 | # 2. use nm and sed to transform this into the header we want.
|
---|
261 | $(PATH_TARGET)/tstAsmStructsHC.h: $(PATH_TARGET)/tstAsmStructsAsm.o
|
---|
262 | $(call MSG_GENERATE,tstVMStructSize,$@,$<)
|
---|
263 | $(QUIET)$(RM) -f $@ $@.dump $@.tmp
|
---|
264 | $(VBOX_NM) $< > $@.dump
|
---|
265 | $(QUIET)$(SED) -e '/STAMPROFILEADV/d' \
|
---|
266 | -e '/00[0-9a-fA-F]* [aA] [^_.]*\./!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^.]*\)\.\(.*$$\)/ CHECK_OFF(\2, 0x0\1, \3);/' \
|
---|
267 | $@.dump > $@.tmp
|
---|
268 | $(QUIET)$(SED) -e '/VM_size$$/d' \
|
---|
269 | -e '/00[0-9a-fA-F]* [aA] [^_.]*_size$$/!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^_.]*\)_size/ CHECK_SIZE(\2, 0x0\1);/' \
|
---|
270 | $@.dump >> $@.tmp
|
---|
271 | $(QUIET)$(MV) -f $@.tmp $@
|
---|
272 | $(QUIET)$(RM) -f $@.dump
|
---|
273 |
|
---|
274 | # 3. transform the HC header into a GC one by omitting some HC only structures.
|
---|
275 | $(PATH_TARGET)/tstAsmStructsGC.h: $(PATH_TARGET)/tstAsmStructsHC.h
|
---|
276 | $(call MSG_GENERATE,tstVMStructSize,$@,$<)
|
---|
277 | $(QUIET)$(SED) -e '/VMMSWITCHERDEF/d' \
|
---|
278 | $^ > $@
|
---|
279 |
|
---|
280 | ## @todo make this default kBuild behaviour.
|
---|
281 | .SECONDEXPANSION:
|
---|
282 |
|
---|
283 | # 4. run it.
|
---|
284 | $(PATH_TARGET)/tstAsmStructs.run: $$(INSTARGET_tstAsmStructs) $$(INSTARGET_tstAsmStructsGC)
|
---|
285 | $(QUIET)$(RM) -f $@
|
---|
286 | $(INSTARGET_tstAsmStructs)
|
---|
287 | $(INSTARGET_tstAsmStructsGC)
|
---|
288 | $(QUIET)$(APPEND) "$@" "done"
|
---|
289 |
|
---|
290 |
|
---|
291 |
|
---|
292 | #
|
---|
293 | # Run rule for tstVMStructSize.
|
---|
294 | #
|
---|
295 |
|
---|
296 | # 1. Manually dump selected structures and members.
|
---|
297 | $(PATH_TARGET)/tstVMStructGC.h: $$(INSTARGET_tstVMStructGC)
|
---|
298 | $(call MSG_GENERATE,tstVMStructSize,$@)
|
---|
299 | $(QUIET)$(INSTARGET_tstVMStructGC) > $@
|
---|
300 |
|
---|
301 | # 2. run it.
|
---|
302 | $(PATH_TARGET)/tstVMStructSize.run: $$(INSTARGET_tstVMStructSize)
|
---|
303 | $(QUIET)$(RM) -f $@
|
---|
304 | $^
|
---|
305 | $(QUIET)$(APPEND) "$@" "done"
|
---|
306 |
|
---|
307 | # alias for the two struct tests.
|
---|
308 | run-struct-tests: $(PATH_TARGET)/tstAsmStructs.run $(PATH_TARGET)/tstVMStructSize.run
|
---|
309 |
|
---|