VirtualBox

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

Last change on this file since 63648 was 62478, checked in by vboxsync, 8 years ago

(C) 2016

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 25.2 KB
Line 
1# $Id: Makefile.kmk 62478 2016-07-22 18:29:06Z vboxsync $
2## @file
3# Top-level makefile for the VMM.
4#
5
6#
7# Copyright (C) 2006-2016 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# Include sub-makefiles.
22ifndef VBOX_ONLY_EXTPACKS
23 include $(PATH_SUB_CURRENT)/tools/Makefile.kmk
24endif
25include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
26
27
28# Fail on unsupported hosts.
29ifeq ($(KBUILD_TARGET_ARCH),x86)
30 ifeq ($(KBUILD_TARGET),darwin)
31 $(error 32-bit darwin is no longer a supported VirtualBox host. Go back to 4.3 or older for 32-bit support.)
32 else ifeq ($(KBUILD_TARGET),solaris)
33 $(error 32-bit solaris is no longer a supported VirtualBox host. Go back to 4.2 or older for 32-bit support.)
34 endif
35endif
36
37
38#
39# Globals
40#
41
42## DEFS variable that is picked up by all three VMM targets (R0, R3, RC).
43# Can be prepended to by setting it in LocalConfig.kmk
44VMM_COMMON_DEFS ?= VBOX_IN_VMM
45ifdef VBOX_WITH_2ND_IEM_STEP
46 VMM_COMMON_DEFS += VBOX_WITH_2ND_IEM_STEP
47endif
48ifdef VBOX_WITH_3RD_IEM_STEP
49 VMM_COMMON_DEFS += VBOX_WITH_3RD_IEM_STEP
50endif
51#ifdef VBOX_WITH_IEM
52# VMM_COMMON_DEFS += VBOX_WITH_IEM
53#endif
54ifdef VBOX_WITH_REM
55 VMM_COMMON_DEFS += VBOX_WITH_REM
56endif
57ifdef VBOX_WITH_MULTI_CORE
58 VMM_COMMON_DEFS += VBOX_WITH_MULTI_CORE
59endif
60ifdef VBOX_WITH_R0_LOGGING
61 VMM_COMMON_DEFS += VBOX_WITH_R0_LOGGING
62endif
63ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
64 VMM_COMMON_DEFS += VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
65endif
66ifdef VBOX_WITH_PCI_PASSTHROUGH
67 VMM_COMMON_DEFS += VBOX_WITH_PCI_PASSTHROUGH
68endif
69ifdef VBOX_WITH_DTRACE_RC
70 VMM_COMMON_DEFS += VBOX_WITH_DTRACE_RC
71endif
72ifdef VBOX_WITH_SAFE_STR
73 VMM_COMMON_DEFS += VBOX_WITH_SAFE_STR
74endif
75ifdef VBOX_WITH_RAW_RING1
76 VMM_COMMON_DEFS += VBOX_WITH_RAW_RING1
77endif
78ifdef VBOX_WITH_64ON32_IDT
79 VMM_COMMON_DEFS += VBOX_WITH_64ON32_IDT
80endif
81ifdef VBOX_WITH_64ON32_CMOS_DEBUG
82 VMM_COMMON_DEFS += VBOX_WITH_64ON32_CMOS_DEBUG
83endif
84ifdef VBOXSTRICTRC_STRICT_ENABLED
85 VMM_COMMON_DEFS += VBOXSTRICTRC_STRICT_ENABLED
86endif
87ifeq ($(KBUILD_TARGET),amd64)
88 VMM_COMMON_DEFS += VBOX_WITH_MORE_RING0_MEM_MAPPINGS
89endif
90ifdef VBOX_WITH_NEW_APIC
91 VMM_COMMON_DEFS += VBOX_WITH_NEW_APIC
92endif
93ifdef VBOX_WITH_NEW_IOAPIC
94 VMM_COMMON_DEFS += VBOX_WITH_NEW_IOAPIC
95endif
96
97# VMM_COMMON_DEFS += VBOX_WITH_NS_ACCOUNTING_STATS
98
99# Special IEM debug mode which compares the result with HM/REM
100ifdef IEM_VERIFICATION_MODE
101 VMM_COMMON_DEFS += IEM_VERIFICATION_MODE IEM_VERIFICATION_MODE_FULL IEM_VERIFICATION_MODE_FULL_HM
102endif
103
104
105#
106# The VMM DLL.
107#
108ifndef VBOX_ONLY_EXTPACKS_USE_IMPLIBS
109 DLLS += VBoxVMM
110endif
111VBoxVMM_TEMPLATE = VBoxR3DllNoPic
112VBoxVMM_SONAME.linux = VBoxVMM.so
113
114VBoxVMM_DEFS = IN_VMM_R3 IN_DIS IN_GMM_R3 IN_DBG $(VMM_COMMON_DEFS)
115## @todo eliminate IN_GMM_R3
116ifdef VBOX_WITH_PREALLOC_RAM_BY_DEFAULT
117 VBoxVMM_DEFS += VBOX_WITH_PREALLOC_RAM_BY_DEFAULT
118endif
119ifdef VBOX_WITH_VUSB
120 VBoxVMM_DEFS += VBOX_WITH_USB
121endif
122ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
123 VBoxVMM_DEFS += VBOX_WITH_PDM_ASYNC_COMPLETION
124endif
125ifdef VBOX_WITH_NETSHAPER
126 VBoxVMM_DEFS += VBOX_WITH_NETSHAPER
127endif
128ifdef VBOX_WITH_RAW_MODE
129 VBoxVMM_DEFS += VBOX_WITH_RAW_MODE VBOX_WITH_RAW_MODE_NOT_R0
130endif
131ifdef VBOX_WITH_VMM_R0_SWITCH_STACK
132 VBoxVMM_DEFS += VMM_R0_SWITCH_STACK
133endif
134if "$(KBUILD_TYPE)" == "debug" && "$(USERNAME)" == "bird"
135 VBoxVMM_DEFS += RTMEM_WRAP_TO_EF_APIS
136endif
137VBoxVMM_DEFS.darwin = VMM_R0_SWITCH_STACK
138
139VBoxVMM_INCS = \
140 include \
141 $(if-expr defined(VBOX_WITH_RAW_MODE),PATM,)
142VBoxVMM_ASINCS = .
143
144VBoxVMM_SOURCES = \
145 VBoxVMM.d \
146 VMMR3/CFGM.cpp \
147 VMMR3/CPUM.cpp \
148 VMMR3/CPUMR3CpuId.cpp \
149 VMMR3/CPUMR3Db.cpp \
150 VMMR3/CPUMDbg.cpp \
151 VMMR3/DBGF.cpp \
152 VMMR3/DBGFAddr.cpp \
153 VMMR3/DBGFAddrSpace.cpp \
154 VMMR3/DBGFBp.cpp \
155 VMMR3/DBGFCoreWrite.cpp \
156 VMMR3/DBGFCpu.cpp \
157 VMMR3/DBGFDisas.cpp \
158 VMMR3/DBGFInfo.cpp \
159 VMMR3/DBGFLog.cpp \
160 VMMR3/DBGFMem.cpp \
161 VMMR3/DBGFOS.cpp \
162 VMMR3/DBGFR3PlugIn.cpp \
163 VMMR3/DBGFReg.cpp \
164 VMMR3/DBGFStack.cpp \
165 VMMR3/DBGFR3Trace.cpp \
166 VMMR3/DBGFR3Type.cpp \
167 VMMR3/EM.cpp \
168 VMMR3/EMR3Dbg.cpp \
169 $(if $(VBOX_WITH_RAW_MODE),VMMR3/EMRaw.cpp) \
170 VMMR3/EMHM.cpp \
171 VMMR3/FTM.cpp \
172 VMMR3/GIM.cpp \
173 VMMR3/GIMHv.cpp \
174 VMMR3/GIMKvm.cpp \
175 VMMR3/GIMMinimal.cpp \
176 VMMR3/IEMR3.cpp \
177 VMMR3/IOM.cpp \
178 VMMR3/GMM.cpp \
179 VMMR3/MM.cpp \
180 VMMR3/MMHeap.cpp \
181 VMMR3/MMHyper.cpp \
182 VMMR3/MMPagePool.cpp \
183 VMMR3/MMUkHeap.cpp \
184 VMMR3/PDM.cpp \
185 VMMR3/PDMBlkCache.cpp \
186 VMMR3/PDMDevice.cpp \
187 VMMR3/PDMDevHlp.cpp \
188 VMMR3/PDMDevMiscHlp.cpp \
189 VMMR3/PDMDriver.cpp \
190 VMMR3/PDMLdr.cpp \
191 VMMR3/PDMCritSect.cpp \
192 VMMR3/PDMQueue.cpp \
193 VMMR3/PDMThread.cpp \
194 VMMR3/PGM.cpp \
195 VMMR3/PGMDbg.cpp \
196 VMMR3/PGMR3DbgA.asm \
197 VMMR3/PGMHandler.cpp \
198 VMMR3/PGMMap.cpp \
199 VMMR3/PGMPhys.cpp \
200 VMMR3/PGMPool.cpp \
201 VMMR3/PGMSavedState.cpp \
202 VMMR3/PGMSharedPage.cpp \
203 VMMR3/SELM.cpp \
204 VMMR3/SSM.cpp \
205 VMMR3/STAM.cpp \
206 VMMR3/TM.cpp \
207 VMMR3/TRPM.cpp \
208 VMMR3/VM.cpp \
209 VMMR3/VMEmt.cpp \
210 VMMR3/VMReq.cpp \
211 VMMR3/VMM.cpp \
212 VMMR3/VMMGuruMeditation.cpp \
213 VMMR3/VMMSwitcher.cpp \
214 VMMR3/VMMTests.cpp \
215 VMMR3/HM.cpp \
216 $(if-expr defined(VBOX_WITH_RAW_MODE), \
217 VMMR3/CSAM.cpp \
218 VMMR3/PATM.cpp \
219 VMMR3/PATMPatch.cpp \
220 VMMR3/PATMGuest.cpp \
221 VMMR3/PATMA.asm \
222 VMMR3/PATMSSM.cpp \
223 VMMR3/PATMR3Dbg.cpp \
224 ,) \
225 VMMAll/CPUMAllRegs.cpp \
226 VMMAll/CPUMAllMsrs.cpp \
227 VMMAll/CPUMStack.cpp \
228 VMMAll/DBGFAll.cpp \
229 VMMAll/HMAll.cpp \
230 VMMAll/IEMAll.cpp \
231 VMMAll/IEMAllAImpl.asm \
232 VMMAll/IEMAllAImplC.cpp \
233 VMMAll/IOMAll.cpp \
234 VMMAll/IOMAllMMIO.cpp \
235 VMMAll/MMAll.cpp \
236 VMMAll/MMAllHyper.cpp \
237 VMMAll/MMAllPagePool.cpp \
238 VMMAll/PDMAll.cpp \
239 VMMAll/PDMAllCritSect.cpp \
240 VMMAll/PDMAllCritSectRw.cpp \
241 VMMAll/PDMAllCritSectBoth.cpp \
242 VMMAll/PDMAllQueue.cpp \
243 VMMAll/PGMAll.cpp \
244 VMMAll/PGMAllHandler.cpp \
245 VMMAll/PGMAllMap.cpp \
246 VMMAll/PGMAllPhys.cpp \
247 VMMAll/PGMAllPool.cpp \
248 VMMAll/SELMAll.cpp \
249 VMMAll/EMAll.cpp \
250 VMMAll/EMAllA.asm \
251 VMMAll/FTMAll.cpp \
252 VMMAll/GIMAll.cpp \
253 VMMAll/GIMAllHv.cpp \
254 VMMAll/GIMAllKvm.cpp \
255 VMMAll/TMAll.cpp \
256 VMMAll/TMAllCpu.cpp \
257 VMMAll/TMAllReal.cpp \
258 VMMAll/TMAllVirtual.cpp \
259 VMMAll/TRPMAll.cpp \
260 VMMAll/VMAll.cpp \
261 VMMAll/VMMAll.cpp \
262 VMMAll/VMMAllA.asm \
263 $(if-expr defined(VBOX_WITH_RAW_MODE), \
264 VMMAll/CSAMAll.cpp \
265 VMMAll/PATMAll.cpp \
266 ,)
267ifdef VBOX_WITH_VUSB
268 VBoxVMM_SOURCES += VMMR3/PDMUsb.cpp
269endif
270ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
271 VBoxVMM_SOURCES += \
272 VMMR3/PDMAsyncCompletion.cpp \
273 VMMR3/PDMAsyncCompletionFile.cpp \
274 VMMR3/PDMAsyncCompletionFileFailsafe.cpp \
275 VMMR3/PDMAsyncCompletionFileNormal.cpp
276endif
277ifdef VBOX_WITH_NETSHAPER
278 VBoxVMM_SOURCES += \
279 VMMR3/PDMNetShaper.cpp \
280 VMMAll/PDMAllNetShaper.cpp
281endif
282ifdef VBOX_WITH_NEW_APIC
283 VBoxVMM_SOURCES += \
284 VMMR3/APIC.cpp \
285 VMMAll/APICAll.cpp
286endif
287ifdef VBOX_WITH_REM
288 VBoxVMM_SOURCES += \
289 VMMAll/REMAll.cpp
290endif
291ifdef VBOX_WITH_RAW_MODE
292 VBoxVMM_SOURCES.x86 += \
293 VMMSwitcher/32BitTo32Bit.asm \
294 VMMSwitcher/32BitToPAE.asm \
295 VMMSwitcher/PAETo32Bit.asm \
296 VMMSwitcher/PAEToPAE.asm
297 VBoxVMM_SOURCES.amd64 = \
298 VMMSwitcher/AMD64To32Bit.asm \
299 VMMSwitcher/AMD64ToPAE.asm
300endif
301VBoxVMM_SOURCES.x86 += \
302 VMMSwitcher/32BitToAMD64.asm \
303 VMMSwitcher/PAEToAMD64.asm \
304 VMMSwitcher/X86Stub.asm
305VBoxVMM_SOURCES.amd64 += \
306 VMMSwitcher/AMD64Stub.asm
307
308VBoxVMM_LIBS = \
309 $(PATH_STAGE_LIB)/DisasmR3$(VBOX_SUFF_LIB)
310ifdef VBOX_WITH_DEBUGGER
311 VBoxVMM_LIBS += \
312 $(PATH_STAGE_LIB)/Debugger$(VBOX_SUFF_LIB)
313endif
314VBoxVMM_LIBS += \
315 $(LIB_REM) \
316 $(LIB_RUNTIME)
317
318VBoxVMM_LIBS.win = $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib
319VBoxVMM_LDFLAGS.linux = -Wl,--no-undefined
320VBoxVMM_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxVMM.dylib
321VBoxVMM_LDFLAGS.solaris = -mimpure-text
322
323# SSM wish to know the build type, host os and arch.
324VMMR3/SSM.cpp_DEFS += \
325 KBUILD_TYPE=\"$(KBUILD_TYPE)\" \
326 KBUILD_TARGET=\"$(KBUILD_TARGET)\" \
327 KBUILD_TARGET_ARCH=\"$(KBUILD_TARGET_ARCH)\"
328
329
330#ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
331# ifeq ($(KBUILD_HOST), linux)
332#VBoxVMM_LIBS += aio
333# endif
334#endif
335
336if "$(USERNAME)" == "bird" && "$(KBUILD_TARGET)" == "win"
337 VBoxVMM_VMMAll/IEMAll.cpp_CXXFLAGS = /FAcs /Fa$(subst /,\\,$(outbase).cod)
338 VBoxVMM_VMMAll/PDMAllCritSect.cpp_CXXFLAGS = /FAcs /Fa$(subst /,\\,$(outbase).cod)
339endif
340
341$(call VBOX_SET_VER_INFO_DLL,VBoxVMM,VirtualBox VMM) # Version info / description.
342
343if "$(KBUILD_TARGET)" == "win" && !defined(VBOX_ONLY_EXTPACKS_USE_IMPLIBS)
344 #
345 # Debug type info hack for VMCPU, VM and similar.
346 #
347 # The microsoft linker seems to be using the last occurence of the structures
348 # when writing the module PDB file. So, we put the fully complete structures
349 # in a library which is at the end of the library list.
350 #
351 VBoxVMM_LIBS += $(VBoxVMMPdbTypeHack_1_TARGET)
352 VBoxVMM_LDFLAGS += /Export:PdbTypeHack
353
354 LIBRARIES += VBoxVMMPdbTypeHack
355 VBoxVMMPdbTypeHack_TEMPLATE = $(VBoxVMM_TEMPLATE)
356 VBoxVMMPdbTypeHack_SOURCES = VMMAll/AllPdbTypeHack.cpp
357 VBoxVMMPdbTypeHack_DEFS = $(VBoxVMM_DEFS)
358 VBoxVMMPdbTypeHack_DEFS.win = $(VBoxVMM_DEFS.win)
359 VBoxVMMPdbTypeHack_DEFS.win.x86 = $(VBoxVMM_DEFS.win.x86)
360 VBoxVMMPdbTypeHack_DEFS.win.amd64 = $(VBoxVMM_DEFS.win.amd64)
361 VBoxVMMPdbTypeHack_INCS = $(VBoxVMM_INCS)
362endif
363
364
365if defined(VBOX_WITH_RAW_MODE) && $(intersects $(VBOX_LDR_FMT32), pe lx)
366
367 #
368 # VMMRCBuiltin.lib
369 #
370 LIBRARIES += VMMRCBuiltin
371 VMMRCBuiltin_TEMPLATE = VBoxRc
372 ifeq ($(VBOX_LDR_FMT32),pe)
373 VMMRCBuiltin_SOURCES = VMMRC/VMMRCBuiltin.def
374 endif
375 ifeq ($(VBOX_LDR_FMT32),lx)
376 VMMRCBuiltin_SOURCES = $(VMMRCBuiltin_0_OUTDIR)/VMMRCBuiltin.def
377 $$(VMMRCBuiltin_0_OUTDIR)/VMMRCBuiltin.def: $(PATH_SUB_CURRENT)/VMMRC/VMMRCBuiltin.def | $$(dir $$@)
378 $(SED) -e '/not-os2/d' -e 's/^[ \t][ \t]*\([a-zA-Z]\)/ _\1/' -e 's/[ \t]DATA[ \t]*/ /' --output $@ $<
379 endif
380
381
382 #
383 # VMMRCImp.lib
384 #
385 LIBRARIES += VMMRCImp
386 VMMRCImp_TEMPLATE = VBoxRc
387 VMMRCImp_SOURCES = $(VMMRCImp_0_OUTDIR)/VMMRC.def
388 VMMRCImp_CLEAN = $(VMMRCImp_0_OUTDIR)/VMMRC.def
389
390 $$(VMMRCImp_0_OUTDIR)/VMMRC.def: $(PATH_SUB_CURRENT)/VMMRC/VMMRC.def | $$(dir $$@)
391 ifeq ($(VBOX_LDR_FMT32),lx)
392 $(SED) \
393 -e '/not-os2/d' \
394 -e 's/^[ \t][ \t]*\([a-zA-Z]\)/ _\1/' \
395 -e 's/[ \t]DATA[ \t]*/ /' \
396 --output $@ \
397 $<
398 $(APPEND) "$@" ""
399 $(APPEND) "$@" " ___ehInit"
400 else
401 $(SED) \
402 -e '/not-win/d' \
403 -e '/not-$(KBUILD_TARGET_ARCH)/d' \
404 --output $@ $<
405 endif
406
407endif # RC && (pe || lx)
408
409
410if1of ($(VBOX_LDR_FMT), pe lx)
411 #
412 # VMMR0Imp.lib
413 #
414 LIBRARIES += VMMR0Imp
415 VMMR0Imp_TEMPLATE = VBoxR0
416 VMMR0Imp_SOURCES = $(VMMR0Imp_0_OUTDIR)/VMMR0.def
417 VMMR0Imp_CLEAN = $(VMMR0Imp_0_OUTDIR)/VMMR0.def
418 ifeq ($(KBUILD_TARGET),win) # Experiment: Let's see how blunt the ones messing our NULL_THUNK_DATA entries on W10 are.
419 VMMR0Imp_POST_CMDS = $(KLIBTWEAKER_EXT) --clear-timestamps --fill-null_thunk_data $(out)
420 endif
421
422 $$(VMMR0Imp_0_OUTDIR)/VMMR0.def: $(PATH_SUB_CURRENT)/VMMR0/VMMR0.def | $$(dir $$@)
423 ifeq ($(VBOX_LDR_FMT),lx)
424 $(SED) \
425 -e '/not-os2/d' \
426 -e '/not-amd64/d' \
427 -e 's/^[ \t][ \t]*\([a-zA-Z]\)/ _\1/' \
428 -e 's/[ \t]DATA[ \t]*/ /' \
429 --output $@ $<
430 $(APPEND) "$@" ""
431 $(APPEND) "$@" " ___ehInit"
432 else
433 $(SED) \
434 -e '/not-win/d' \
435 -e '/not-$(KBUILD_TARGET_ARCH)/d' \
436 --output $@ $<
437 endif
438endif # R0: pe + lx
439
440
441#
442# VMMR3Imp.lib
443#
444IMPORT_LIBS += VMMR3Imp
445$(call VBOX_GENERATE_IMPORT_TARGET_FN,VMMR3Imp,VBoxVMM,VMMR3/VMMR3.def)
446
447ifneq ($(VBOX_LIB_VMM_LAZY),$(LIB_VMM))
448 #
449 # VMMR3LazyImp.lib (experimental)
450 #
451 LIBRARIES += VMMR3LazyImp
452 VMMR3LazyImp_TEMPLATE = VBoxR3Dll
453 VMMR3LazyImp_INST = $(INST_LIB)
454 VMMR3LazyImp_SOURCES = $(VMMR3LazyImp_0_OUTDIR)/VMMR3LazyLoad.asm
455 VMMR3LazyImp_CLEAN = $(VMMR3LazyImp_0_OUTDIR)/VMMR3LazyLoad.asm
456 $$(VMMR3LazyImp_0_OUTDIR)/VMMR3LazyLoad.asm: $(PATH_SUB_CURRENT)/VMMR3/VMMR3.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
457 $(VBOX_DEF_2_LAZY_LOAD) --output $@ --library VBoxVMM $<
458endif
459
460
461if defined(VBOX_WITH_RAW_MODE) && !defined(VBOX_ONLY_EXTPACKS)
462 #
463 # VMMRC.rc
464 #
465 SYSMODS += VMMRC
466 VMMRC_TEMPLATE = VBoxRc
467 VMMRC_NAME = VMMRC
468
469 VMMRC_DEFS = IN_VMM_RC IN_RT_RC IN_DIS DIS_CORE_ONLY VBOX_WITH_RAW_MODE VBOX_WITH_RAW_MODE_NOT_R0 IN_SUP_RC \
470 $(VMM_COMMON_DEFS)
471 ifdef VBOX_WITH_VMM_R0_SWITCH_STACK
472 VMMRC_DEFS += VMM_R0_SWITCH_STACK
473 endif
474
475 VMMRC_INCS := \
476 include \
477 VMMRC \
478 $(if-expr defined(VBOX_WITH_RAW_MODE),PATM,)
479
480 VMMRC_LIBS = \
481 $(PATH_STAGE_LIB)/DisasmRC$(VBOX_SUFF_LIB) \
482 $(PATH_STAGE_LIB)/RuntimeRC$(VBOX_SUFF_LIB) \
483 $(PATH_STAGE_LIB)/SUPRC$(VBOX_SUFF_LIB)
484 ifneq ($(filter pe lx,$(VBOX_LDR_FMT32)),)
485 VMMRC_LIBS += \
486 $(PATH_STAGE_LIB)/VMMRCBuiltin$(VBOX_SUFF_LIB)
487 endif
488
489 VMMRC_SOURCES = \
490 VBoxVMM.d \
491 VMMRC/VMMRC0.asm \
492 VMMRC/VMMRCDeps.cpp \
493 VMMRC/CPUMRC.cpp \
494 VMMRC/CPUMRCA.asm \
495 VMMRC/CPUMRCPatchHlp.asm \
496 VMMRC/EMRCA.asm \
497 VMMRC/IOMRC.cpp \
498 VMMRC/MMRamRC.cpp \
499 VMMRC/MMRamRCA.asm \
500 VMMRC/PDMRCDevice.cpp \
501 VMMRC/PGMRC.cpp \
502 VMMRC/SELMRC.cpp \
503 VMMRC/TRPMRC.cpp \
504 VMMRC/TRPMRCHandlers.cpp \
505 VMMRC/TRPMRCHandlersA.asm \
506 VMMRC/VMMRC.cpp \
507 VMMRC/VMMRCA.asm \
508 $(if-expr defined(VBOX_WITH_RAW_MODE), \
509 VMMRC/CSAMRC.cpp \
510 VMMRC/PATMRC.cpp \
511 ,) \
512 VMMRZ/CPUMRZ.cpp \
513 VMMRZ/CPUMRZA.asm \
514 VMMRZ/DBGFRZ.cpp \
515 VMMRZ/PGMRZDynMap.cpp \
516 VMMRZ/VMMRZ.cpp \
517 VMMAll/CPUMAllRegs.cpp \
518 VMMAll/CPUMAllMsrs.cpp \
519 VMMAll/DBGFAll.cpp \
520 VMMAll/IEMAll.cpp \
521 VMMAll/IEMAllAImpl.asm \
522 VMMAll/IEMAllAImplC.cpp \
523 VMMAll/IOMAll.cpp \
524 VMMAll/IOMAllMMIO.cpp \
525 VMMAll/EMAll.cpp \
526 VMMAll/EMAllA.asm \
527 VMMAll/FTMAll.cpp \
528 VMMAll/GIMAll.cpp \
529 VMMAll/GIMAllHv.cpp \
530 VMMAll/GIMAllKvm.cpp \
531 VMMAll/MMAll.cpp \
532 VMMAll/MMAllHyper.cpp \
533 VMMAll/PDMAll.cpp \
534 VMMAll/PDMAllCritSect.cpp \
535 VMMAll/PDMAllCritSectRw.cpp \
536 VMMAll/PDMAllCritSectBoth.cpp \
537 VMMAll/PDMAllQueue.cpp \
538 VMMAll/PGMAll.cpp \
539 VMMAll/PGMAllHandler.cpp \
540 VMMAll/PGMAllMap.cpp \
541 VMMAll/PGMAllPhys.cpp \
542 VMMAll/PGMAllPool.cpp \
543 VMMAll/SELMAll.cpp \
544 VMMAll/TMAll.cpp \
545 VMMAll/TMAllCpu.cpp \
546 VMMAll/TMAllReal.cpp \
547 VMMAll/TMAllVirtual.cpp \
548 VMMAll/TRPMAll.cpp \
549 VMMAll/VMAll.cpp \
550 VMMAll/VMMAll.cpp \
551 VMMAll/VMMAllA.asm \
552 $(if-expr defined(VBOX_WITH_RAW_MODE), \
553 VMMAll/CSAMAll.cpp \
554 VMMAll/PATMAll.cpp \
555 ,)
556 ifeq ($(VBOX_LDR_FMT32),pe)
557 VMMRC_SOURCES += VMMRC/VMMRC.def
558 endif
559 ifeq ($(VBOX_LDR_FMT32),lx)
560 VMMRC_SOURCES += $(VMMRCImp_0_OUTDIR)/VMMRC.def
561 endif
562 ifdef VBOX_WITH_NEW_APIC
563 VMMRC_SOURCES += \
564 VMMAll/APICAll.cpp
565 endif
566 ifdef VBOX_WITH_REM
567 VMMRC_SOURCES += \
568 VMMAll/REMAll.cpp
569 endif
570
571 # The very last one.
572 VMMRC_SOURCES += \
573 VMMRC/VMMRC99.asm
574
575 VMMRC/VMMRCDeps.cpp_CXXFLAGS.win = -Oi- -TC ## @todo rename VMMRCDeps.cpp to .c
576
577 $(call VBOX_SET_VER_INFO_RC,VMMRC,VirtualBox VMM - raw-mode context parts) # Version info / description.
578
579 if "$(USERNAME)" == "bird" && "$(KBUILD_TARGET)" == "win"
580 VMMRC_VMMAll/IEMAll.cpp_CXXFLAGS = /FAcs /Fa$(subst /,\\,$(outbase).cod)
581 endif
582
583 if "$(KBUILD_TARGET)" == "win"
584 # Debug type info hack for VMCPU, VM and similar. See VBoxVMM for details.
585 VMMRC_LIBS += $(VMMRCPdbTypeHack_1_TARGET)
586 VMMRC_LDFLAGS += /Export:PdbTypeHack
587
588 LIBRARIES += VMMRCPdbTypeHack
589 VMMRCPdbTypeHack_TEMPLATE = $(VMMRC_TEMPLATE)
590 VMMRCPdbTypeHack_SOURCES = VMMAll/AllPdbTypeHack.cpp
591 VMMRCPdbTypeHack_DEFS = $(VMMRC_DEFS)
592 VMMRCPdbTypeHack_DEFS.win = $(VMMRC_DEFS.win)
593 VMMRCPdbTypeHack_DEFS.win.x86 = $(VMMRC_DEFS.win.x86)
594 VMMRCPdbTypeHack_DEFS.win.amd64 = $(VMMRC_DEFS.win.amd64)
595 VMMRCPdbTypeHack_INCS = $(VMMRC_INCS)
596 endif
597
598endif # VBOX_WITH_RAW_MODE && !VBOX_ONLY_EXTPACKS
599
600
601ifndef VBOX_ONLY_EXTPACKS
602 #
603 # VMMR0.r0
604 #
605 SYSMODS += VMMR0
606 VMMR0_TEMPLATE = VBoxR0
607 VMMR0_SYSSUFF = .r0
608
609 VMMR0_DEFS = IN_VMM_R0 IN_RT_R0 IN_DIS DIS_CORE_ONLY IN_GVMM_R0 IN_GMM_R0 IN_INTNET_R0 \
610 $(VMM_COMMON_DEFS) RTASSERT_HAVE_SHOULD_PANIC
611 ## @todo eliminate IN_GVMM_R0 IN_GMM_R0
612 ifdef VBOX_WITH_PCI_PASSTHROUGH
613 VMMR0_DEFS += IN_PCIRAW_R0
614 endif
615 ifdef VBOX_WITH_TRIPLE_FAULT_HACK
616 VMMR0_DEFS += VBOX_WITH_TRIPLE_FAULT_HACK
617 endif
618 ifdef VBOX_WITH_RAW_MODE
619 VMMR0_DEFS += VBOX_WITH_RAW_MODE
620 endif
621 ifdef VBOX_WITH_VMM_R0_SWITCH_STACK
622 VMMR0_DEFS += VMM_R0_SWITCH_STACK
623 endif
624 if1of ($(KBUILD_TARGET), darwin linux win)
625 VMMR0_DEFS += VMM_R0_TOUCH_FPU
626 endif
627 VMMR0_DEFS.darwin = VMM_R0_SWITCH_STACK
628 VMMR0_DEFS.win.amd64 = VBOX_WITH_KERNEL_USING_XMM
629
630 ifeq ($(VBOX_LDR_FMT),elf)
631 VMMR0_CXXFLAGS += -Wunused -Wunused-variable -Wno-unused-parameter
632 endif
633
634 VMMR0_INCS = \
635 include \
636 $(if-expr defined(VBOX_WITH_RAW_MODE),PATM,)
637
638 VMMR0_SOURCES = \
639 VBoxVMM.d \
640 VMMR0/CPUMR0.cpp \
641 VMMR0/CPUMR0A.asm \
642 VMMR0/GIMR0.cpp \
643 VMMR0/GIMR0Hv.cpp \
644 VMMR0/GIMR0Kvm.cpp \
645 VMMR0/GMMR0.cpp \
646 VMMR0/GVMMR0.cpp \
647 VMMR0/HMR0.cpp \
648 VMMR0/HMR0A.asm \
649 VMMR0/HMVMXR0.cpp \
650 VMMR0/HMSVMR0.cpp \
651 VMMR0/PDMR0Device.cpp \
652 VMMR0/PDMR0Driver.cpp \
653 VMMR0/PGMR0.cpp \
654 VMMR0/PGMR0SharedPage.cpp \
655 VMMR0/TRPMR0.cpp \
656 VMMR0/TRPMR0A.asm \
657 VMMR0/VMMR0.cpp \
658 VMMRZ/CPUMRZ.cpp \
659 VMMRZ/CPUMRZA.asm \
660 VMMRZ/DBGFRZ.cpp \
661 VMMRZ/VMMRZ.cpp \
662 VMMAll/CPUMAllRegs.cpp \
663 VMMAll/CPUMAllMsrs.cpp \
664 VMMAll/CPUMStack.cpp \
665 VMMAll/DBGFAll.cpp \
666 VMMAll/EMAll.cpp \
667 VMMAll/EMAllA.asm \
668 VMMAll/FTMAll.cpp \
669 VMMAll/GIMAll.cpp \
670 VMMAll/GIMAllHv.cpp \
671 VMMAll/GIMAllKvm.cpp \
672 VMMAll/HMAll.cpp \
673 VMMAll/IEMAll.cpp \
674 VMMAll/IEMAllAImpl.asm \
675 VMMAll/IEMAllAImplC.cpp \
676 VMMAll/IOMAll.cpp \
677 VMMAll/IOMAllMMIO.cpp \
678 VMMAll/MMAll.cpp \
679 VMMAll/MMAllHyper.cpp \
680 VMMAll/MMAllPagePool.cpp \
681 VMMAll/PDMAll.cpp \
682 VMMAll/PDMAllCritSect.cpp \
683 VMMAll/PDMAllCritSectRw.cpp \
684 VMMAll/PDMAllCritSectBoth.cpp \
685 VMMAll/PDMAllQueue.cpp \
686 VMMAll/PGMAll.cpp \
687 VMMAll/PGMAllHandler.cpp \
688 VMMAll/PGMAllMap.cpp \
689 VMMAll/PGMAllPhys.cpp \
690 VMMAll/PGMAllPool.cpp \
691 VMMAll/SELMAll.cpp \
692 VMMAll/TMAll.cpp \
693 VMMAll/TMAllCpu.cpp \
694 VMMAll/TMAllReal.cpp \
695 VMMAll/TMAllVirtual.cpp \
696 VMMAll/TRPMAll.cpp \
697 VMMAll/VMAll.cpp \
698 VMMAll/VMMAll.cpp \
699 VMMAll/VMMAllA.asm
700 if1of ($(VBOX_LDR_FMT), pe lx)
701 VMMR0_SOURCES += $(VMMR0Imp_0_OUTDIR)/VMMR0.def
702 endif
703 ifdef VBOX_WITH_TRIPLE_FAULT_HACK
704 VMMR0_SOURCES += \
705 VMMR0/VMMR0TripleFaultHack.cpp \
706 VMMR0/VMMR0TripleFaultHackA.asm
707 endif
708 ifdef VBOX_WITH_NETSHAPER
709 VMMR0_SOURCES += \
710 VMMAll/PDMAllNetShaper.cpp
711 endif
712 ifdef VBOX_WITH_NEW_APIC
713 VMMR0_SOURCES += \
714 VMMAll/APICAll.cpp
715 endif
716 ifdef VBOX_WITH_REM
717 VMMR0_SOURCES += \
718 VMMAll/REMAll.cpp
719 endif
720 VMMR0_SOURCES.amd64 = \
721 VMMR0/VMMR0JmpA-amd64.asm
722 VMMR0_SOURCES.x86 = \
723 VMMR0/VMMR0JmpA-x86.asm
724
725 VMMR0_LIBS = \
726 $(PATH_STAGE_LIB)/ServicesR0$(VBOX_SUFF_LIB) \
727 $(PATH_STAGE_LIB)/RuntimeR0$(VBOX_SUFF_LIB) \
728 $(PATH_STAGE_LIB)/DisasmR0$(VBOX_SUFF_LIB)
729 ifneq ($(filter pe lx,$(VBOX_LDR_FMT)),)
730 VMMR0_LIBS += \
731 $(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
732 endif
733
734 $(call VBOX_SET_VER_INFO_R0,VMMR0,VirtualBox VMM - ring-0 context parts) # Version info / description.
735
736 if "$(USERNAME)" == "bird" && "$(KBUILD_TARGET)" == "win"
737 VMMR0_VMMAll/IEMAll.cpp_CXXFLAGS = /FAcs /Fa$(subst /,\\,$(outbase).cod)
738 endif
739
740 if "$(KBUILD_TARGET)" == "win"
741 # Debug type info hack for VMCPU, VM and similar. See VBoxVMM for details.
742 VMMR0_LIBS += $(VMMR0PdbTypeHack_1_TARGET)
743 VMMR0_LDFLAGS += /Export:PdbTypeHack
744
745 LIBRARIES += VMMR0PdbTypeHack
746 VMMR0PdbTypeHack_TEMPLATE = $(VMMR0_TEMPLATE)
747 VMMR0PdbTypeHack_SOURCES = VMMAll/AllPdbTypeHack.cpp
748 VMMR0PdbTypeHack_DEFS = $(VMMR0_DEFS)
749 VMMR0PdbTypeHack_DEFS.win = $(VMMR0_DEFS.win)
750 VMMR0PdbTypeHack_DEFS.win.x86 = $(VMMR0_DEFS.win.x86)
751 VMMR0PdbTypeHack_DEFS.win.amd64 = $(VMMR0_DEFS.win.amd64)
752 VMMR0PdbTypeHack_INCS = $(VMMR0_INCS)
753 endif
754
755endif # !VBOX_ONLY_EXTPACKS
756
757
758
759ifndef VBOX_ONLY_EXTPACKS
760 #
761 # SSMStandalone.lib/a for linking with VBoxSVC and other executables.
762 #
763 LIBRARIES += SSMStandalone
764 SSMStandalone_TEMPLATE = VBOXR3EXE
765 SSMStandalone_DEFS = IN_VMM_R3 IN_VMM_STATIC SSM_STANDALONE CPUM_DB_STANDALONE
766 SSMStandalone_INCS = include
767 SSMStandalone_SOURCES = \
768 VMMR3/SSM.cpp \
769 VMMR3/CPUMR3Db.cpp
770endif # !VBOX_ONLY_EXTPACKS
771
772
773if !defined(VBOX_ONLY_EXTPACKS) \
774 && ( defined(VBOX_WITH_DTRACE_R3) \
775 || defined(VBOX_WITH_DTRACE_R0) \
776 || defined(VBOX_WITH_DTRACE_RC))
777 #
778 # Install the dtrace library files.
779 #
780 INSTALLS += VMMLibDTrace
781 VMMLibDTrace_INST = $(VBOX_INST_DTRACE_LIB)$(KBUILD_TARGET_ARCH)/
782 VMMLibDTrace_SOURCES = \
783 dtrace/lib/vbox-types.d \
784 dtrace/lib/$(KBUILD_TARGET_ARCH)/vbox-arch-types.d \
785 $(VMMLibDTrace_0_OUTDIR)/vm.d \
786 $(VMMLibDTrace_0_OUTDIR)/cpumctx.d \
787 $(VMMLibDTrace_0_OUTDIR)/cpum.d \
788 $(VMMLibDTrace_0_OUTDIR)/CPUMInternal.d \
789 $(VMMLibDTrace_0_OUTDIR)/x86.d \
790
791
792 ##
793 # Turn the header $2 into the DTrace library script $1.
794 #
795 define def_vmm_lib_dtrace_preprocess
796 $$$$(VMMLibDTrace_0_OUTDIR)/$1: $2 $$(VBOX_VBOXCPP) | $$$$(dir $$$$@)
797 $$(QUIET)$$(call MSG_GENERATE,VMMLibDTrace,$$@,$$<)
798 $$(QUIET)$(VBOX_VBOXCPP) -d \
799 -D VBOX_FOR_DTRACE_LIB \
800 -D VBOX_FOR_DTRACE_LIB_$(toupper $(KBUILD_TARGET_ARCH)) \
801 -D IN_RING0 \
802 -D RT_C_DECLS_BEGIN= \
803 -D RT_C_DECLS_END= \
804 -D 'RCPTRTYPE(a_Type)=RTRCPTR' \
805 -D 'R3PTRTYPE(a_Type)=RTR3PTR' \
806 -D 'R0PTRTYPE(a_Type)=a_Type' \
807 -D 'AssertCompile(a_Expr)=' \
808 -D 'AssertCompileSize(a_Stuct, a_Size)=' \
809 -D 'bool=uint8_t' \
810 $$(foreach def,\
811 $$(DEFS) \
812 $$(DEFS.$$(KBUILD_TARGET)) \
813 $$(DEFS.$(KBUILD_TARGET_ARCH)) \
814 $$(VMM_COMMON_DEFS) \
815 $$(ARCH_BITS_DEFS)\
816 ,-D '$$(def)') \
817 $$< \
818 $$@
819 $$(QUIET)$$(CHMOD) 644 $$@
820 endef
821 $(evalcall2 def_vmm_lib_dtrace_preprocess,vm.d,$(PATH_ROOT)/include/VBox/vmm/vm.h)
822 $(evalcall2 def_vmm_lib_dtrace_preprocess,cpumctx.d,$(PATH_ROOT)/include/VBox/vmm/cpumctx.h)
823 $(evalcall2 def_vmm_lib_dtrace_preprocess,cpum.d,$(PATH_ROOT)/include/VBox/vmm/cpum.h)
824 $(evalcall2 def_vmm_lib_dtrace_preprocess,CPUMInternal.d,$(PATH_SUB_CURRENT)/include/CPUMInternal.h)
825 $(evalcall2 def_vmm_lib_dtrace_preprocess,x86.d,$(PATH_ROOT)/include/iprt/x86.h)
826
827endif
828
829
830
831#
832# For vmmGetSvnRev.
833#
834VMMAll/VMMAll.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
835
836#
837# Disable annoying warnings about array subscript above array bounds in aPages[]
838#
839ifneq ($(KBUILD_TARGET),win)
840 VMMR3/PGMPool.cpp_CXXFLAGS = $(VBOX_GCC_Wno-array_bounds)
841 VMMAll/PGMAllPool.cpp_CXXFLAGS = $(VBOX_GCC_Wno-array_bounds)
842 VMMAll/PGMAll.cpp_CXXFLAGS = -Wno-unused-function
843 VMMAll/IEMAll.cpp_CXXFLAGS = -Wno-unused-function
844 VMMR0/GMMR0.cpp_CXXFLAGS = -Wno-unused-value
845endif
846
847#
848# Always optimize the interpreter.
849#
850if $(USERNAME) != "bird" || "$(KBUILD_TYPE)" == "release" #|| "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64"
851 if1of ($(KBUILD_TARGET), win)
852 # -noover is recognized despite the statement saying otherwise. It silences these warnings:
853 # cl : Command line warning D9025 : overriding '/Od' with '/O2'
854 # cl : Command line warning D9025 : overriding '/Oy-' with '/Oy'
855 VMMAll/IEMAll.cpp_CXXFLAGS += -noover -O2xy
856 else
857 VMMAll/IEMAll.cpp_CXXFLAGS += -O2
858 #VMMAll/IEMAll.cpp_CXXFLAGS += -fno-align-functions -fno-align-jumps -fno-align-loops # Saves a few of percents, not worth it.
859 #VMMAll/IEMAll.cpp_CXXFLAGS += -fno-reorder-blocks # Saves one or two percent ... never mind.
860 VMMAll/IEMAll.cpp_CXXFLAGS += -fomit-frame-pointer # Omitting the frame pointer results in larger code, but it might be worth it. (esp addressing vs ebp?)
861 endif
862endif # bird wants good stacks
863
864
865# Alias the CPU database entries.
866$(foreach base,$(notdir $(basename $(wildcard $(PATH_SUB_CURRENT)/VMMR3/cpus/*.h))), $(eval $(base).o $(base).obj: CPUMR3Db.o))
867
868
869#
870# Test for undefined symbols.
871#
872if1of ($(SYSMODS),VMMRC)
873 test-undef-rc:: $(PATH_TARGET)/undef-rc.run
874 OTHERS += $(PATH_TARGET)/undef-rc.run
875 CLEANS += $(PATH_TARGET)/undef-rc.run
876 $(PATH_TARGET)/undef-rc.run: \
877 $$(VMMRC_1_TARGET)
878 ifn1of ($(KBUILD_TARGET), linux solaris)
879 else
880 $(call MSG_L1,VMM: Testing for undefined symbols in VMMRC using nm...)
881 $(QUIET)$(VBOX_NM) $^ 2> /dev/null \
882 | $(SED) -n \
883 -e '/^ *U .*/!d' \
884 -e 's/ *U //' \
885 \
886 -e '/^g_VM\>/d'\
887 -e '/^g_CPUM\>/d'\
888 -e '/^g_Logger\>/d'\
889 -e '/^g_RelLogger\>/d'\
890 -e '/^g_TRPM\>/d'\
891 -e '/^g_TRPMCPU\>/d'\
892 -e '/^g_pSUPGlobalInfoPage\>/d'\
893 -e '/^g_trpmHyperCtxCore\>/d' \
894 -e '/^g_trpmGuestCtxCore\>/d' \
895 \
896 -e 's/\(.*\)$(DOLLAR)/ Undefined symbol: \1/' \
897 -e 'p' \
898 -e 'q 1'
899 endif
900 $(QUIET)$(APPEND) -t $@
901endif
902
903include $(FILE_KBUILD_SUB_FOOTER)
904
905
906# Alias the PGM templates to the object in which they are defined.
907PGMInternal.o \
908PGMBth.o PGMGst.o PGMShw.o \
909PGMBth.obj PGMGst.obj PGMShw.obj: PGM.o
910
911PGMAllBth.o PGMAllGst.o PGMAllShw.o \
912PGMAllBth.obj PGMAllGst.obj PGMAllShw.obj: PGMAll.o
913
914PGMRCBth.o PGMRCGst.o PGMRCShw.o \
915PGMRCBth.obj PGMRCGst.obj PGMRCShw.obj: PGMRC.o
916
917PGMPhysRWTmpl.o PGMPhysRWTmpl.obj: PGMPhys.o
918
919PGMInline.o PGMInline.obj: PGMDbg.o
920
921# Alias the IEM templates to the object in which they are instantiated.
922IEMInternal.o \
923IEMAllInstructions.cpp.o IEMAllInstructions.cpp.obj \
924IEMAllCImpl.cpp.o IEMAllCImpl.cpp.obj \
925IEMAllCImplStrInstr.cpp.o IEMAllCImplStrInstr.cpp.obj: IEMAll.o
926
927# Alias the switcher templates.
928PAEand32Bit.o PAEand32Bit.obj: PAETo32Bit.o PAEToPAE.o 32BitTo32Bit.o PAETo32Bit.o
929LegacyandAMD64.o LegacyandAMD64.obj: 32BitToAMD64.o PAEToAMD64.o
930AMD64andLegacy.o AMD64andLegacy.obj: AMD64To32Bit.o AMD64ToPAE.o
931
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