VirtualBox

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

Last change on this file since 46860 was 46543, checked in by vboxsync, 11 years ago

Instruction testing, early hacking.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 16.3 KB
Line 
1# $Id: Makefile.kmk 46543 2013-06-13 18:22:11Z vboxsync $
2## @file
3# Sub-Makefile for the VMM testcases.
4#
5
6#
7# Copyright (C) 2006-2013 Oracle Corporation
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
18SUB_DEPTH = ../../../..
19include $(KBUILD_PATH)/subheader.kmk
20
21#
22# Include sub-makefiles.
23#
24if 0 # Not ready for general consumption yet.
25 include $(PATH_SUB_CURRENT)/Instructions/Makefile.kmk
26endif
27
28#
29# Target lists.
30#
31PROGRAMS += tstVMStructSize tstAsmStructs
32ifdef VBOX_WITH_RAW_MODE
33 PROGRAMS += tstVMStructRC tstAsmStructsRC
34endif
35if !defined(VBOX_ONLY_EXTPACKS) \
36 && ( defined(VBOX_WITH_DTRACE_R3) \
37 || defined(VBOX_WITH_DTRACE_R0) \
38 || defined(VBOX_WITH_DTRACE_RC))
39 PROGRAMS += tstVMStructDTrace
40 INSTALLS += VMMLibDTraceStructTest
41endif
42ifndef VBOX_ONLY_EXTPACKS_USE_IMPLIBS
43 PROGRAMS += tstGlobalConfig tstInstrEmul
44 ifdef VBOX_WITH_RAW_MODE
45 PROGRAMS += tstVMM tstVMM-HM
46 ifneq ($(KBUILD_TARGET),win)
47 PROGRAMS += tstVMMFork
48 endif
49 endif
50 ifdef VBOX_WITH_TESTCASES
51 PROGRAMS += \
52 tstCFGM \
53 tstCompressionBenchmark \
54 tstIEMCheckMc \
55 tstMMHyperHeap \
56 tstSSM \
57 tstVMMR0CallHost-1 \
58 tstVMMR0CallHost-2 \
59 tstVMREQ
60 ifn1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), solaris.x86 solaris.amd64 win.amd64 ) ## TODO: Fix the code.
61 PROGRAMS += tstX86-1
62 endif
63 ifneq ($(KBUILD_TARGET),l4)
64 PROGRAMS += tstAnimate
65 endif
66 ifdef VBOX_WITH_RAW_MODE
67 PROGRAMS += tstMicro
68 SYSMODS += tstMicroRC
69 endif
70 ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
71 PROGRAMS += tstPDMAsyncCompletion
72 PROGRAMS += tstPDMAsyncCompletionStress
73 endif
74 endif # VBOX_WITH_TESTCASES
75endif # !VBOX_ONLY_EXTPACKS_USE_IMPLIBS
76
77# Where we put our temporary files (just for simplicity)
78VBOX_VMM_TESTCASE_OUT_DIR := $(PATH_TARGET)/VMM
79BLDDIRS += $(VBOX_VMM_TESTCASE_OUT_DIR)
80
81#
82# We setup two 'other' targets for executing the two structure & alignment
83# validation testcases. Perhaps a bit hackish, but extremely useful.
84#
85ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
86 ifeq ($(filter-out x86.x86 amd64.amd64 x86.amd64, $(KBUILD_TARGET_ARCH).$(KBUILD_HOST_ARCH)),)
87 OTHERS += \
88 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run \
89 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run
90 endif
91endif
92
93# The normal testing pass.
94TESTING += \
95 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run \
96 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run
97ifndef VBOX_ONLY_EXTPACKS_USE_IMPLIBS
98 TESTING += \
99 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstInstrEmul.run
100endif
101
102OTHER_CLEAN += \
103 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run \
104 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run \
105 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstInstrEmul.run \
106 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.h \
107 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.o \
108 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac \
109 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac.o \
110 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac.lst \
111 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.h.dump \
112 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsRC.h \
113 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h \
114 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructRC.h
115
116#
117# Globals
118#
119VBOX_PATH_VMM_SRC = $(PATH_ROOT)/src/VBox/VMM
120
121#
122# Targets
123#
124ifdef VBOX_WITH_RAW_MODE
125 tstVMStructRC_TEMPLATE = VBoxRcExe
126 tstVMStructRC_DEFS = IN_VMM_RC IN_DIS IN_RT_RC VBOX_WITH_RAW_MODE
127 ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),darwin.x86)
128 tstVMStructRC_DEFS += \
129 VBOX_WITH_2X_4GB_ADDR_SPACE VBOX_WITH_2X_4GB_ADDR_SPACE_IN_RC \
130 VBOX_WITH_HYBRID_32BIT_KERNEL VBOX_WITH_HYBRID_32BIT_KERNEL_IN_RC
131 endif
132 ifdef VBOX_WITH_R0_LOGGING
133 tstVMStructRC_DEFS += VBOX_WITH_R0_LOGGING
134 endif
135 ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
136 tstVMStructRC_DEFS += VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
137 endif
138 tstVMStructRC_SOURCES = tstVMStructRC.cpp
139 tstVMStructRC_INCS = \
140 $(VBOX_PATH_VMM_SRC)/include \
141 $(VBOX_PATH_VMM_SRC)/PATM
142endif
143
144tstVMStructSize_TEMPLATE= VBOXR3AUTOTST
145tstVMStructSize_DEFS = IN_VMM_R3 IN_DIS
146ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),darwin.x86)
147 tstVMStructSize_DEFS += \
148 VBOX_WITH_2X_4GB_ADDR_SPACE VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R3 \
149 VBOX_WITH_HYBRID_32BIT_KERNEL VBOX_WITH_HYBRID_32BIT_KERNEL_IN_R3
150endif
151ifdef VBOX_WITH_RAW_MODE
152 tstVMStructSize_DEFS += VBOX_WITH_RAW_MODE
153endif
154tstVMStructSize_INCS = \
155 $(VBOX_PATH_VMM_SRC)/include \
156 $(VBOX_PATH_VMM_SRC)/PATM \
157 $(VBOX_VMM_TESTCASE_OUT_DIR)
158tstVMStructSize_SOURCES = tstVMStructSize.cpp
159ifdef VBOX_WITH_RAW_MODE
160 tstVMStructSize.cpp_DEPS= $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructRC.h
161endif
162ifdef VBOX_WITH_R0_LOGGING
163 tstVMStructSize_DEFS += VBOX_WITH_R0_LOGGING
164endif
165ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
166 tstVMStructSize_DEFS += VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
167endif
168
169tstAsmStructs_TEMPLATE = VBOXR3AUTOTST
170tstAsmStructs_DEFS = IN_VMM_R3 IN_DIS
171ifdef VBOX_WITH_RAW_MODE
172 tstAsmStructs_DEFS += VBOX_WITH_RAW_MODE
173endif
174ifdef VBOX_WITH_R0_LOGGING
175 tstAsmStructs_DEFS += VBOX_WITH_R0_LOGGING
176endif
177ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
178 tstAsmStructs_DEFS += VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
179endif
180tstAsmStructs_INCS = \
181 $(VBOX_PATH_VMM_SRC)/include \
182 $(VBOX_VMM_TESTCASE_OUT_DIR)
183tstAsmStructs_SOURCES = tstAsmStructs.cpp
184tstAsmStructs.cpp_DEPS = $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h
185
186ifdef VBOX_WITH_RAW_MODE
187 tstAsmStructsRC_TEMPLATE= VBoxRcExe
188 tstAsmStructsRC_DEFS = IN_VMM_RC IN_DIS IN_RT_RC VBOX_WITH_RAW_MODE
189 ifdef VBOX_WITH_R0_LOGGING
190 tstAsmStructsRC_DEFS += VBOX_WITH_R0_LOGGING
191 endif
192 ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
193 tstAsmStructsRC_DEFS += VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
194 endif
195 tstAsmStructsRC_INCS = \
196 $(VBOX_PATH_VMM_SRC)/include \
197 $(VBOX_VMM_TESTCASE_OUT_DIR)
198 tstAsmStructsRC_SOURCES = tstAsmStructs.cpp
199 tstAsmStructs.cpp_DEPS += $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsRC.h
200endif # VBOX_WITH_RAW_MODE
201
202
203tstGlobalConfig_TEMPLATE= VBOXR3TSTEXE
204tstGlobalConfig_SOURCES = tstGlobalConfig.cpp
205tstGlobalConfig_LIBS = $(LIB_RUNTIME)
206
207tstIEMCheckMc_TEMPLATE = VBOXR3TSTEXE
208tstIEMCheckMc_SOURCES = tstIEMCheckMc.cpp
209tstIEMCheckMc_LIBS = $(LIB_RUNTIME)
210ifneq ($(KBUILD_TARGET),win)
211tstIEMCheckMc_CXXFLAGS = -Wno-unused-parameter
212endif
213
214tstMMHyperHeap_TEMPLATE = VBOXR3TSTEXE
215tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
216tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
217
218tstSSM_TEMPLATE = VBOXR3TSTEXE
219tstSSM_INCS = $(VBOX_PATH_VMM_SRC)/include
220tstSSM_SOURCES = tstSSM.cpp
221tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
222
223tstInstrEmul_TEMPLATE = VBOXR3EXE
224tstInstrEmul_SOURCES = tstInstrEmul.cpp ../VMMAll/EMAllA.asm
225tstInstrEmul_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
226
227tstCFGM_TEMPLATE = VBOXR3TSTEXE
228tstCFGM_SOURCES = tstCFGM.cpp
229tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
230
231tstCompressionBenchmark_TEMPLATE = VBOXR3TSTEXE
232tstCompressionBenchmark_SOURCES = tstCompressionBenchmark.cpp
233
234tstVMMR0CallHost-1_TEMPLATE = VBOXR3TSTEXE
235tstVMMR0CallHost-1_DEFS = VMM_R0_NO_SWITCH_STACK
236tstVMMR0CallHost-1_INCS = $(VBOX_PATH_VMM_SRC)/include
237tstVMMR0CallHost-1_SOURCES = \
238 tstVMMR0CallHost-1.cpp
239tstVMMR0CallHost-1_SOURCES.amd64 = \
240 $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0JmpA-amd64.asm
241tstVMMR0CallHost-1_SOURCES.x86 = \
242 $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0JmpA-x86.asm
243
244tstVMMR0CallHost-2_EXTENDS = tstVMMR0CallHost-1
245tstVMMR0CallHost-2_DEFS = VMM_R0_SWITCH_STACK
246
247tstVMREQ_TEMPLATE = VBOXR3EXE
248tstVMREQ_SOURCES = tstVMREQ.cpp
249tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
250
251tstAnimate_TEMPLATE = VBOXR3EXE
252tstAnimate_SOURCES = tstAnimate.cpp
253tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
254
255tstX86-1_TEMPLATE = VBOXR3TSTEXE
256tstX86-1_SOURCES = tstX86-1.cpp tstX86-1A.asm
257tstX86-1_LIBS = $(LIB_RUNTIME)
258
259ifdef VBOX_WITH_RAW_MODE
260
261 tstVMM_TEMPLATE = VBOXR3EXE
262 tstVMM_SOURCES = tstVMM.cpp
263 tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
264
265 tstVMM-HM_TEMPLATE = VBOXR3EXE
266 tstVMM-HM_SOURCES = tstVMM-HM.cpp
267 tstVMM-HM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
268
269 tstVMMFork_TEMPLATE = VBOXR3EXE
270 tstVMMFork_SOURCES = tstVMMFork.cpp
271 tstVMMFork_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
272
273 tstMicro_TEMPLATE = VBOXR3EXE
274 tstMicro_SOURCES = tstMicro.cpp
275 tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
276 tstMicro_DEFS = $(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,)
277
278 tstMicroRC_TEMPLATE = VBoxRc
279 tstMicroRC_SOURCES = tstMicroRC.cpp tstMicroRCA.asm
280 tstMicroRC_DEFS = $(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,)
281 tstMicroRC_INCS = $(VBOX_PATH_VMM_SRC)/testcase
282 ifeq ($(VBOX_LDR_FMT32),pe)
283 tstMicroRC_LDFLAGS = -Entry:tstMicroRC
284 endif
285 tstMicroRC_SYSSUFF = .gc
286 tstMicroRC_LIBS = \
287 $(PATH_STAGE_LIB)/DisasmRC$(VBOX_SUFF_LIB) \
288 $(PATH_STAGE_LIB)/RuntimeRC$(VBOX_SUFF_LIB)
289 ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
290 tstMicroRC_LIBS += \
291 $(PATH_STAGE_LIB)/VMMRCBuiltin$(VBOX_SUFF_LIB) \
292 $(LIB_VMMGC)
293 endif
294 tstMicroRC_SOURCES.win = tstMicroRC.def
295
296endif # VBOX_WITH_RAW_MODE
297
298ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
299 tstPDMAsyncCompletion_TEMPLATE = VBOXR3EXE
300 tstPDMAsyncCompletion_INCS = $(VBOX_PATH_VMM_SRC)/include
301 tstPDMAsyncCompletion_SOURCES = tstPDMAsyncCompletion.cpp
302 tstPDMAsyncCompletion_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
303
304 tstPDMAsyncCompletionStress_TEMPLATE = VBOXR3EXE
305 tstPDMAsyncCompletionStress_INCS = $(VBOX_PATH_VMM_SRC)/include
306 tstPDMAsyncCompletionStress_SOURCES = tstPDMAsyncCompletionStress.cpp
307 tstPDMAsyncCompletionStress_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
308endif
309
310
311#
312# Generate VM structure tests.
313#
314if !defined(VBOX_ONLY_EXTPACKS) \
315 && ( defined(VBOX_WITH_DTRACE_R3) \
316 || defined(VBOX_WITH_DTRACE_R0) \
317 || defined(VBOX_WITH_DTRACE_RC))
318 tstVMStructDTrace_TEMPLATE= VBOXR3AUTOTST
319 tstVMStructDTrace_DEFS = IN_VMM_R3 IN_DIS
320 ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),darwin.x86)
321 tstVMStructDTrace_DEFS += \
322 VBOX_WITH_2X_4GB_ADDR_SPACE VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R3 \
323 VBOX_WITH_HYBRID_32BIT_KERNEL VBOX_WITH_HYBRID_32BIT_KERNEL_IN_R3
324 endif
325 ifdef VBOX_WITH_RAW_MODE
326 tstVMStructDTrace_DEFS += VBOX_WITH_RAW_MODE
327 endif
328 tstVMStructDTrace_INCS = \
329 $(VBOX_PATH_VMM_SRC)/include \
330 $(VBOX_PATH_VMM_SRC)/PATM \
331 $(VBOX_VMM_TESTCASE_OUT_DIR)
332 tstVMStructDTrace_SOURCES = tstVMStructDTrace.cpp
333 ifdef VBOX_WITH_R0_LOGGING
334 tstVMStructDTrace_DEFS += VBOX_WITH_R0_LOGGING
335 endif
336 ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
337 tstVMStructDTrace_DEFS += VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
338 endif
339
340
341 VMMLibDTraceStructTest_INST = $(VBOX_INST_DTRACE_TST)$(KBUILD_TARGET_ARCH)/
342 VMMLibDTraceStructTest_SOURCES = \
343 $(tstVMStructDTrace_0_OUTDIR)/vbox-vm-struct-test.d
344
345 $$(tstVMStructDTrace_0_OUTDIR)/vbox-vm-struct-test.d: \
346 $$(tstVMStructDTrace_1_STAGE_TARGET) | $$(dir $$@)
347 $(QUIET)$(RM) -f $@
348 $< > $@
349
350endif
351
352
353include $(FILE_KBUILD_SUB_FOOTER)
354
355
356#
357# Run rule for tstInstrEmul.
358#
359$(VBOX_VMM_TESTCASE_OUT_DIR)/tstInstrEmul.run: $$(tstInstrEmul_1_STAGE_TARGET) | $$(dir $$@)
360 $(QUIET)$(RM) -f $@
361 $(QUIET)$(REDIRECT) -E 'VBOX_LOG_FLAGS=disabled' -E 'VBOX_LOG_DEST=nofile' \
362 $(if $(eq $(KBUILD_TARGET),darwin), -E 'DYLD_FALLBACK_LIBRARY_PATH=$(dir $(LIB_RUNTIME))') \
363 -- \
364 $(tstInstrEmul_1_STAGE_TARGET)
365 $(QUIET)$(APPEND) "$@" "done"
366
367
368#
369# Some handcrafted support targets for tstAsmStructs.
370#
371
372ifeq ($(KBUILD_HOST),win)
373 ifndef TOOL_MINGW32
374 include $(KBUILD_PATH)/tools/MINGW32.kmk
375 endif
376 VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
377else
378 VBOX_NM ?= nm -p
379endif
380
381MY_ASA_ASM_STUFF = \
382 $(addprefix -D, \
383 $(DEFS) \
384 $(DEFS.$(KBUILD_TYPE)) \
385 $(DEFS.$(KBUILD_TARGET)) \
386 IN_RING3 $(ARCH_BITS_DEFS) \
387 $(DEFS.$(KBUILD_TARGET_ARCH)) \
388 $(DEFS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
389 $(if $(VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI),VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI,) \
390 ) \
391 -f $(if $(eq $(KBUILD_TARGET),darwin),macho,elf) \
392 $(foreach inc,$(INCS) $(VBOX_PATH_VMM_SRC)/testcase $(VBOX_PATH_VMM_SRC)/include $(VBOX_VMM_TESTCASE_OUT_DIR)\
393 ,-I$(inc)/)
394
395# 1a. make a header file which makes all the structures+members globals.
396$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac: \
397 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
398 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed \
399 $(DEPTH)/include/iprt/asmdefs.mac \
400 $(DEPTH)/include/VBox/vmm/cpum.mac \
401 $(DEPTH)/include/VBox/vmm/vm.mac \
402 $(DEPTH)/include/VBox/sup.mac \
403 $(DEPTH)/include/iprt/x86.mac \
404 $(VBOX_PATH_VMM_SRC)/include/CPUMInternal.mac \
405 $(VBOX_PATH_VMM_SRC)/include/TRPMInternal.mac \
406 $(VBOX_PATH_VMM_SRC)/include/HMInternal.mac \
407 $(VBOX_PATH_VMM_SRC)/include/VMMInternal.mac \
408 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
409 $(PATH_ROOT)/Config.kmk $(LOCALCFG) $(AUTOCFG) \
410 | $$(dir $$@)
411 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
412ifndef DONT_USE_YASM
413 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -o $@.o -l $@.lst $<
414 $(SED) -f $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed --output $@ $@.lst
415else
416 $(QUIET)$(TOOL_NASM_AS) -g $(MY_ASA_ASM_STUFF) -o $@.o -l $@.lst $<
417 $(VBOX_NM) $@.o | $(SED) \
418 -e '/[0-9a-fA-F][0-9a-fA-F]* [^a] /d' \
419 -e 's/[0-9a-fA-F][0-9a-fA-F]* a \([^ ]*\)/global \1/' \
420 > $@
421endif
422
423# 1b. make an elf/macho object containing the offsets.
424$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.o: \
425 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
426 $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.mac \
427 $(DEPTH)/include/iprt/asmdefs.mac \
428 $(DEPTH)/include/VBox/vmm/cpum.mac \
429 $(DEPTH)/include/VBox/vmm/vm.mac \
430 $(DEPTH)/include/VBox/sup.mac \
431 $(DEPTH)/include/iprt/x86.mac \
432 $(VBOX_PATH_VMM_SRC)/include/CPUMInternal.mac \
433 $(VBOX_PATH_VMM_SRC)/include/HMInternal.mac \
434 $(VBOX_PATH_VMM_SRC)/include/VMMInternal.mac \
435 $(VBOX_PATH_VMM_SRC)/include/VMMSwitcher.mac \
436 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
437 | $$(dir $$@)
438 $(call MSG_COMPILE,tstAsmStructsasm,$<,$@,AS)
439ifndef DONT_USE_YASM
440 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
441else
442 $(QUIET)$(TOOL_NASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
443endif
444
445# 2. use nm and sed to transform this into the header we want.
446$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h: $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsAsm.o
447 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
448 $(QUIET)$(RM) -f $@ $@.dump $@.tmp
449 $(QUIET)$(REDIRECT) -wo $@.dump -- $(VBOX_NM) $<
450 $(QUIET)$(SED) \
451 -e '/STAMPROFILEADV/d' \
452 \
453 -e '/00[0-9a-fA-F]* [aA] [^_.]*\./!d' \
454 -e 's/\(00[0-9a-fA-F]*\) [aA] \([^.]*\)\.\(.*$$\)/ CHECK_OFF(\2, 0x0\1, \3);/' \
455 --output $@.tmp $@.dump
456 $(QUIET)$(SED) \
457 -e '/VM_size$$/d' \
458 -e '/VMCPU_size$$/d' \
459 -e '/VMMCPU_size$$/d' \
460 -e '/SUPDRVTRACERUSRCTX32_size$$/d' \
461 \
462 -e '/00[0-9a-fA-F]* [aA] [^_.]*_size$$/!d' \
463 -e 's/\(00[0-9a-fA-F]*\) [aA] \([^_.]*\)_size/ CHECK_SIZE(\2, 0x0\1);/' \
464 --append $@.tmp $@.dump
465 $(QUIET)$(MV) -f $@.tmp $@
466 $(QUIET)$(RM) -f $@.dump
467
468ifdef VBOX_WITH_RAW_MODE
469# 3. transform the HC header into a RC one by omitting some HC only structures.
470$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsRC.h: $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h
471 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
472 $(QUIET)$(SED) -e '/VMMSWITCHERDEF/d' --output $@ $^
473endif
474
475# 4. run it.
476$(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run: \
477 $$(tstAsmStructs_1_STAGE_TARGET) \
478 $(if-expr defined(VBOX_WITH_RAW_MODE),$$(tstAsmStructsRC_1_STAGE_TARGET),)
479 $(QUIET)$(RM) -f $@
480 $(tstAsmStructs_1_STAGE_TARGET)
481ifdef VBOX_WITH_RAW_MODE
482 $(tstAsmStructsRC_1_STAGE_TARGET)
483endif
484 $(QUIET)$(APPEND) "$@" "done"
485
486
487
488#
489# Run rule for tstVMStructSize.
490#
491
492ifdef VBOX_WITH_RAW_MODE
493# 1. Manually dump selected structures and members.
494$(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructRC.h: $$(tstVMStructRC_1_STAGE_TARGET) | $$(dir $$@)
495 $(call MSG_GENERATE,tstVMStructSize,$@)
496 $(QUIET)$(REDIRECT) -wo $@ -- $<
497endif # VBOX_WITH_RAW_MODE
498
499# 2. run it.
500$(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run: $$(tstVMStructSize_1_STAGE_TARGET) | $$(dir $$@)
501 $(QUIET)$(RM) -f $@
502 $<
503 $(QUIET)$(APPEND) "$@" "done"
504
505# alias for the two struct tests.
506run-struct-tests: $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructs.run $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructSize.run
507
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