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 |
|
---|
21 | DEPTH = ../../../..
|
---|
22 | include $(PATH_KBUILD)/header.kmk
|
---|
23 |
|
---|
24 | #
|
---|
25 | # Target lists.
|
---|
26 | #
|
---|
27 | PROGRAMS = tstVMStructSize tstVMStructGC tstAsmStructs tstAsmStructsGC tstVMM tstVMM-HwAccm
|
---|
28 | ifdef 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
|
---|
34 | endif # 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 | #
|
---|
40 | ifeq ($(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
|
---|
46 | endif
|
---|
47 | OTHER_CLEAN += \
|
---|
48 | $(PATH_TARGET)/tstAsmStructs.run \
|
---|
49 | $(PATH_TARGET)/tstVMStructSize.run \
|
---|
50 | $(PATH_TARGET)/tstAsmStructs.h \
|
---|
51 | $(PATH_TARGET)/tstAsmStructsAsm.o \
|
---|
52 | $(PATH_TARGET)/tstAsmStructs.h.dump
|
---|
53 |
|
---|
54 | #
|
---|
55 | # Globals.
|
---|
56 | #
|
---|
57 | TEMPLATE = VBOXR3TSTEXE
|
---|
58 |
|
---|
59 | #
|
---|
60 | # Targets
|
---|
61 | #
|
---|
62 | tstVMStructGC_TEMPLATE = VBOXGCEXE
|
---|
63 | 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
|
---|
64 | tstVMStructGC_SOURCES = tstVMStructGC.cpp
|
---|
65 | tstVMStructGC_INCS = .. ../PATM
|
---|
66 |
|
---|
67 | 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
|
---|
68 | tstVMStructSize_INCS = .. ../PATM $(PATH_TARGET)
|
---|
69 | tstVMStructSize_SOURCES = tstVMStructSize.cpp
|
---|
70 | tstVMStructSize_LIBS.l4 = $(LIB_RUNTIME)
|
---|
71 | tstVMStructSize.cpp_DEPS= $(PATH_TARGET)/tstVMStructGC.h
|
---|
72 |
|
---|
73 | 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
|
---|
74 | tstAsmStructs_INCS = .. $(PATH_TARGET)
|
---|
75 | tstAsmStructs_SOURCES = tstAsmStructs.cpp
|
---|
76 | tstAsmStructs_LIBS.l4 = $(LIB_RUNTIME)
|
---|
77 |
|
---|
78 | tstAsmStructsGC_TEMPLATE= VBOXGCEXE
|
---|
79 | 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
|
---|
80 | tstAsmStructsGC_INCS = .. $(PATH_TARGET)
|
---|
81 | tstAsmStructsGC_SOURCES = tstAsmStructs.cpp
|
---|
82 |
|
---|
83 | tstAsmStructs.cpp_DEPS = $(PATH_TARGET)/tstAsmStructsHC.h $(PATH_TARGET)/tstAsmStructsGC.h
|
---|
84 |
|
---|
85 |
|
---|
86 | tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
|
---|
87 | tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
88 |
|
---|
89 | tstSSM_SOURCES = tstSSM.cpp
|
---|
90 | tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
91 |
|
---|
92 | tstCFGM_SOURCES = tstCFGM.cpp
|
---|
93 | tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
94 |
|
---|
95 | tstVMM_SOURCES = tstVMM.cpp
|
---|
96 | tstVMM_TEMPLATE = VBOXR3EXE
|
---|
97 | tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
98 |
|
---|
99 | tstVMM-HwAccm_SOURCES = tstVMM-HwAccm.cpp
|
---|
100 | tstVMM-HwAccm_TEMPLATE = VBOXR3EXE
|
---|
101 | tstVMM-HwAccm_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
102 |
|
---|
103 | tstVMM-2_SOURCES = tstVMM-2.cpp
|
---|
104 | tstVMM-2_TEMPLATE = VBOXR3EXE
|
---|
105 | tstVMM-2_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
106 |
|
---|
107 | tstVMMR0CallHost-1_TEMPLATE = VBOXR3EXE
|
---|
108 | tstVMMR0CallHost-1_INCS = ..
|
---|
109 | tstVMMR0CallHost-1_SOURCES = \
|
---|
110 | tstVMMR0CallHost-1.cpp \
|
---|
111 | ../VMMR0/VMMR0A.asm
|
---|
112 | tstVMMR0CallHost-1_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
113 |
|
---|
114 | tstVMREQ_SOURCES = tstVMREQ.cpp
|
---|
115 | tstVMREQ_TEMPLATE = VBOXR3EXE
|
---|
116 | tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
117 |
|
---|
118 | tstAnimate_SOURCES = tstAnimate.cpp
|
---|
119 | tstAnimate_TEMPLATE = VBOXR3EXE
|
---|
120 | tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
121 |
|
---|
122 | tstCompiler_SOURCES = tstCompiler.cpp
|
---|
123 | tstCompiler_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
124 |
|
---|
125 | tstMicro_SOURCES = tstMicro.cpp
|
---|
126 | tstMicro_TEMPLATE = VBOXR3EXE
|
---|
127 | tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
|
---|
128 |
|
---|
129 | # tstMicroGC.gc
|
---|
130 | tstMicroGC_TEMPLATE = VBOXGC
|
---|
131 | tstMicroGC_SOURCES = tstMicroGC.cpp tstMicroGCA.asm
|
---|
132 | tstMicroGC_DEFS =
|
---|
133 | ifeq ($(VBOX_LDR_FMT32),pe)
|
---|
134 | tstMicroGC_LDFLAGS = -Entry:tstMicroGC
|
---|
135 | endif
|
---|
136 | tstMicroGC_SYSSUFF = .gc
|
---|
137 | tstMicroGC_LIBS = \
|
---|
138 | $(PATH_LIB)/DisasmGC$(VBOX_SUFF_LIB) \
|
---|
139 | $(PATH_LIB)/RuntimeGC$(VBOX_SUFF_LIB)
|
---|
140 | ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
|
---|
141 | tstMicroGC_LIBS += \
|
---|
142 | $(PATH_LIB)/VMMGCBuiltin$(VBOX_SUFF_LIB) \
|
---|
143 | $(LIB_VMMGC)
|
---|
144 | endif
|
---|
145 | tstMicroGC_SOURCES.win = tstMicroGC.def
|
---|
146 |
|
---|
147 |
|
---|
148 | include $(PATH_KBUILD)/footer.kmk
|
---|
149 |
|
---|
150 |
|
---|
151 | #
|
---|
152 | # Some handcrafted support for tstAsmStructs.
|
---|
153 | #
|
---|
154 |
|
---|
155 | # 1. make an aout object containing the offsets.
|
---|
156 | $(PATH_TARGET)/tstAsmStructsAsm.o: tstAsmStructsAsm.asm \
|
---|
157 | $(DEPTH)/include/iprt/asmdefs.mac \
|
---|
158 | $(DEPTH)/include/VBox/cpum.mac \
|
---|
159 | $(DEPTH)/include/VBox/vm.mac \
|
---|
160 | ../CPUMInternal.mac \
|
---|
161 | ../TRPMInternal.mac \
|
---|
162 | ../VMMInternal.mac \
|
---|
163 | Makefile \
|
---|
164 | | $(call DIRDEP,$(PATH_TARGET))
|
---|
165 | $(call MSG_L1,Compiling $<)
|
---|
166 | ifndef DONT_USE_YASM
|
---|
167 | $(QUIET)$(TOOL_YASM_AS) \
|
---|
168 | $(addprefix -D, \
|
---|
169 | $(DEFS) \
|
---|
170 | $(DEFS.$(BUILD_TYPE)) \
|
---|
171 | $(DEFS.$(BUILD_TARGET)) \
|
---|
172 | IN_RING3 \
|
---|
173 | $(DEFS.$(BUILD_TARGET_ARCH)) \
|
---|
174 | $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
175 | ) \
|
---|
176 | -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
|
---|
177 | $(foreach inc,$(INCS),-I$(inc)/) -o $@ $<
|
---|
178 | else
|
---|
179 | $(QUIET)$(TOOL_NASM_AS) \
|
---|
180 | $(addprefix -D, \
|
---|
181 | $(DEFS) \
|
---|
182 | $(DEFS.$(BUILD_TYPE)) \
|
---|
183 | $(DEFS.$(BUILD_TARGET)) \
|
---|
184 | IN_RING3 \
|
---|
185 | $(DEFS.$(BUILD_TARGET_ARCH)) \
|
---|
186 | $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
|
---|
187 | ) \
|
---|
188 | -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
|
---|
189 | $(foreach inc,$(INCS),-I$(inc)/) -o $@ $<
|
---|
190 | endif
|
---|
191 |
|
---|
192 | # 2. use nm and sed to transform this into the header we want.
|
---|
193 | ifeq ($(BUILD_PLATFORM),win)
|
---|
194 | include $(PATH_KBUILD)/tools/MINGW32.kmk
|
---|
195 | VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
|
---|
196 | else
|
---|
197 | VBOX_NM ?= nm -p
|
---|
198 | endif
|
---|
199 | $(PATH_TARGET)/tstAsmStructsHC.h: $(PATH_TARGET)/tstAsmStructsAsm.o
|
---|
200 | $(call MSG_L1,Generating $@)
|
---|
201 | $(QUIET)$(RM) -f $@ $@.dump $@.tmp
|
---|
202 | $(VBOX_NM) $< > $@.dump
|
---|
203 | $(QUIET)$(SED) -e '/STAMPROFILEADV/d' \
|
---|
204 | -e '/00[0-9a-fA-F]* a [^_.]*\./!d' -e 's/\(00[0-9a-fA-F]*\) a \([^.]*\)\.\(.*$$\)/ CHECK_OFF(\2, 0x0\1, \3);/' \
|
---|
205 | $@.dump > $@.tmp
|
---|
206 | $(QUIET)$(SED) -e '/VM_size$$/d' \
|
---|
207 | -e '/00[0-9a-fA-F]* a [^_.]*_size$$/!d' -e 's/\(00[0-9a-fA-F]*\) a \([^_.]*\)_size/ CHECK_SIZE(\2, 0x0\1);/' \
|
---|
208 | $@.dump >> $@.tmp
|
---|
209 | $(QUIET)$(MV) -f $@.tmp $@
|
---|
210 | $(QUIET)$(RM) -f $@.dump
|
---|
211 |
|
---|
212 | # 3. transform the HC header into a GC one by omitting some HC only structures.
|
---|
213 | $(PATH_TARGET)/tstAsmStructsGC.h: $(PATH_TARGET)/tstAsmStructsHC.h
|
---|
214 | $(call MSG_L1,Generating $@)
|
---|
215 | $(QUIET)$(SED) -e '/VMMSWITCHERDEF/d' \
|
---|
216 | $^ > $@
|
---|
217 |
|
---|
218 | # 4. run it.
|
---|
219 | $(PATH_TARGET)/tstAsmStructs.run: $(INSTARGET_tstAsmStructs) $(INSTARGET_tstAsmStructsGC)
|
---|
220 | $(QUIET)$(RM) -f $@
|
---|
221 | $(INSTARGET_tstAsmStructs)
|
---|
222 | $(INSTARGET_tstAsmStructsGC)
|
---|
223 | $(QUIET)$(APPEND) "$@" "done"
|
---|
224 |
|
---|
225 | #
|
---|
226 | # Run rule for tstVMStructSize.
|
---|
227 | #
|
---|
228 |
|
---|
229 | # 1. Dump selected structure in the VMMGC.gc debug info.
|
---|
230 | # 2. Generate a testcase from the dump
|
---|
231 | ## future
|
---|
232 |
|
---|
233 | # 1&2. Manually dump selected structures and members.
|
---|
234 | $(PATH_TARGET)/tstVMStructGC.h: $(INSTARGET_tstVMStructGC)
|
---|
235 | $(call MSG_L1,Generating $<)
|
---|
236 | $(QUIET)$(INSTARGET_tstVMStructGC) > $@
|
---|
237 |
|
---|
238 | # 3. run it.
|
---|
239 | $(PATH_TARGET)/tstVMStructSize.run: $(INSTARGET_tstVMStructSize)
|
---|
240 | $(QUIET)$(RM) -f $@
|
---|
241 | $^
|
---|
242 | $(QUIET)$(APPEND) "$@" "done"
|
---|
243 |
|
---|
244 | # alias for the two struct tests.
|
---|
245 | run-struct-tests: $(PATH_TARGET)/tstAsmStructs.run $(PATH_TARGET)/tstVMStructSize.run
|
---|
246 |
|
---|