VirtualBox

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

Last change on this file since 1129 was 167, checked in by vboxsync, 18 years ago

enabled the structure tests on 64-bit too.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.6 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
23include $(PATH_KBUILD)/tools/MINGW32.kmk
24
25#
26# Target lists.
27#
28#LIBRARIES = tstHelp
29PROGRAMS = tstVMStructSize tstVMStructGC
30ifneq ($(BUILD_TARGET),darwin)
31PROGRAMS += tstAsmStructs tstAsmStructsGC
32endif
33PROGRAMS += tstVMM
34ifdef VBOX_WITH_TESTCASES
35PROGRAMS += tstCFGM tstSSM tstMMHyperHeap tstVMM-2 tstVMREQ tstMicro tstCompiler tstVMMR0CallHost-1
36ifneq ($(BUILD_TARGET),l4)
37PROGRAMS += tstAnimate
38endif
39#PROGRAMS += tstProg1 tstProg2 tstProg3
40SYSMODS = tstMicroGC
41endif # VBOX_WITH_TESTCASES
42
43#
44# We setup two 'other' targets for executing the two structure & alignment
45# validation testcases. Perhaps a bit hackish, but extremely useful.
46#
47ifeq ($(BUILD_TARGET),$(BUILD_PLATFORM))
48 ifeq ($(filter-out x86.x86 amd64.amd64 x86.amd64, $(BUILD_TARGET_ARCH).$(BUILD_PLATFORM_ARCH)),)
49 OTHERS += \
50 $(PATH_TARGET)/tstAsmStructs.run \
51 $(PATH_TARGET)/tstVMStructSize.run
52 endif
53endif
54OTHER_CLEAN += \
55 $(PATH_TARGET)/tstAsmStructs.run \
56 $(PATH_TARGET)/tstVMStructSize.run \
57 $(PATH_TARGET)/tstAsmStructs.h \
58 $(PATH_TARGET)/tstAsmStructsAsm.o \
59 $(PATH_TARGET)/tstAsmStructs.h.dump
60
61#
62# Globals.
63#
64TEMPLATE = VBOXR3TSTEXE
65
66#
67# Targets
68#
69tstHelp_TEMPLATE = VBOXLNX32GUESTR3
70tstHelp_SOURCES = tstHelpA.asm tstHelp.c
71
72tstProg1_TEMPLATE = VBOXLNX32GUESTR3
73tstProg1_SOURCES = tstProg-1.c tstProg-1A.asm
74tstProg1_LIBS = $(PATH_LIB)/tstHelp$(VBOX_SUFF_LIB)
75tstProg1_LDFLAGS.linux = -static
76
77tstProg2_TEMPLATE = VBOXLNX32GUESTR3
78tstProg2_SOURCES = tstProg-2.c tstProg-2A.asm
79tstProg2_LDFLAGS.linux = -static
80
81tstProg3_TEMPLATE = VBOXLNX32GUESTR3
82tstProg3_SOURCES = tstProg-3.c
83tstProg3_LDFLAGS.linux = -static
84
85
86tstVMStructGC_TEMPLATE = VBOXGCEXE
87tstVMStructGC_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
88tstVMStructGC_SOURCES = tstVMStructGC.cpp
89tstVMStructGC_INCS = .. ../PATM
90
91tstVMStructSize_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
92tstVMStructSize_INCS = .. ../PATM $(PATH_TARGET)
93tstVMStructSize_SOURCES = tstVMStructSize.cpp
94tstVMStructSize_LIBS.l4 = $(LIB_RUNTIME)
95tstVMStructSize.cpp_DEPS= $(PATH_TARGET)/tstVMStructGC.h
96
97tstAsmStructs_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
98tstAsmStructs_INCS = .. $(PATH_TARGET)
99tstAsmStructs_SOURCES = tstAsmStructs.cpp
100tstAsmStructs_LIBS.l4 = $(LIB_RUNTIME)
101
102tstAsmStructsGC_TEMPLATE= VBOXGCEXE
103tstAsmStructsGC_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
104tstAsmStructsGC_INCS = .. $(PATH_TARGET)
105tstAsmStructsGC_SOURCES = tstAsmStructs.cpp
106
107tstAsmStructs.cpp_DEPS = $(PATH_TARGET)/tstAsmStructsHC.h $(PATH_TARGET)/tstAsmStructsGC.h
108
109
110tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
111tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
112
113tstSSM_SOURCES = tstSSM.cpp
114tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
115
116tstCFGM_SOURCES = tstCFGM.cpp
117tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
118
119tstVMM_SOURCES = tstVMM.cpp
120tstVMM_TEMPLATE = VBOXR3EXE
121tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
122
123tstVMM-2_SOURCES = tstVMM-2.cpp
124tstVMM-2_TEMPLATE = VBOXR3EXE
125tstVMM-2_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
126
127tstVMMR0CallHost-1_TEMPLATE = VBOXR3EXE
128tstVMMR0CallHost-1_INCS = ..
129tstVMMR0CallHost-1_SOURCES = \
130 tstVMMR0CallHost-1.cpp \
131 ../VMMR0/VMMR0A.asm
132tstVMMR0CallHost-1_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
133
134tstVMREQ_SOURCES = tstVMREQ.cpp
135tstVMREQ_TEMPLATE = VBOXR3EXE
136tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
137
138tstAnimate_SOURCES = tstAnimate.cpp
139tstAnimate_TEMPLATE = VBOXR3EXE
140tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
141
142tstCompiler_SOURCES = tstCompiler.cpp
143tstCompiler_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
144
145tstMicro_SOURCES = tstMicro.cpp
146tstMicro_TEMPLATE = VBOXR3EXE
147tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
148
149# tstMicroGC.gc
150tstMicroGC_TEMPLATE = VBOXGC
151tstMicroGC_SOURCES = tstMicroGC.cpp tstMicroGCA.asm
152tstMicroGC_DEFS =
153ifeq ($(VBOX_LDR_FMT32),pe)
154tstMicroGC_LDFLAGS = -Entry:tstMicroGC
155endif
156tstMicroGC_SYSSUFF = .gc
157tstMicroGC_LIBS = \
158 $(PATH_LIB)/DisasmGC$(VBOX_SUFF_LIB) \
159 $(PATH_LIB)/RuntimeGC$(VBOX_SUFF_LIB)
160ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
161tstMicroGC_LIBS += \
162 $(PATH_LIB)/VMMGCBuiltin$(VBOX_SUFF_LIB) \
163 $(LIB_VMMGC)
164endif
165tstMicroGC_SOURCES.win = tstMicroGC.def
166
167
168include $(PATH_KBUILD)/footer.kmk
169
170
171#
172# Some handcrafted support for tstAsmStructs.
173#
174
175# 1. make an aout object containing the offsets.
176$(PATH_TARGET)/tstAsmStructsAsm.o: tstAsmStructsAsm.asm \
177 $(DEPTH)/include/iprt/asmdefs.mac \
178 $(DEPTH)/include/VBox/cpum.mac \
179 $(DEPTH)/include/VBox/vm.mac \
180 ../CPUMInternal.mac \
181 ../TRPMInternal.mac \
182 ../VMMInternal.mac \
183 Makefile
184 $(call MSG_L1,Compiling $<)
185ifndef DONT_USE_YASM
186 $(QUIET)$(TOOL_YASM_AS) \
187 $(addprefix -D, \
188 $(DEFS) \
189 $(DEFS.$(BUILD_TYPE)) \
190 $(DEFS.$(BUILD_TARGET)) \
191 IN_RING3 \
192 $(DEFS.$(BUILD_TARGET_ARCH)) \
193 $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
194 ) \
195 -f elf -g stabs $(foreach inc,$(INCS),-I$(inc)/) -o $@ $<
196else
197 $(QUIET)$(TOOL_NASM_AS) \
198 $(addprefix -D, \
199 $(DEFS) \
200 $(DEFS.$(BUILD_TYPE)) \
201 $(DEFS.$(BUILD_TARGET)) \
202 IN_RING3 \
203 $(DEFS.$(BUILD_TARGET_ARCH)) \
204 $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
205 ) \
206 -f elf $(foreach inc,$(INCS),-I$(inc)/) -o $@ $<
207endif
208
209# 2. use objdump and sed to transform this into the header we want.
210$(PATH_TARGET)/tstAsmStructsHC.h: $(PATH_TARGET)/tstAsmStructsAsm.o
211 $(call MSG_L1,Generating $@)
212 $(QUIET)$(RM) -f $@ $@.dump $@.tmp
213ifeq ($(BUILD_PLATFORM),win)
214 $(QUIET)$(PATH_TOOL_MINGW32)/bin/objdump.exe -x $< > $@.dump
215else
216 $(QUIET)objdump -x $< > $@.dump
217endif
218 $(QUIET)$(SED) -e '/STAMPROFILEADV/d' \
219 -e '/ l[[:space:]]*\*ABS\*[[:space:]]*00000000[[:space:]]*[^_.]*\./!d' -e 's/^[0]*\(.*\) l.*00000000 \([^.]*\)\.\(.*$$\)/ CHECK_OFF(\2, 0x0\1, \3);/' \
220 $@.dump > $@.tmp
221 $(QUIET)$(SED) -e '/VM_size$$/d' \
222 -e '/ l[[:space:]]*\*ABS\*[[:space:]]*00000000[[:space:]]*[^_.]*\_size/!d' -e 's/^[0]*\(.*\) l.*00000000 \([^.]*\)\_size/ CHECK_SIZE(\2, 0x0\1);/' \
223 $@.dump >> $@.tmp
224 $(QUIET)$(MV) -f $@.tmp $@
225 $(QUIET)$(RM) -f $@.dump
226
227# 3. transform the HC header into a GC one by omitting some HC only structures.
228$(PATH_TARGET)/tstAsmStructsGC.h: $(PATH_TARGET)/tstAsmStructsHC.h
229 $(call MSG_L1,Generating $@)
230 $(QUIET)$(SED) -e '/VMMSWITCHERDEF/d' \
231 $^ > $@
232
233# 4. run it.
234$(PATH_TARGET)/tstAsmStructs.run: $(INSTARGET_tstAsmStructs) $(INSTARGET_tstAsmStructsGC)
235 $(QUIET)$(RM) -f $@
236 $(INSTARGET_tstAsmStructs)
237 $(INSTARGET_tstAsmStructsGC)
238 $(QUIET)$(APPEND) "$@" "done"
239
240#
241# Run rule for tstVMStructSize.
242#
243
244# 1. Dump selected structure in the VMMGC.gc debug info.
245# 2. Generate a testcase from the dump
246## future
247
248# 1&2. Manually dump selected structures and members.
249$(PATH_TARGET)/tstVMStructGC.h: $(INSTARGET_tstVMStructGC)
250 $(call MSG_L1,Generating $<)
251 $(QUIET)$(INSTARGET_tstVMStructGC) > $@
252
253# 3. run it.
254$(PATH_TARGET)/tstVMStructSize.run: $(INSTARGET_tstVMStructSize)
255 $(QUIET)$(RM) -f $@
256 $^
257 $(QUIET)$(APPEND) "$@" "done"
258
259# alias for the two struct tests.
260run-struct-tests: $(PATH_TARGET)/tstAsmStructs.run $(PATH_TARGET)/tstVMStructSize.run
261
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