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