VirtualBox

source: vbox/trunk/src/VBox/VMM/testcase/Makefile.kmk@ 9224

Last change on this file since 9224 was 9193, checked in by vboxsync, 17 years ago

Missing architecture defines when generating testcase assembly

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.9 KB
Line 
1# $Id: Makefile.kmk 9193 2008-05-28 09:44:03Z 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
22DEPTH ?= ../../../..
23SUB_DEPTH = ..
24include $(KBUILD_PATH)/subheader.kmk
25
26#
27# Target lists.
28#
29PROGRAMS += tstVMStructSize tstVMStructGC tstAsmStructs tstAsmStructsGC tstVMM tstVMM-HwAccm tstGlobalConfig
30ifneq ($(KBUILD_TARGET),win)
31PROGRAMS += tstVMMFork
32endif
33ifdef 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
39endif # VBOX_WITH_TESTCASES
40
41ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
42PROGRAMS += tstPDMAsyncCompletion
43endif
44
45
46#
47# We setup two 'other' targets for executing the two structure & alignment
48# validation testcases. Perhaps a bit hackish, but extremely useful.
49#
50ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
51 ifeq ($(filter-out x86.x86 amd64.amd64 x86.amd64, $(KBUILD_TARGET_ARCH).$(KBUILD_HOST_ARCH)),)
52 OTHERS += \
53 $(PATH_TARGET)/tstAsmStructs.run \
54 $(PATH_TARGET)/tstVMStructSize.run
55 endif
56endif
57
58# The normal testing pass.
59TESTING += \
60 $(PATH_TARGET)/tstAsmStructs.run \
61 $(PATH_TARGET)/tstVMStructSize.run
62
63OTHER_CLEAN += \
64 $(PATH_TARGET)/tstAsmStructs.run \
65 $(PATH_TARGET)/tstVMStructSize.run \
66 $(PATH_TARGET)/tstAsmStructs.h \
67 $(PATH_TARGET)/tstAsmStructsAsm.o \
68 $(PATH_TARGET)/tstAsmStructsAsm.mac \
69 $(PATH_TARGET)/tstAsmStructsAsm.mac.o \
70 $(PATH_TARGET)/tstAsmStructsAsm.mac.lst \
71 $(PATH_TARGET)/tstAsmStructs.h.dump \
72 $(PATH_TARGET)/tstAsmStructsGC.h \
73 $(PATH_TARGET)/tstAsmStructsHC.h \
74 $(PATH_TARGET)/tstVMStructGC.h
75
76#
77# Globals
78#
79VBOX_PATH_VMM_SRC = $(PATH_SUB_ROOT)
80
81#
82# Targets
83#
84tstVMStructGC_TEMPLATE = VBOXGCEXE
85tstVMStructGC_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
86ifdef VBOX_WITH_IDT_PATCHING
87tstVMStructGC_DEFS += VBOX_WITH_IDT_PATCHING
88endif
89tstVMStructGC_SOURCES = tstVMStructGC.cpp
90tstVMStructGC_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM
91
92tstVMStructSize_TEMPLATE= VBOXR3TSTEXE
93tstVMStructSize_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
94ifdef VBOX_WITH_IDT_PATCHING
95tstVMStructSize_DEFS += VBOX_WITH_IDT_PATCHING
96endif
97tstVMStructSize_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM $(PATH_TARGET)
98tstVMStructSize_SOURCES = tstVMStructSize.cpp
99tstVMStructSize_LIBS.l4 = $(LIB_RUNTIME)
100tstVMStructSize.cpp_DEPS= $(PATH_TARGET)/tstVMStructGC.h
101
102tstAsmStructs_TEMPLATE = VBOXR3TSTEXE
103tstAsmStructs_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
104ifdef VBOX_WITH_IDT_PATCHING
105tstAsmStructs_DEFS += VBOX_WITH_IDT_PATCHING
106endif
107tstAsmStructs_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
108tstAsmStructs_SOURCES = tstAsmStructs.cpp
109tstAsmStructs_LIBS.l4 = $(LIB_RUNTIME)
110
111tstAsmStructsGC_TEMPLATE= VBOXGCEXE
112tstAsmStructsGC_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
113ifdef VBOX_WITH_IDT_PATCHING
114tstAsmStructsGC_DEFS += VBOX_WITH_IDT_PATCHING
115endif
116tstAsmStructsGC_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
117tstAsmStructsGC_SOURCES = tstAsmStructs.cpp
118
119tstAsmStructs.cpp_DEPS = $(PATH_TARGET)/tstAsmStructsHC.h $(PATH_TARGET)/tstAsmStructsGC.h
120
121
122tstGlobalConfig_TEMPLATE= VBOXR3TSTEXE
123tstGlobalConfig_SOURCES = tstGlobalConfig.cpp
124tstGlobalConfig_LIBS = $(LIB_RUNTIME)
125
126tstMMHyperHeap_TEMPLATE = VBOXR3TSTEXE
127tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
128tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
129
130tstSSM_TEMPLATE = VBOXR3TSTEXE
131tstSSM_SOURCES = tstSSM.cpp
132tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
133
134tstCFGM_TEMPLATE = VBOXR3TSTEXE
135tstCFGM_SOURCES = tstCFGM.cpp
136tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
137
138tstVMM_TEMPLATE = VBOXR3EXE
139tstVMM_SOURCES = tstVMM.cpp
140tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
141
142tstVMM-HwAccm_TEMPLATE = VBOXR3EXE
143tstVMM-HwAccm_SOURCES = tstVMM-HwAccm.cpp
144tstVMM-HwAccm_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
145
146tstVMMFork_TEMPLATE = VBOXR3EXE
147tstVMMFork_SOURCES = tstVMMFork.cpp
148tstVMMFork_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
149
150tstVMM-2_TEMPLATE = VBOXR3EXE
151tstVMM-2_SOURCES = tstVMM-2.cpp
152tstVMM-2_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
153
154tstVMMR0CallHost-1_TEMPLATE = VBOXR3EXE
155tstVMMR0CallHost-1_INCS = $(VBOX_PATH_VMM_SRC)
156tstVMMR0CallHost-1_SOURCES = \
157 tstVMMR0CallHost-1.cpp \
158 $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0A.asm
159tstVMMR0CallHost-1_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
160
161tstVMREQ_TEMPLATE = VBOXR3EXE
162tstVMREQ_SOURCES = tstVMREQ.cpp
163tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
164
165tstAnimate_TEMPLATE = VBOXR3EXE
166tstAnimate_SOURCES = tstAnimate.cpp
167tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
168
169tstCompiler_TEMPLATE = VBOXR3TSTEXE
170tstCompiler_SOURCES = tstCompiler.cpp
171tstCompiler_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
172
173tstMicro_TEMPLATE = VBOXR3EXE
174tstMicro_SOURCES = tstMicro.cpp
175tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
176
177# tstMicroGC.gc
178tstMicroGC_TEMPLATE = VBOXGC
179tstMicroGC_SOURCES = tstMicroGC.cpp tstMicroGCA.asm
180tstMicroGC_DEFS =
181tstMicroGC_INCS = $(VBOX_PATH_VMM_SRC)/testcase
182ifeq ($(VBOX_LDR_FMT32),pe)
183tstMicroGC_LDFLAGS = -Entry:tstMicroGC
184endif
185tstMicroGC_SYSSUFF = .gc
186tstMicroGC_LIBS = \
187 $(PATH_LIB)/DisasmGC$(VBOX_SUFF_LIB) \
188 $(PATH_LIB)/RuntimeGC$(VBOX_SUFF_LIB)
189ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
190tstMicroGC_LIBS += \
191 $(PATH_LIB)/VMMGCBuiltin$(VBOX_SUFF_LIB) \
192 $(LIB_VMMGC)
193endif
194tstMicroGC_SOURCES.win = tstMicroGC.def
195
196ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
197tstPDMAsyncCompletion_TEMPLATE = VBOXR3EXE
198tstPDMAsyncCompletion_SOURCES = tstPDMAsyncCompletion.cpp
199tstPDMAsyncCompletion_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
200endif
201
202include $(KBUILD_PATH)/subfooter.kmk
203
204
205ifndef USE_MULTI_TARGET
206# temporary hack.
207.NOTPARALLEL: $(TARGET_tstMicroGC) $(LIB_VMMGC)
208endif
209
210
211#
212# Some handcrafted support targets for tstAsmStructs.
213#
214
215ifeq ($(KBUILD_HOST),win)
216 include $(KBUILD_PATH)/tools/MINGW32.kmk
217 VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
218else
219 VBOX_NM ?= nm -p
220endif
221
222MY_ASA_ASM_STUFF = \
223 $(addprefix -D, \
224 $(DEFS) \
225 $(DEFS.$(KBUILD_TYPE)) \
226 $(DEFS.$(KBUILD_TARGET)) \
227 IN_RING3 $(ARCH_BITS_DEFS) \
228 $(DEFS.$(KBUILD_TARGET_ARCH)) \
229 $(DEFS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
230 ) \
231 -f $(if $(eq $(KBUILD_TARGET),darwin),macho,elf) \
232 $(foreach inc,$(INCS) $(VBOX_PATH_VMM_SRC)/testcase $(PATH_TARGET),-I$(inc)/)
233
234# 1a. make a header file which makes all the structures+members globals.
235$(PATH_TARGET)/tstAsmStructsAsm.mac: \
236 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
237 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed \
238 $(DEPTH)/include/iprt/asmdefs.mac \
239 $(DEPTH)/include/VBox/cpum.mac \
240 $(DEPTH)/include/VBox/sup.mac \
241 $(DEPTH)/include/VBox/vm.mac \
242 $(VBOX_PATH_VMM_SRC)/CPUMInternal.mac \
243 $(VBOX_PATH_VMM_SRC)/TRPMInternal.mac \
244 $(VBOX_PATH_VMM_SRC)/VMMInternal.mac \
245 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
246 | $(call DIRDEP,$(PATH_TARGET))
247 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
248ifndef 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]
251else
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 > $@
257endif
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)
266ifndef DONT_USE_YASM
267 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
268else
269 $(QUIET)$(TOOL_NASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
270endif
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 $@ -- $(INSTARGET_tstVMStructGC)
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.
319run-struct-tests: $(PATH_TARGET)/tstAsmStructs.run $(PATH_TARGET)/tstVMStructSize.run
320
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette