1 | # $Id: Makefile.kmk 5999 2007-12-07 15:05:06Z 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 (GPL) as published by the Free Software
|
---|
13 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | #
|
---|
17 |
|
---|
18 | DEPTH ?= ../../../..
|
---|
19 | SUB_DEPTH = ..
|
---|
20 | include $(PATH_KBUILD)/subheader.kmk
|
---|
21 |
|
---|
22 | #
|
---|
23 | # Target lists.
|
---|
24 | #
|
---|
25 | PROGRAMS += tstVMStructSize tstVMStructGC tstAsmStructs tstAsmStructsGC tstVMM tstVMM-HwAccm tstGlobalConfig
|
---|
26 | ifneq ($(BUILD_TARGET),win)
|
---|
27 | PROGRAMS += tstVMMFork
|
---|
28 | endif
|
---|
29 | ifdef VBOX_WITH_TESTCASES
|
---|
30 | PROGRAMS += tstCFGM tstSSM tstMMHyperHeap tstVMM-2 tstVMREQ tstMicro tstCompiler tstVMMR0CallHost-1
|
---|
31 | ifneq ($(BUILD_TARGET),l4)
|
---|
32 | PROGRAMS += tstAnimate
|
---|
33 | endif
|
---|
34 | SYSMODS += tstMicroGC
|
---|
35 | endif # VBOX_WITH_TESTCASES
|
---|
36 |
|
---|
37 | ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
|
---|
38 | PROGRAMS += tstPDMAsyncCompletion
|
---|
39 | endif
|
---|
40 |
|
---|
41 | #
|
---|
42 | # We setup two 'other' targets for executing the two structure & alignment
|
---|
43 | # validation testcases. Perhaps a bit hackish, but extremely useful.
|
---|
44 | #
|
---|
45 | ifeq ($(BUILD_TARGET),$(BUILD_PLATFORM))
|
---|
46 | ifeq ($(filter-out x86.x86 amd64.amd64 x86.amd64, $(BUILD_TARGET_ARCH).$(BUILD_PLATFORM_ARCH)),)
|
---|
47 | OTHERS += \
|
---|
48 | $(PATH_TARGET)/tstAsmStructs.run \
|
---|
49 | $(PATH_TARGET)/tstVMStructSize.run
|
---|
50 | endif
|
---|
51 | endif
|
---|
52 | OTHER_CLEAN += \
|
---|
53 | $(PATH_TARGET)/tstAsmStructs.run \
|
---|
54 | $(PATH_TARGET)/tstVMStructSize.run \
|
---|
55 | $(PATH_TARGET)/tstAsmStructs.h \
|
---|
56 | $(PATH_TARGET)/tstAsmStructsAsm.o \
|
---|
57 | $(PATH_TARGET)/tstAsmStructsAsm.mac \
|
---|
58 | $(PATH_TARGET)/tstAsmStructsAsm.mac.o \
|
---|
59 | $(PATH_TARGET)/tstAsmStructsAsm.mac.lst \
|
---|
60 | $(PATH_TARGET)/tstAsmStructs.h.dump \
|
---|
61 | $(PATH_TARGET)/tstAsmStructsGC.h \
|
---|
62 | $(PATH_TARGET)/tstAsmStructsHC.h \
|
---|
63 | $(PATH_TARGET)/tstVMStructGC.h
|
---|
64 |
|
---|
65 | #
|
---|
66 | # Globals
|
---|
67 | #
|
---|
68 | VBOX_PATH_VMM_SRC = $(PATH_SUB_ROOT)
|
---|
69 |
|
---|
70 | #
|
---|
71 | # Targets
|
---|
72 | #
|
---|
73 | tstVMStructGC_TEMPLATE = VBOXGCEXE
|
---|
74 | 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
|
---|
75 | ifdef VBOX_WITH_IDT_PATCHING
|
---|
76 | tstVMStructGC_DEFS += VBOX_WITH_IDT_PATCHING
|
---|
77 | endif
|
---|
78 | tstVMStructGC_SOURCES = tstVMStructGC.cpp
|
---|
79 | tstVMStructGC_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM
|
---|
80 |
|
---|
81 | tstVMStructSize_TEMPLATE= VBOXR3TSTEXE
|
---|
82 | 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
|
---|
83 | ifdef VBOX_WITH_IDT_PATCHING
|
---|
84 | tstVMStructSize_DEFS += VBOX_WITH_IDT_PATCHING
|
---|
85 | endif
|
---|
86 | tstVMStructSize_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM $(PATH_TARGET)
|
---|
87 | tstVMStructSize_SOURCES = tstVMStructSize.cpp
|
---|
88 | tstVMStructSize_LIBS.l4 = $(LIB_RUNTIME)
|
---|
89 | tstVMStructSize.cpp_DEPS= $(PATH_TARGET)/tstVMStructGC.h
|
---|
90 |
|
---|
91 | tstAsmStructs_TEMPLATE = VBOXR3TSTEXE
|
---|
92 | 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
|
---|
93 | ifdef VBOX_WITH_IDT_PATCHING
|
---|
94 | tstAsmStructs_DEFS += VBOX_WITH_IDT_PATCHING
|
---|
95 | endif
|
---|
96 | tstAsmStructs_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
|
---|
97 | tstAsmStructs_SOURCES = tstAsmStructs.cpp
|
---|
98 | tstAsmStructs_LIBS.l4 = $(LIB_RUNTIME)
|
---|
99 |
|
---|
100 | tstAsmStructsGC_TEMPLATE= VBOXGCEXE
|
---|
101 | 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
|
---|
102 | ifdef VBOX_WITH_IDT_PATCHING
|
---|
103 | tstAsmStructsGC_DEFS += VBOX_WITH_IDT_PATCHING
|
---|
104 | endif
|
---|
105 | tstAsmStructsGC_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
|
---|
106 | tstAsmStructsGC_SOURCES = tstAsmStructs.cpp
|
---|
107 |
|
---|
108 | tstAsmStructs.cpp_DEPS = $(PATH_TARGET)/tstAsmStructsHC.h $(PATH_TARGET)/tstAsmStructsGC.h
|
---|
109 |
|
---|
110 |
|
---|
111 | tstGlobalConfig_TEMPLATE= VBOXR3TSTEXE
|
---|
112 | tstGlobalConfig_SOURCES = tstGlobalConfig.cpp
|
---|
113 | tstGlobalConfig_LIBS = $(LIB_RUNTIME)
|
---|
114 |
|
---|
115 | tstMMHyperHeap_TEMPLATE = VBOXR3TSTEXE
|
---|
116 | tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
|
---|
117 | tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
118 |
|
---|
119 | tstSSM_TEMPLATE = VBOXR3TSTEXE
|
---|
120 | tstSSM_SOURCES = tstSSM.cpp
|
---|
121 | tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
122 |
|
---|
123 | tstCFGM_TEMPLATE = VBOXR3TSTEXE
|
---|
124 | tstCFGM_SOURCES = tstCFGM.cpp
|
---|
125 | tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
126 |
|
---|
127 | tstVMM_TEMPLATE = VBOXR3EXE
|
---|
128 | tstVMM_SOURCES = tstVMM.cpp
|
---|
129 | tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
130 |
|
---|
131 | tstVMM-HwAccm_TEMPLATE = VBOXR3EXE
|
---|
132 | tstVMM-HwAccm_SOURCES = tstVMM-HwAccm.cpp
|
---|
133 | tstVMM-HwAccm_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
134 |
|
---|
135 | tstVMMFork_TEMPLATE = VBOXR3EXE
|
---|
136 | tstVMMFork_SOURCES = tstVMMFork.cpp
|
---|
137 | tstVMMFork_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
138 |
|
---|
139 | tstVMM-2_TEMPLATE = VBOXR3EXE
|
---|
140 | tstVMM-2_SOURCES = tstVMM-2.cpp
|
---|
141 | tstVMM-2_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
142 |
|
---|
143 | tstVMMR0CallHost-1_TEMPLATE = VBOXR3EXE
|
---|
144 | tstVMMR0CallHost-1_INCS = $(VBOX_PATH_VMM_SRC)
|
---|
145 | tstVMMR0CallHost-1_SOURCES = \
|
---|
146 | tstVMMR0CallHost-1.cpp \
|
---|
147 | $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0A.asm
|
---|
148 | tstVMMR0CallHost-1_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
149 |
|
---|
150 | tstVMREQ_TEMPLATE = VBOXR3EXE
|
---|
151 | tstVMREQ_SOURCES = tstVMREQ.cpp
|
---|
152 | tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
153 |
|
---|
154 | tstAnimate_TEMPLATE = VBOXR3EXE
|
---|
155 | tstAnimate_SOURCES = tstAnimate.cpp
|
---|
156 | tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
157 |
|
---|
158 | tstCompiler_TEMPLATE = VBOXR3TSTEXE
|
---|
159 | tstCompiler_SOURCES = tstCompiler.cpp
|
---|
160 | tstCompiler_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
161 |
|
---|
162 | tstMicro_TEMPLATE = VBOXR3EXE
|
---|
163 | tstMicro_SOURCES = tstMicro.cpp
|
---|
164 | tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
165 |
|
---|
166 | # tstMicroGC.gc
|
---|
167 | tstMicroGC_TEMPLATE = VBOXGC
|
---|
168 | tstMicroGC_SOURCES = tstMicroGC.cpp tstMicroGCA.asm
|
---|
169 | tstMicroGC_DEFS =
|
---|
170 | tstMicroGC_INCS = $(VBOX_PATH_VMM_SRC)/testcase
|
---|
171 | ifeq ($(VBOX_LDR_FMT32),pe)
|
---|
172 | tstMicroGC_LDFLAGS = -Entry:tstMicroGC
|
---|
173 | endif
|
---|
174 | tstMicroGC_SYSSUFF = .gc
|
---|
175 | tstMicroGC_LIBS = \
|
---|
176 | $(PATH_LIB)/DisasmGC$(VBOX_SUFF_LIB) \
|
---|
177 | $(PATH_LIB)/RuntimeGC$(VBOX_SUFF_LIB)
|
---|
178 | ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
|
---|
179 | tstMicroGC_LIBS += \
|
---|
180 | $(PATH_LIB)/VMMGCBuiltin$(VBOX_SUFF_LIB) \
|
---|
181 | $(LIB_VMMGC)
|
---|
182 | endif
|
---|
183 | tstMicroGC_SOURCES.win = tstMicroGC.def
|
---|
184 |
|
---|
185 | ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
|
---|
186 | tstPDMAsyncCompletion_TEMPLATE = VBOXR3EXE
|
---|
187 | tstPDMAsyncCompletion_SOURCES = tstPDMAsyncCompletion.cpp
|
---|
188 | tstPDMAsyncCompletion_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
189 | endif
|
---|
190 |
|
---|
191 | include $(PATH_KBUILD)/subfooter.kmk
|
---|
192 |
|
---|
193 |
|
---|
194 | ifndef USE_MULTI_TARGET
|
---|
195 | # temporary hack.
|
---|
196 | .NOTPARALLEL: $(TARGET_tstMicroGC) $(LIB_VMMGC)
|
---|
197 | endif
|
---|
198 |
|
---|
199 |
|
---|
200 | #
|
---|
201 | # Some handcrafted support targets for tstAsmStructs.
|
---|
202 | #
|
---|
203 |
|
---|
204 | ifeq ($(BUILD_PLATFORM),win)
|
---|
205 | include $(PATH_KBUILD)/tools/MINGW32.kmk
|
---|
206 | VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
|
---|
207 | else
|
---|
208 | VBOX_NM ?= nm -p
|
---|
209 | endif
|
---|
210 |
|
---|
211 | MY_ASA_ASM_STUFF = \
|
---|
212 | $(addprefix -D, \
|
---|
213 | $(DEFS) \
|
---|
214 | $(DEFS.$(BUILD_TYPE)) \
|
---|
215 | $(DEFS.$(BUILD_TARGET)) \
|
---|
216 | IN_RING3 \
|
---|
217 | $(DEFS.$(BUILD_TARGET_ARCH)) \
|
---|
218 | $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
219 | ) \
|
---|
220 | -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
|
---|
221 | $(foreach inc,$(INCS) $(VBOX_PATH_VMM_SRC)/testcase $(PATH_TARGET),-I$(inc)/)
|
---|
222 |
|
---|
223 | # 1a. make a header file which makes all the structures+members globals.
|
---|
224 | $(PATH_TARGET)/tstAsmStructsAsm.mac: \
|
---|
225 | $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
|
---|
226 | $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed \
|
---|
227 | $(DEPTH)/include/iprt/asmdefs.mac \
|
---|
228 | $(DEPTH)/include/VBox/cpum.mac \
|
---|
229 | $(DEPTH)/include/VBox/sup.mac \
|
---|
230 | $(DEPTH)/include/VBox/vm.mac \
|
---|
231 | $(VBOX_PATH_VMM_SRC)/CPUMInternal.mac \
|
---|
232 | $(VBOX_PATH_VMM_SRC)/TRPMInternal.mac \
|
---|
233 | $(VBOX_PATH_VMM_SRC)/VMMInternal.mac \
|
---|
234 | $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
|
---|
235 | | $(call DIRDEP,$(PATH_TARGET))
|
---|
236 | $(call MSG_GENERATE,tstVMStructSize,$@,$<)
|
---|
237 | ifndef DONT_USE_YASM
|
---|
238 | $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -o [email protected] -l [email protected] $<
|
---|
239 | $(SED) -f $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed --output $@ [email protected]
|
---|
240 | else
|
---|
241 | $(QUIET)$(TOOL_NASM_AS) -g $(MY_ASA_ASM_STUFF) -o [email protected] -l [email protected] $<
|
---|
242 | $(VBOX_NM) [email protected] | $(SED) \
|
---|
243 | -e '/[0-9a-fA-F][0-9a-fA-F]* [^a] /d' \
|
---|
244 | -e 's/[0-9a-fA-F][0-9a-fA-F]* a \([^ ]*\)/global \1/' \
|
---|
245 | > $@
|
---|
246 | endif
|
---|
247 |
|
---|
248 | # 1b. make an elf/macho object containing the offsets.
|
---|
249 | $(PATH_TARGET)/tstAsmStructsAsm.o: \
|
---|
250 | $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
|
---|
251 | $(PATH_TARGET)/tstAsmStructsAsm.mac \
|
---|
252 | $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
|
---|
253 | | $(call DIRDEP,$(PATH_TARGET))
|
---|
254 | $(call MSG_COMPILE,tstAsmStructsasm,$<,$@,AS)
|
---|
255 | ifndef DONT_USE_YASM
|
---|
256 | $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
|
---|
257 | else
|
---|
258 | $(QUIET)$(TOOL_NASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
|
---|
259 | endif
|
---|
260 |
|
---|
261 | # 2. use nm and sed to transform this into the header we want.
|
---|
262 | $(PATH_TARGET)/tstAsmStructsHC.h: $(PATH_TARGET)/tstAsmStructsAsm.o
|
---|
263 | $(call MSG_GENERATE,tstVMStructSize,$@,$<)
|
---|
264 | $(QUIET)$(RM) -f $@ [email protected] [email protected]
|
---|
265 | $(QUIET)$(REDIRECT) -wo [email protected] -- $(VBOX_NM) $<
|
---|
266 | $(QUIET)$(SED) -e '/STAMPROFILEADV/d' \
|
---|
267 | -e '/00[0-9a-fA-F]* [aA] [^_.]*\./!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^.]*\)\.\(.*$$\)/ CHECK_OFF(\2, 0x0\1, \3);/' \
|
---|
268 | --output [email protected] [email protected]
|
---|
269 | $(QUIET)$(SED) -e '/VM_size$$/d' \
|
---|
270 | -e '/00[0-9a-fA-F]* [aA] [^_.]*_size$$/!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^_.]*\)_size/ CHECK_SIZE(\2, 0x0\1);/' \
|
---|
271 | --append [email protected] [email protected]
|
---|
272 | $(QUIET)$(MV) -f [email protected] $@
|
---|
273 | $(QUIET)$(RM) -f [email protected]
|
---|
274 |
|
---|
275 | # 3. transform the HC header into a GC one by omitting some HC only structures.
|
---|
276 | $(PATH_TARGET)/tstAsmStructsGC.h: $(PATH_TARGET)/tstAsmStructsHC.h
|
---|
277 | $(call MSG_GENERATE,tstVMStructSize,$@,$<)
|
---|
278 | $(QUIET)$(SED) -e '/VMMSWITCHERDEF/d' --output $@ $^
|
---|
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)$(REDIRECT) -wo $@ -- $(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 |
|
---|