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