VirtualBox

source: vbox/trunk/src/VBox/VMM/testcase/Makefile@ 1831

Last change on this file since 1831 was 1528, checked in by vboxsync, 18 years ago

alignment

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.4 KB
Line 
1#
2# Makefile for the VMM testcases.
3#
4
5#
6# Copyright (C) 2006 InnoTek Systemberatung GmbH
7#
8# This file is part of VirtualBox Open Source Edition (OSE), as
9# available from http://www.virtualbox.org. This file is free software;
10# you can redistribute it and/or modify it under the terms of the GNU
11# General Public License as published by the Free Software Foundation,
12# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13# distribution. VirtualBox OSE is distributed in the hope that it will
14# be useful, but WITHOUT ANY WARRANTY of any kind.
15#
16# If you received this file as part of a commercial VirtualBox
17# distribution, then only the terms of your commercial VirtualBox
18# license agreement apply instead of the previous paragraph.
19#
20
21DEPTH = ../../../..
22include $(PATH_KBUILD)/header.kmk
23
24#
25# Target lists.
26#
27PROGRAMS = tstVMStructSize tstVMStructGC tstAsmStructs tstAsmStructsGC tstVMM tstVMM-HwAccm
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
57#
58# Globals.
59#
60TEMPLATE = VBOXR3TSTEXE
61
62#
63# Targets
64#
65tstVMStructGC_TEMPLATE = VBOXGCEXE
66tstVMStructGC_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
67tstVMStructGC_SOURCES = tstVMStructGC.cpp
68tstVMStructGC_INCS = .. ../PATM
69
70tstVMStructSize_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
71tstVMStructSize_INCS = .. ../PATM $(PATH_TARGET)
72tstVMStructSize_SOURCES = tstVMStructSize.cpp
73tstVMStructSize_LIBS.l4 = $(LIB_RUNTIME)
74tstVMStructSize.cpp_DEPS= $(PATH_TARGET)/tstVMStructGC.h
75
76tstAsmStructs_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
77tstAsmStructs_INCS = .. $(PATH_TARGET)
78tstAsmStructs_SOURCES = tstAsmStructs.cpp
79tstAsmStructs_LIBS.l4 = $(LIB_RUNTIME)
80
81tstAsmStructsGC_TEMPLATE= VBOXGCEXE
82tstAsmStructsGC_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
83tstAsmStructsGC_INCS = .. $(PATH_TARGET)
84tstAsmStructsGC_SOURCES = tstAsmStructs.cpp
85
86tstAsmStructs.cpp_DEPS = $(PATH_TARGET)/tstAsmStructsHC.h $(PATH_TARGET)/tstAsmStructsGC.h
87
88
89tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
90tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
91
92tstSSM_SOURCES = tstSSM.cpp
93tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
94
95tstCFGM_SOURCES = tstCFGM.cpp
96tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
97
98tstVMM_SOURCES = tstVMM.cpp
99tstVMM_TEMPLATE = VBOXR3EXE
100tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
101
102tstVMM-HwAccm_SOURCES = tstVMM-HwAccm.cpp
103tstVMM-HwAccm_TEMPLATE = VBOXR3EXE
104tstVMM-HwAccm_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
105
106tstVMM-2_SOURCES = tstVMM-2.cpp
107tstVMM-2_TEMPLATE = VBOXR3EXE
108tstVMM-2_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
109
110tstVMMR0CallHost-1_TEMPLATE = VBOXR3EXE
111tstVMMR0CallHost-1_INCS = ..
112tstVMMR0CallHost-1_SOURCES = \
113 tstVMMR0CallHost-1.cpp \
114 ../VMMR0/VMMR0A.asm
115tstVMMR0CallHost-1_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
116
117tstVMREQ_SOURCES = tstVMREQ.cpp
118tstVMREQ_TEMPLATE = VBOXR3EXE
119tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
120
121tstAnimate_SOURCES = tstAnimate.cpp
122tstAnimate_TEMPLATE = VBOXR3EXE
123tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
124
125tstCompiler_SOURCES = tstCompiler.cpp
126tstCompiler_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
127
128tstMicro_SOURCES = tstMicro.cpp
129tstMicro_TEMPLATE = VBOXR3EXE
130tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
131
132# tstMicroGC.gc
133tstMicroGC_TEMPLATE = VBOXGC
134tstMicroGC_SOURCES = tstMicroGC.cpp tstMicroGCA.asm
135tstMicroGC_DEFS =
136ifeq ($(VBOX_LDR_FMT32),pe)
137tstMicroGC_LDFLAGS = -Entry:tstMicroGC
138endif
139tstMicroGC_SYSSUFF = .gc
140tstMicroGC_LIBS = \
141 $(PATH_LIB)/DisasmGC$(VBOX_SUFF_LIB) \
142 $(PATH_LIB)/RuntimeGC$(VBOX_SUFF_LIB)
143ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
144tstMicroGC_LIBS += \
145 $(PATH_LIB)/VMMGCBuiltin$(VBOX_SUFF_LIB) \
146 $(LIB_VMMGC)
147endif
148tstMicroGC_SOURCES.win = tstMicroGC.def
149
150
151include $(PATH_KBUILD)/footer.kmk
152
153
154#
155# Some handcrafted support for tstAsmStructs.
156#
157
158# 1a. make a header file which makes all the structures+members globals.
159$(PATH_TARGET)/tstAsmStructsAsm.mac: tstAsmStructsAsm.asm tstAsmStructsAsm-lst.sed \
160 $(DEPTH)/include/iprt/asmdefs.mac \
161 $(DEPTH)/include/VBox/cpum.mac \
162 $(DEPTH)/include/VBox/vm.mac \
163 ../CPUMInternal.mac \
164 ../TRPMInternal.mac \
165 ../VMMInternal.mac \
166 Makefile \
167 | $(call DIRDEP,$(PATH_TARGET))
168 $(call MSG_L1,Compiling $<)
169ifndef DONT_USE_YASM
170 $(QUIET)$(TOOL_YASM_AS) \
171 $(addprefix -D, \
172 $(DEFS) \
173 $(DEFS.$(BUILD_TYPE)) \
174 $(DEFS.$(BUILD_TARGET)) \
175 IN_RING3 \
176 $(DEFS.$(BUILD_TARGET_ARCH)) \
177 $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
178 ) \
179 -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
180 $(foreach inc,$(INCS),-I$(inc)/) -o $@.o -l $@.lst $<
181else
182 $(QUIET)$(TOOL_NASM_AS) \
183 $(addprefix -D, \
184 $(DEFS) \
185 $(DEFS.$(BUILD_TYPE)) \
186 $(DEFS.$(BUILD_TARGET)) \
187 IN_RING3 \
188 $(DEFS.$(BUILD_TARGET_ARCH)) \
189 $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
190 ) \
191 -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
192 $(foreach inc,$(INCS),-I$(inc)/) -o $@.o -l $@.lst $<
193endif
194 $(SED) -f tstAsmStructsAsm-lst.sed $@.lst > $@
195
196
197
198# 1b. make an elf/macho object containing the offsets.
199$(PATH_TARGET)/tstAsmStructsAsm.o: tstAsmStructsAsm.asm $(PATH_TARGET)/tstAsmStructsAsm.mac \
200 Makefile \
201 | $(call DIRDEP,$(PATH_TARGET))
202 $(call MSG_L1,Compiling $<)
203ifndef DONT_USE_YASM
204 $(QUIET)$(TOOL_YASM_AS) \
205 $(addprefix -D, \
206 DO_GLOBALS \
207 $(DEFS) \
208 $(DEFS.$(BUILD_TYPE)) \
209 $(DEFS.$(BUILD_TARGET)) \
210 IN_RING3 \
211 $(DEFS.$(BUILD_TARGET_ARCH)) \
212 $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
213 ) \
214 -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf -g stabs) \
215 $(foreach inc,$(INCS) $(PATH_TARGET),-I$(inc)/) -o $@ $<
216else
217 $(QUIET)$(TOOL_NASM_AS) \
218 $(addprefix -D, \
219 DO_GLOBALS \
220 $(DEFS) \
221 $(DEFS.$(BUILD_TYPE)) \
222 $(DEFS.$(BUILD_TARGET)) \
223 IN_RING3 \
224 $(DEFS.$(BUILD_TARGET_ARCH)) \
225 $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
226 ) \
227 -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
228 $(foreach inc,$(INCS) $(PATH_TARGET),-I$(inc)/) -o $@ $<
229endif
230
231# 2. use nm and sed to transform this into the header we want.
232ifeq ($(BUILD_PLATFORM),win)
233 include $(PATH_KBUILD)/tools/MINGW32.kmk
234 VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
235else
236 VBOX_NM ?= nm -p
237endif
238$(PATH_TARGET)/tstAsmStructsHC.h: $(PATH_TARGET)/tstAsmStructsAsm.o
239 $(call MSG_L1,Generating $@)
240 $(QUIET)$(RM) -f $@ $@.dump $@.tmp
241 $(VBOX_NM) $< > $@.dump
242 $(QUIET)$(SED) -e '/STAMPROFILEADV/d' \
243 -e '/00[0-9a-fA-F]* [aA] [^_.]*\./!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^.]*\)\.\(.*$$\)/ CHECK_OFF(\2, 0x0\1, \3);/' \
244 $@.dump > $@.tmp
245 $(QUIET)$(SED) -e '/VM_size$$/d' \
246 -e '/00[0-9a-fA-F]* [aA] [^_.]*_size$$/!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^_.]*\)_size/ CHECK_SIZE(\2, 0x0\1);/' \
247 $@.dump >> $@.tmp
248 $(QUIET)$(MV) -f $@.tmp $@
249 $(QUIET)$(RM) -f $@.dump
250
251# 3. transform the HC header into a GC one by omitting some HC only structures.
252$(PATH_TARGET)/tstAsmStructsGC.h: $(PATH_TARGET)/tstAsmStructsHC.h
253 $(call MSG_L1,Generating $@)
254 $(QUIET)$(SED) -e '/VMMSWITCHERDEF/d' \
255 $^ > $@
256
257# 4. run it.
258$(PATH_TARGET)/tstAsmStructs.run: $(INSTARGET_tstAsmStructs) $(INSTARGET_tstAsmStructsGC)
259 $(QUIET)$(RM) -f $@
260 $(INSTARGET_tstAsmStructs)
261 $(INSTARGET_tstAsmStructsGC)
262 $(QUIET)$(APPEND) "$@" "done"
263
264#
265# Run rule for tstVMStructSize.
266#
267
268# 1. Dump selected structure in the VMMGC.gc debug info.
269# 2. Generate a testcase from the dump
270## future
271
272# 1&2. Manually dump selected structures and members.
273$(PATH_TARGET)/tstVMStructGC.h: $(INSTARGET_tstVMStructGC)
274 $(call MSG_L1,Generating $<)
275 $(QUIET)$(INSTARGET_tstVMStructGC) > $@
276
277# 3. run it.
278$(PATH_TARGET)/tstVMStructSize.run: $(INSTARGET_tstVMStructSize)
279 $(QUIET)$(RM) -f $@
280 $^
281 $(QUIET)$(APPEND) "$@" "done"
282
283# alias for the two struct tests.
284run-struct-tests: $(PATH_TARGET)/tstAsmStructs.run $(PATH_TARGET)/tstVMStructSize.run
285
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