VirtualBox

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

Last change on this file since 5627 was 5458, checked in by vboxsync, 17 years ago

sup.h/sup.mac checks.

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