VirtualBox

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

Last change on this file since 41294 was 41259, checked in by vboxsync, 13 years ago

Working on DTrace lib files.

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