VirtualBox

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

Last change on this file since 86651 was 86121, checked in by vboxsync, 4 years ago

VMM/GIM: Fix handling KVM system-time struct. to work from both ring-0 and ring-3 (earlier it relied on MSR writes being handled in ring-0).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 25.1 KB
Line 
1# $Id: Makefile.kmk 86121 2020-09-14 16:56:09Z vboxsync $
2## @file
3# Top-level makefile for the VMM.
4#
5
6#
7# Copyright (C) 2006-2020 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 our Config.kmk if kmk is invoked from a parent directory.
22ifndef VBOX_VMM_CONFIG_KMK_INCLUDED
23 include $(PATH_SUB_CURRENT)/Config.kmk
24endif
25
26# Include sub-makefiles.
27ifndef VBOX_ONLY_EXTPACKS
28 include $(PATH_SUB_CURRENT)/tools/Makefile.kmk
29 include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
30endif
31
32
33# Fail on unsupported hosts.
34ifeq ($(KBUILD_TARGET_ARCH),x86)
35 ifeq ($(KBUILD_TARGET),darwin)
36$(error 32-bit darwin is no longer a supported VirtualBox host. Go back to 4.3 or older for 32-bit host support.)
37 else ifeq ($(KBUILD_TARGET),solaris)
38$(error 32-bit solaris is no longer a supported VirtualBox host. Go back to 4.2 or older for 32-bit host support.)
39 else ifn1of ($(KBUILD_TARGET_ARCH), $(VBOX_SUPPORTED_HOST_ARCHS))
40$(error 32-bit builds of the VirtualBox host are no longer supported. Go back to 6.0 or older for 32-bit host support.)
41 endif
42endif
43
44
45#
46# The VMM DLL.
47#
48ifndef VBOX_ONLY_EXTPACKS_USE_IMPLIBS
49 DLLS += VBoxVMM
50endif
51VBoxVMM_TEMPLATE = VBoxR3DllNoPic
52VBoxVMM_SONAME.linux = VBoxVMM.so
53
54VBoxVMM_DEFS = VBOX_IN_VMM IN_VMM_R3 IN_DIS IN_GMM_R3 IN_DBG $(VMM_COMMON_DEFS)
55## @todo eliminate IN_GMM_R3
56ifdef VBOX_WITH_PREALLOC_RAM_BY_DEFAULT
57VBoxVMM_DEFS += VBOX_WITH_PREALLOC_RAM_BY_DEFAULT
58endif
59ifdef VBOX_WITH_VUSB
60VBoxVMM_DEFS += VBOX_WITH_USB
61endif
62ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
63VBoxVMM_DEFS += VBOX_WITH_PDM_ASYNC_COMPLETION
64endif
65ifdef VBOX_WITH_NETSHAPER
66VBoxVMM_DEFS += VBOX_WITH_NETSHAPER
67endif
68ifdef VBOX_WITH_IOMMU_AMD
69VBoxVMM_DEFS += VBOX_WITH_IOMMU_AMD
70endif
71ifdef VBOX_WITH_DBGF_TRACING
72VBoxVMM_DEFS += VBOX_WITH_DBGF_TRACING
73endif
74ifdef VBOX_WITH_VMM_R0_SWITCH_STACK
75VBoxVMM_DEFS += VMM_R0_SWITCH_STACK
76endif
77if "$(KBUILD_TYPE)" == "debug" && "$(USERNAME)" == "bird"
78VBoxVMM_DEFS += RTMEM_WRAP_TO_EF_APIS
79endif
80VBoxVMM_DEFS.darwin = VMM_R0_SWITCH_STACK
81
82VBoxVMM_INCS = \
83 include \
84 $(VBoxVMM_0_OUTDIR)/CommonGenIncs
85VBoxVMM_ASINCS = .
86
87VBoxVMM_SOURCES = \
88 VBoxVMM.d \
89 VMMR3/APIC.cpp \
90 VMMR3/CFGM.cpp \
91 VMMR3/CPUM.cpp \
92 VMMR3/CPUMR3CpuId.cpp \
93 VMMR3/CPUMR3Db.cpp \
94 VMMR3/CPUMDbg.cpp \
95 VMMR3/DBGF.cpp \
96 VMMR3/DBGFAddr.cpp \
97 VMMR3/DBGFAddrSpace.cpp \
98 VMMR3/DBGFBp.cpp \
99 VMMR3/DBGFR3BugCheck.cpp \
100 VMMR3/DBGFCoreWrite.cpp \
101 VMMR3/DBGFCpu.cpp \
102 VMMR3/DBGFDisas.cpp \
103 VMMR3/DBGFInfo.cpp \
104 VMMR3/DBGFLog.cpp \
105 VMMR3/DBGFMem.cpp \
106 VMMR3/DBGFR3ModInMem.cpp \
107 VMMR3/DBGFOS.cpp \
108 VMMR3/DBGFR3PlugIn.cpp \
109 VMMR3/DBGFReg.cpp \
110 VMMR3/DBGFStack.cpp \
111 VMMR3/DBGFR3Flow.cpp \
112 VMMR3/DBGFR3Trace.cpp \
113 $(if-expr defined(VBOX_WITH_DBGF_TRACING), VMMR3/DBGFR3Tracer.cpp,) \
114 VMMR3/DBGFR3Type.cpp \
115 VMMR3/EM.cpp \
116 VMMR3/EMR3Dbg.cpp \
117 VMMR3/EMHM.cpp \
118 VMMR3/EMR3Nem.cpp \
119 VMMR3/GIM.cpp \
120 VMMR3/GIMHv.cpp \
121 VMMR3/GIMKvm.cpp \
122 VMMR3/GIMMinimal.cpp \
123 VMMR3/IEMR3.cpp \
124 VMMR3/IOM.cpp \
125 VMMR3/IOMR3IoPort.cpp \
126 VMMR3/IOMR3Mmio.cpp \
127 VMMR3/GMM.cpp \
128 VMMR3/MM.cpp \
129 VMMR3/MMHeap.cpp \
130 VMMR3/MMHyper.cpp \
131 VMMR3/MMPagePool.cpp \
132 VMMR3/MMUkHeap.cpp \
133 VMMR3/NEMR3.cpp \
134 VMMR3/PDM.cpp \
135 VMMR3/PDMBlkCache.cpp \
136 VMMR3/PDMDevice.cpp \
137 VMMR3/PDMDevHlp.cpp \
138 $(if-expr defined(VBOX_WITH_DBGF_TRACING), VMMR3/PDMDevHlpTracing.cpp,) \
139 VMMR3/PDMDevMiscHlp.cpp \
140 VMMR3/PDMDriver.cpp \
141 VMMR3/PDMLdr.cpp \
142 VMMR3/PDMCritSect.cpp \
143 VMMR3/PDMQueue.cpp \
144 VMMR3/PDMR3Task.cpp \
145 VMMR3/PDMThread.cpp \
146 VMMR3/PGM.cpp \
147 VMMR3/PGMDbg.cpp \
148 VMMR3/PGMR3DbgA.asm \
149 VMMR3/PGMHandler.cpp \
150 VMMR3/PGMMap.cpp \
151 VMMR3/PGMPhys.cpp \
152 VMMR3/PGMPool.cpp \
153 VMMR3/PGMSavedState.cpp \
154 VMMR3/PGMSharedPage.cpp \
155 VMMR3/SELM.cpp \
156 VMMR3/SSM.cpp \
157 VMMR3/STAM.cpp \
158 VMMR3/TM.cpp \
159 VMMR3/TRPM.cpp \
160 VMMR3/VM.cpp \
161 VMMR3/VMEmt.cpp \
162 VMMR3/VMReq.cpp \
163 VMMR3/VMM.cpp \
164 VMMR3/VMMGuruMeditation.cpp \
165 VMMR3/VMMTests.cpp \
166 VMMR3/HM.cpp \
167 VMMAll/APICAll.cpp \
168 VMMAll/CPUMAllRegs.cpp \
169 VMMAll/CPUMAllMsrs.cpp \
170 VMMAll/DBGFAll.cpp \
171 $(if-expr defined(VBOX_WITH_DBGF_TRACING), VMMAll/DBGFAllTracer.cpp,) \
172 VMMAll/HMAll.cpp \
173 VMMAll/HMSVMAll.cpp \
174 VMMAll/HMVMXAll.cpp \
175 VMMAll/IEMAll.cpp \
176 VMMAll/IEMAllAImpl.asm \
177 VMMAll/IEMAllAImplC.cpp \
178 VMMAll/IOMAll.cpp \
179 VMMAll/IOMAllMmioNew.cpp \
180 VMMAll/MMAll.cpp \
181 VMMAll/MMAllHyper.cpp \
182 VMMAll/NEMAll.cpp \
183 VMMAll/PDMAll.cpp \
184 VMMAll/PDMAllCritSect.cpp \
185 VMMAll/PDMAllCritSectRw.cpp \
186 VMMAll/PDMAllCritSectBoth.cpp \
187 VMMAll/PDMAllQueue.cpp \
188 VMMAll/PDMAllTask.cpp \
189 VMMAll/PGMAll.cpp \
190 VMMAll/PGMAllHandler.cpp \
191 VMMAll/PGMAllMap.cpp \
192 VMMAll/PGMAllPhys.cpp \
193 VMMAll/PGMAllPool.cpp \
194 VMMAll/SELMAll.cpp \
195 VMMAll/EMAll.cpp \
196 VMMAll/GIMAll.cpp \
197 VMMAll/GIMAllHv.cpp \
198 VMMAll/GIMAllKvm.cpp \
199 VMMAll/TMAll.cpp \
200 VMMAll/TMAllCpu.cpp \
201 VMMAll/TMAllReal.cpp \
202 VMMAll/TMAllVirtual.cpp \
203 VMMAll/TRPMAll.cpp \
204 VMMAll/VMAll.cpp \
205 VMMAll/VMMAll.cpp \
206 VMMAll/VMMAllA.asm
207ifdef VBOX_WITH_VUSB
208VBoxVMM_SOURCES += VMMR3/PDMUsb.cpp
209endif
210ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
211VBoxVMM_SOURCES += \
212 VMMR3/PDMAsyncCompletion.cpp \
213 VMMR3/PDMAsyncCompletionFile.cpp \
214 VMMR3/PDMAsyncCompletionFileFailsafe.cpp \
215 VMMR3/PDMAsyncCompletionFileNormal.cpp
216endif
217ifdef VBOX_WITH_NETSHAPER
218VBoxVMM_SOURCES += \
219 VMMR3/PDMNetShaper.cpp \
220 VMMAll/PDMAllNetShaper.cpp
221endif
222
223ifdef VBOX_WITH_NATIVE_NEM
224VBoxVMM_SOURCES.win.amd64 += VMMR3/NEMR3Native-win.cpp
225VBoxVMM_DEFS.win.amd64 += VBOX_WITH_NATIVE_NEM
226VBoxVMM_SDKS.win += VBOX_NTDLL
227VMMR3/NEMR3Native-win.cpp_DEFS.amd64 = _AMD64_
228VMMR3/NEMR3Native-win.cpp_INCS = \
229 $(KBUILD_DEVTOOLS)/win.x86/sdk/v10.0.17134.0/include/10.0.17134.0/um \
230 $(KBUILD_DEVTOOLS)/win.x86/sdk/v10.0.17134.0/include/10.0.17134.0/shared
231endif
232
233VBoxVMM_LIBS = \
234 $(PATH_STAGE_LIB)/DisasmR3$(VBOX_SUFF_LIB)
235ifdef VBOX_WITH_DEBUGGER
236VBoxVMM_LIBS += \
237 $(PATH_STAGE_LIB)/Debugger$(VBOX_SUFF_LIB)
238endif
239VBoxVMM_LIBS += \
240 $(LIB_REM) \
241 $(LIB_RUNTIME)
242
243VBoxVMM_LIBS.win = $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib
244VBoxVMM_LDFLAGS.linux = $(VBOX_GCC_NO_UNDEFINED)
245VBoxVMM_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxVMM.dylib
246VBoxVMM_LDFLAGS.solaris = -mimpure-text
247
248# SSM wish to know the build type, host os and arch.
249ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
250VMMR3/SSM.cpp_DEFS +=\
251 KBUILD_TYPE="$(KBUILD_TYPE)" \
252 KBUILD_TARGET="$(KBUILD_TARGET)" \
253 KBUILD_TARGET_ARCH="$(KBUILD_TARGET_ARCH)"
254else
255VMMR3/SSM.cpp_DEFS += \
256 KBUILD_TYPE=\"$(KBUILD_TYPE)\" \
257 KBUILD_TARGET=\"$(KBUILD_TARGET)\" \
258 KBUILD_TARGET_ARCH=\"$(KBUILD_TARGET_ARCH)\"
259endif
260
261ifdef VBOX_WITH_GCC_SANITIZER
262VMMR3/PGMPool.cpp_CXXFLAGS.linux += -fno-sanitize=address
263endif
264
265#ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
266# ifeq ($(KBUILD_HOST), linux)
267#VBoxVMM_LIBS += aio
268# endif
269#endif
270
271if "$(USERNAME)" == "bird" && "$(KBUILD_TARGET)" == "win"
272VBoxVMM_VMMAll/IEMAll.cpp_CXXFLAGS = /FAcs /Fa$(subst /,\\,$(outbase).cod)
273VBoxVMM_VMMAll/IEMAllAImplC.cpp_CXXFLAGS = /FAcs /Fa$(subst /,\\,$(outbase).cod)
274VBoxVMM_VMMAll/PGMAll.cpp_CXXFLAGS = /FAcs /Fa$(subst /,\\,$(outbase).cod)
275VBoxVMM_VMMAll/PDMAllCritSect.cpp_CXXFLAGS = /FAcs /Fa$(subst /,\\,$(outbase).cod)
276VBoxVMM_CLEAN += $(addprefix $(VBoxVMM_0_OUTDIR)/VMMAll/, IEMAll.cod IEMAllAImplC.cod PGMAll.cod PDMAllCritSect.cod)
277endif
278
279$(call VBOX_SET_VER_INFO_DLL,VBoxVMM,VirtualBox VMM) # Version info / description.
280
281
282#
283# Generate macro template for IEM instruction statistics.
284#
285$(call KB_FN_DO_PASS0_ON_TARGET,VBoxVMM) # Set VBoxVMM_0_OUTDIR
286VBoxVMM_INTERMEDIATES += $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMInstructionStatisticsTmpl.h
287VBoxVMM_CLEAN += \
288 $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMInstructionStatisticsTmpl.h.ts \
289 $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMInstructionStatisticsTmpl.h
290$(call KB_FN_AUTO_CMD_DEPS,$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMInstructionStatisticsTmpl.h.ts)
291$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMInstructionStatisticsTmpl.h.ts \
292+| $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMInstructionStatisticsTmpl.h: \
293 $(PATH_SUB_CURRENT)/VMMAll/IEMAllInstructions.cpp.h \
294 $(PATH_SUB_CURRENT)/VMMAll/IEMAllInstructionsOneByte.cpp.h \
295 $(PATH_SUB_CURRENT)/VMMAll/IEMAllInstructionsTwoByte0f.cpp.h \
296 $(PATH_SUB_CURRENT)/VMMAll/IEMAllInstructionsThree0f38.cpp.h \
297 $(PATH_SUB_CURRENT)/VMMAll/IEMAllInstructionsThree0f3a.cpp.h \
298 $(PATH_SUB_CURRENT)/VMMAll/IEMAllInstructionsVexMap1.cpp.h \
299 $(PATH_SUB_CURRENT)/VMMAll/IEMAllInstructionsVexMap2.cpp.h \
300 $(PATH_SUB_CURRENT)/VMMAll/IEMAllInstructionsVexMap3.cpp.h \
301 $(PATH_SUB_CURRENT)/VMMAll/IEMAllInstructions3DNow.cpp.h
302 $(QUIET)$(call MSG_GENERATE,VBoxVMM,$@,VMMAll/IEMAllInstructions*.cpp.h)
303 $(QUIET)$(RM) -f -- "[email protected]" "[email protected]" "[email protected]"
304 $(QUIET)$(MKDIR) -p -- "$(dir $@)"
305 $(call KB_FN_AUTO_CMD_DEPS_COMMANDS)
306 $(QUIET)$(SED) \
307 -e '/IEMOP_MNEMONIC\(\|[01234]\|[01234]EX\)(/!d' \
308 -e ':look-for-end-of-invocation' \
309 -e '/)/bend-of-invocation' \
310 -e 'N' \
311 -e 'blook-for-end-of-invocation' \
312 -e ':end-of-invocation' \
313 -e 's/\n/ /g' \
314 -e 's/ */ /g' \
315 -e 's/^.*IEMOP_MNEMONIC\(\|[01234]\|[01234]EX\)(/IEM_DO_INSTR_STAT\1(/' \
316 -e 's/;.*$(DOLLAR)//' \
317 --output "[email protected]" $(filter %.cpp.h,$^)
318# Windows sort does some kind of seeking. So, we must use a temporary file and kmk_cat to define and undefine our macros.
319 $(QUIET)$(REDIRECT) -wto "[email protected]" -- sort "[email protected]"
320 $(QUIET)$(APPEND) -nt "$@" \
321 '/* Warning autogenerated by VMM/Makefile.kmk. */ ' \
322 '#define IEM_DO_INSTR_STAT0(f,u,l,fd,fi) IEM_DO_INSTR_STAT(l, #l)' \
323 '#define IEM_DO_INSTR_STAT1(f,u,l,o1,fd,fi) IEM_DO_INSTR_STAT(l ## _ ## o1, #l " " #o1)' \
324 '#define IEM_DO_INSTR_STAT2(f,u,l,o1,o2,fd,fi) IEM_DO_INSTR_STAT(l ## _ ## o1 ## _ ## o2, #l " " #o1 "," #o2)' \
325 '#define IEM_DO_INSTR_STAT3(f,u,l,o1,o2,o3,fd,fi) IEM_DO_INSTR_STAT(l ## _ ## o1 ## _ ## o2 ## _ ## o3, #l " " #o1 "," #o2 "," #o3)' \
326 '#define IEM_DO_INSTR_STAT4(f,u,l,o1,o2,o3,o4,fd,fi) IEM_DO_INSTR_STAT(l ## _ ## o1 ## _ ## o2 ## _ ## o3 ## _ ## o4, #l " " #o1 "," #o2 "," #o3 "," #o4)' \
327 '#define IEM_DO_INSTR_STAT0EX(s,m,f,u,l,fd,fi) IEM_DO_INSTR_STAT(s,m)' \
328 '#define IEM_DO_INSTR_STAT1EX(s,m,f,u,l,o1,fd,fi) IEM_DO_INSTR_STAT(s,m)' \
329 '#define IEM_DO_INSTR_STAT2EX(s,m,f,u,l,o1,o2,fd,fi) IEM_DO_INSTR_STAT(s,m)' \
330 '#define IEM_DO_INSTR_STAT3EX(s,m,f,u,l,o1,o2,o3,fd,fi) IEM_DO_INSTR_STAT(s,m)' \
331 '#define IEM_DO_INSTR_STAT4EX(s,m,f,u,l,o1,o2,o3,o4,fd,fi) IEM_DO_INSTR_STAT(s,m)' \
332 ''
333 $(QUIET)$(REDIRECT) -ato "$@" -- $(CAT_EXT) "[email protected]"
334 $(QUIET)$(APPEND) -n "$@" \
335 '' \
336 '#undef IEM_DO_INSTR_STAT0' \
337 '#undef IEM_DO_INSTR_STAT1' \
338 '#undef IEM_DO_INSTR_STAT2' \
339 '#undef IEM_DO_INSTR_STAT3' \
340 '#undef IEM_DO_INSTR_STAT4' \
341 '#undef IEM_DO_INSTR_STAT0EX' \
342 '#undef IEM_DO_INSTR_STAT1EX' \
343 '#undef IEM_DO_INSTR_STAT2EX' \
344 '#undef IEM_DO_INSTR_STAT3EX' \
345 '#undef IEM_DO_INSTR_STAT4EX' \
346 ''
347 $(QUIET)$(RM) -f -- "[email protected]" "[email protected]"
348 $(QUIET)$(CP) -v -f --changed -- "$@" "$(patsubst %.ts,%,$@)"
349
350foobar: $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMInstructionStatisticsTmpl.h
351
352if "$(KBUILD_TARGET)" == "win" && !defined(VBOX_ONLY_EXTPACKS_USE_IMPLIBS)
353#
354# Debug type info hack for VMCPU, VM and similar.
355#
356# The microsoft linker seems to be using the last occurence of the structures
357# when writing the module PDB file. So, we put the fully complete structures
358# in a library which is at the end of the library list.
359#
360VBoxVMM_LIBS += $(VBoxVMMPdbTypeHack_1_TARGET)
361VBoxVMM_LDFLAGS += /Export:PdbTypeHack
362
363LIBRARIES += VBoxVMMPdbTypeHack
364VBoxVMMPdbTypeHack_TEMPLATE = $(VBoxVMM_TEMPLATE)
365VBoxVMMPdbTypeHack_SOURCES = VMMAll/AllPdbTypeHack.cpp
366VBoxVMMPdbTypeHack_DEFS = $(VBoxVMM_DEFS)
367VBoxVMMPdbTypeHack_DEFS.win = $(VBoxVMM_DEFS.win)
368VBoxVMMPdbTypeHack_DEFS.win.x86 = $(VBoxVMM_DEFS.win.x86)
369VBoxVMMPdbTypeHack_DEFS.win.amd64 = $(VBoxVMM_DEFS.win.amd64)
370VBoxVMMPdbTypeHack_INCS = $(VBoxVMM_INCS)
371VBoxVMMPdbTypeHack_INTERMEDIATES = $(VBoxVMM_INTERMEDIATES)
372endif
373
374
375if1of ($(VBOX_LDR_FMT), pe lx)
376#
377# VMMR0Imp.lib
378#
379LIBRARIES += VMMR0Imp
380VMMR0Imp_TEMPLATE = VBoxR0
381VMMR0Imp_SOURCES = $(VMMR0Imp_0_OUTDIR)/VMMR0.def
382VMMR0Imp_CLEAN = $(VMMR0Imp_0_OUTDIR)/VMMR0.def
383 ifeq ($(KBUILD_TARGET),win) # Experiment: Let's see how blunt the ones messing our NULL_THUNK_DATA entries on W10 are.
384VMMR0Imp_POST_CMDS = $(KLIBTWEAKER_EXT) --clear-timestamps --fill-null_thunk_data $(out)
385 endif
386$(call KB_FN_DO_PASS0_ON_TARGET,VMMR0Imp)
387
388$(call KB_FN_AUTO_CMD_DEPS,$(VMMR0Imp_0_OUTDIR)/VMMR0.def)
389$(VMMR0Imp_0_OUTDIR)/VMMR0.def: $(VMMR0Imp_DEFPATH)/VMMR0/VMMR0.def | $$(dir $$@)
390 $(call KB_FN_AUTO_CMD_DEPS_COMMANDS)
391 ifeq ($(VBOX_LDR_FMT),lx)
392 $(SED) \
393 -e '/not-os2/d' \
394 -e '/not-amd64/d' \
395 -e 's/^[ \t][ \t]*\([a-zA-Z]\)/ _\1/' \
396 -e 's/[ \t]DATA[ \t]*/ /' \
397 --output $@ $(VMMR0Imp_DEFPATH)/VMMR0/VMMR0.def
398 $(APPEND) "$@" ""
399 $(APPEND) "$@" " ___ehInit"
400 else
401 $(SED) \
402 -e '/not-win/d' \
403 -e '/not-$(KBUILD_TARGET_ARCH)/d' \
404 --output $@ $(VMMR0Imp_DEFPATH)/VMMR0/VMMR0.def
405 endif
406endif # R0: pe + lx
407
408
409#
410# VMMR3Imp.lib
411#
412IMPORT_LIBS += VMMR3Imp
413$(call VBOX_GENERATE_IMPORT_TARGET_FN,VMMR3Imp,VBoxVMM,VMMR3/VMMR3.def)
414
415ifneq ($(VBOX_LIB_VMM_LAZY),$(LIB_VMM))
416#
417# VMMR3LazyImp.lib (experimental)
418#
419LIBRARIES += VMMR3LazyImp
420VMMR3LazyImp_TEMPLATE = VBoxR3Dll
421VMMR3LazyImp_INST = $(INST_LIB)
422VMMR3LazyImp_SOURCES = $(VMMR3LazyImp_0_OUTDIR)/VMMR3LazyLoad.asm
423VMMR3LazyImp_CLEAN = $(VMMR3LazyImp_0_OUTDIR)/VMMR3LazyLoad.asm
424$(call KB_FN_DO_PASS0_ON_TARGET,VMMR3LazyImp)
425
426$(call KB_FN_AUTO_CMD_DEPS,$(VMMR3LazyImp_0_OUTDIR)/VMMR3LazyLoad.asm)
427$(VMMR3LazyImp_0_OUTDIR)/VMMR3LazyLoad.asm: $(VMMR3LazyImp_DEFPATH)/VMMR3/VMMR3.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
428 $(call KB_FN_AUTO_CMD_DEPS_COMMANDS)
429 $(VBOX_DEF_2_LAZY_LOAD) --output $@ --library VBoxVMM $(VMMR3LazyImp_DEFPATH)/VMMR3/VMMR3.def
430endif
431
432
433ifndef VBOX_ONLY_EXTPACKS
434#
435# VMMR0.r0
436#
437$(if-expr defined(VBOX_WITH_VBOXR0_AS_DLL),DLLS,SYSMODS) += VMMR0
438VMMR0_TEMPLATE = VBoxR0
439VMMR0_SYSSUFF = .r0
440
441VMMR0_DEFS = VBOX_IN_VMM IN_VMM_R0 IN_RT_R0 IN_DIS DIS_CORE_ONLY IN_GVMM_R0 IN_GMM_R0 IN_INTNET_R0 \
442 $(VMM_COMMON_DEFS) RTASSERT_HAVE_SHOULD_PANIC
443## @todo eliminate IN_GVMM_R0 IN_GMM_R0
444 ifdef VBOX_WITH_PCI_PASSTHROUGH
445VMMR0_DEFS += IN_PCIRAW_R0
446 endif
447 ifdef VBOX_WITH_TRIPLE_FAULT_HACK
448VMMR0_DEFS += VBOX_WITH_TRIPLE_FAULT_HACK
449 endif
450 ifdef VBOX_WITH_IOMMU_AMD
451VMMR0_DEFS += VBOX_WITH_IOMMU_AMD
452 endif
453 ifdef VBOX_WITH_DBGF_TRACING
454VMMR0_DEFS += VBOX_WITH_DBGF_TRACING
455 endif
456 ifdef VBOX_WITH_VMM_R0_SWITCH_STACK
457VMMR0_DEFS += VMM_R0_SWITCH_STACK
458 endif
459 if1of ($(KBUILD_TARGET), darwin linux win)
460VMMR0_DEFS += VMM_R0_TOUCH_FPU
461 endif
462VMMR0_DEFS.darwin = VMM_R0_SWITCH_STACK
463VMMR0_DEFS.win.amd64 = VBOX_WITH_KERNEL_USING_XMM
464
465 ifeq ($(VBOX_LDR_FMT),elf)
466VMMR0_CXXFLAGS += -Wunused -Wunused-variable -Wno-unused-parameter
467 endif
468
469VMMR0_INCS = \
470 include \
471 $(VBoxVMM_0_OUTDIR)/CommonGenIncs
472
473VMMR0_SOURCES = \
474 VBoxVMM.d \
475 VMMR0/CPUMR0.cpp \
476 VMMR0/CPUMR0A.asm \
477 $(if-expr defined(VBOX_WITH_DBGF_TRACING), VMMR0/DBGFR0Tracer.cpp,) \
478 VMMR0/GIMR0.cpp \
479 VMMR0/GIMR0Hv.cpp \
480 VMMR0/GMMR0.cpp \
481 VMMR0/GVMMR0.cpp \
482 VMMR0/EMR0.cpp \
483 VMMR0/HMR0.cpp \
484 VMMR0/HMR0A.asm \
485 VMMR0/HMVMXR0.cpp \
486 VMMR0/HMSVMR0.cpp \
487 VMMR0/IOMR0.cpp \
488 VMMR0/IOMR0IoPort.cpp \
489 VMMR0/IOMR0Mmio.cpp \
490 VMMR0/PDMR0Device.cpp \
491 VMMR0/PDMR0DevHlp.cpp \
492 $(if-expr defined(VBOX_WITH_DBGF_TRACING), VMMR0/PDMR0DevHlpTracing.cpp,) \
493 VMMR0/PDMR0Driver.cpp \
494 VMMR0/PGMR0.cpp \
495 VMMR0/PGMR0Pool.cpp \
496 VMMR0/PGMR0SharedPage.cpp \
497 VMMR0/VMMR0.cpp \
498 VMMRZ/CPUMRZ.cpp \
499 VMMRZ/CPUMRZA.asm \
500 VMMRZ/DBGFRZ.cpp \
501 VMMRZ/VMMRZ.cpp \
502 VMMAll/APICAll.cpp \
503 VMMAll/CPUMAllRegs.cpp \
504 VMMAll/CPUMAllMsrs.cpp \
505 VMMAll/DBGFAll.cpp \
506 $(if-expr defined(VBOX_WITH_DBGF_TRACING), VMMAll/DBGFAllTracer.cpp,) \
507 VMMAll/EMAll.cpp \
508 VMMAll/GIMAll.cpp \
509 VMMAll/GIMAllHv.cpp \
510 VMMAll/GIMAllKvm.cpp \
511 VMMAll/HMAll.cpp \
512 VMMAll/HMSVMAll.cpp \
513 VMMAll/HMVMXAll.cpp \
514 VMMAll/IEMAll.cpp \
515 VMMAll/IEMAllAImpl.asm \
516 VMMAll/IEMAllAImplC.cpp \
517 VMMAll/IOMAll.cpp \
518 VMMAll/IOMAllMmioNew.cpp \
519 VMMAll/MMAll.cpp \
520 VMMAll/MMAllHyper.cpp \
521 VMMAll/NEMAll.cpp \
522 VMMAll/PDMAll.cpp \
523 VMMAll/PDMAllCritSect.cpp \
524 VMMAll/PDMAllCritSectRw.cpp \
525 VMMAll/PDMAllCritSectBoth.cpp \
526 VMMAll/PDMAllQueue.cpp \
527 VMMAll/PDMAllTask.cpp \
528 VMMAll/PGMAll.cpp \
529 VMMAll/PGMAllHandler.cpp \
530 VMMAll/PGMAllMap.cpp \
531 VMMAll/PGMAllPhys.cpp \
532 VMMAll/PGMAllPool.cpp \
533 VMMAll/SELMAll.cpp \
534 VMMAll/TMAll.cpp \
535 VMMAll/TMAllCpu.cpp \
536 VMMAll/TMAllReal.cpp \
537 VMMAll/TMAllVirtual.cpp \
538 VMMAll/TRPMAll.cpp \
539 VMMAll/VMAll.cpp \
540 VMMAll/VMMAll.cpp \
541 VMMAll/VMMAllA.asm
542 if1of ($(VBOX_LDR_FMT), pe lx)
543VMMR0_SOURCES += $(VMMR0Imp_0_OUTDIR)/VMMR0.def
544 endif
545 ifdef VBOX_WITH_TRIPLE_FAULT_HACK
546VMMR0_SOURCES += \
547 VMMR0/VMMR0TripleFaultHack.cpp \
548 VMMR0/VMMR0TripleFaultHackA.asm
549 endif
550 ifdef VBOX_WITH_NETSHAPER
551VMMR0_SOURCES += \
552 VMMAll/PDMAllNetShaper.cpp
553 endif
554VMMR0_SOURCES.amd64 = \
555 VMMR0/VMMR0JmpA-amd64.asm
556VMMR0_SOURCES.x86 = \
557 VMMR0/VMMR0JmpA-x86.asm
558
559VMMR0_LIBS = \
560 $(PATH_STAGE_LIB)/ServicesR0$(VBOX_SUFF_LIB) \
561 $(PATH_STAGE_LIB)/RuntimeR0$(VBOX_SUFF_LIB) \
562 $(PATH_STAGE_LIB)/DisasmR0$(VBOX_SUFF_LIB)
563 ifneq ($(filter pe lx,$(VBOX_LDR_FMT)),)
564VMMR0_LIBS += \
565 $(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
566 endif
567 ifdef VBOX_WITH_NATIVE_NEM
568VMMR0_SOURCES.win.amd64 += VMMR0/NEMR0Native-win.cpp
569VMMR0_DEFS.win.amd64 += VBOX_WITH_NATIVE_NEM VBOX_WITH_NEM_R0
570VMMR0/NEMR0Native-win.cpp_SDKS.win = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK)INCS
571 endif
572
573$(call VBOX_SET_VER_INFO_R0,VMMR0,VirtualBox VMM - ring-0 context parts) # Version info / description.
574
575 if "$(USERNAME)" == "bird" && "$(KBUILD_TARGET)" == "win"
576VMMR0_VMMAll/IEMAll.cpp_CXXFLAGS = /FAcs /Fa$(subst /,\\,$(outbase).cod)
577VMMR0_VMMAll/IEMAllAImplC.cpp_CXXFLAGS = /FAcs /Fa$(subst /,\\,$(outbase).cod)
578VMMR0_VMMAll/PGMAll.cpp_CXXFLAGS = /FAcs /Fa$(subst /,\\,$(outbase).cod)
579VMMR0_CLEAN += $(addprefix $(VMMR0_0_OUTDIR)/VMMAll/, IEMAll.cod IEMAllAImplC.cod PGMAll.cod)
580 endif
581
582VMMR0_INTERMEDIATES += $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMInstructionStatisticsTmpl.h
583
584 if "$(KBUILD_TARGET)" == "win"
585# Debug type info hack for VMCPU, VM and similar. See VBoxVMM for details.
586VMMR0_LIBS += $(VMMR0PdbTypeHack_1_TARGET)
587VMMR0_LDFLAGS += /Export:PdbTypeHack
588
589LIBRARIES += VMMR0PdbTypeHack
590VMMR0PdbTypeHack_TEMPLATE = $(VMMR0_TEMPLATE)
591VMMR0PdbTypeHack_SOURCES = VMMAll/AllPdbTypeHack.cpp
592VMMR0PdbTypeHack_DEFS = $(VMMR0_DEFS)
593VMMR0PdbTypeHack_DEFS.win = $(VMMR0_DEFS.win)
594VMMR0PdbTypeHack_DEFS.win.x86 = $(VMMR0_DEFS.win.x86)
595VMMR0PdbTypeHack_DEFS.win.amd64 = $(VMMR0_DEFS.win.amd64)
596VMMR0PdbTypeHack_INCS = $(VMMR0_INCS)
597VMMR0PdbTypeHack_INTERMEDIATES = $(VMMR0_INTERMEDIATES)
598 endif
599
600endif # !VBOX_ONLY_EXTPACKS
601
602
603
604ifndef VBOX_ONLY_EXTPACKS
605#
606# SSMStandalone.lib/a for linking with VBoxSVC and other executables.
607#
608LIBRARIES += SSMStandalone
609SSMStandalone_TEMPLATE = VBOXR3EXE
610SSMStandalone_DEFS = VBOX_IN_VMM IN_VMM_R3 IN_VMM_STATIC SSM_STANDALONE CPUM_DB_STANDALONE $(VMM_COMMON_DEFS)
611SSMStandalone_INCS = include
612SSMStandalone_SOURCES = \
613 VMMR3/SSM.cpp \
614 VMMR3/CPUMR3Db.cpp
615endif # !VBOX_ONLY_EXTPACKS
616
617
618if !defined(VBOX_ONLY_EXTPACKS) \
619 && ( defined(VBOX_WITH_DTRACE_R3) \
620 || defined(VBOX_WITH_DTRACE_R0) \
621 || defined(VBOX_WITH_DTRACE_RC))
622#
623# Install the dtrace library files.
624#
625INSTALLS += VMMLibDTrace
626VMMLibDTrace_INST = $(VBOX_INST_DTRACE_LIB)$(KBUILD_TARGET_ARCH)/
627VMMLibDTrace_SOURCES = \
628 dtrace/lib/vbox-types.d \
629 dtrace/lib/$(KBUILD_TARGET_ARCH)/vbox-arch-types.d \
630 $(VMMLibDTrace_0_OUTDIR)/vm.d \
631 $(VMMLibDTrace_0_OUTDIR)/cpumctx.d \
632 $(VMMLibDTrace_0_OUTDIR)/cpum.d \
633 $(VMMLibDTrace_0_OUTDIR)/CPUMInternal.d \
634 $(VMMLibDTrace_0_OUTDIR)/x86.d
635$(call KB_FN_DO_PASS0_ON_TARGET,VMMLibDTrace)
636
637
638##
639# Turn the header $2 into the DTrace library script $1.
640#
641 define def_vmm_lib_dtrace_preprocess
642$$(call KB_FN_AUTO_CMD_DEPS,$$(VMMLibDTrace_0_OUTDIR)/$1)
643$$(VMMLibDTrace_0_OUTDIR)/$1: $2 $$(VBOX_VBOXCPP) | $$$$(dir $$$$@)
644 $$(call KB_FN_AUTO_CMD_DEPS_COMMANDS)
645 $$(QUIET)$$(call MSG_GENERATE,VMMLibDTrace,$$@,$2)
646 $$(QUIET)$(VBOX_VBOXCPP) -d \
647 -D VBOX_FOR_DTRACE_LIB \
648 -D VBOX_FOR_DTRACE_LIB_$(toupper $(KBUILD_TARGET_ARCH)) \
649 -D IN_RING0 \
650 -D RT_C_DECLS_BEGIN= \
651 -D RT_C_DECLS_END= \
652 -D RT_GCC_EXTENSION= \
653 -D 'RCPTRTYPE(a_Type)=RTRCPTR' \
654 -D 'R3PTRTYPE(a_Type)=RTR3PTR' \
655 -D 'R0PTRTYPE(a_Type)=a_Type' \
656 -D 'AssertCompile(a_Expr)=' \
657 -D 'AssertCompileSize(a_Stuct, a_Size)=' \
658 -D 'bool=uint8_t' \
659 $$(foreach def,\
660 $$(DEFS) \
661 $$(DEFS.$$(KBUILD_TARGET)) \
662 $$(DEFS.$(KBUILD_TARGET_ARCH)) \
663 $$(VMM_COMMON_DEFS) \
664 $$(ARCH_BITS_DEFS)\
665 ,-D '$$(def)') \
666 $2 \
667 $$@
668 $$(QUIET)$$(CHMOD) 644 $$@
669
670 VMMLibDTrace_CLEAN += $(VMMLibDTrace_0_OUTDIR)/$1
671 endef
672$(evalcall2 def_vmm_lib_dtrace_preprocess,vm.d,$(PATH_ROOT)/include/VBox/vmm/vm.h)
673$(evalcall2 def_vmm_lib_dtrace_preprocess,cpumctx.d,$(PATH_ROOT)/include/VBox/vmm/cpumctx.h)
674$(evalcall2 def_vmm_lib_dtrace_preprocess,cpum.d,$(PATH_ROOT)/include/VBox/vmm/cpum.h)
675$(evalcall2 def_vmm_lib_dtrace_preprocess,CPUMInternal.d,$(PATH_SUB_CURRENT)/include/CPUMInternal.h)
676$(evalcall2 def_vmm_lib_dtrace_preprocess,x86.d,$(PATH_ROOT)/include/iprt/x86.h)
677
678endif
679
680
681
682#
683# For vmmGetSvnRev.
684#
685VMMAll/VMMAll.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
686
687#
688# Disable annoying warnings about array subscript above array bounds in aPages[]
689#
690ifneq ($(KBUILD_TARGET),win)
691VMMR3/PGMPool.cpp_CXXFLAGS = $(VBOX_GCC_Wno-array_bounds)
692VMMAll/PGMAllPool.cpp_CXXFLAGS = $(VBOX_GCC_Wno-array_bounds)
693VMMAll/PGMAll.cpp_CXXFLAGS = -Wno-unused-function
694VMMAll/IEMAll.cpp_CXXFLAGS = -Wno-unused-function
695VMMR0/GMMR0.cpp_CXXFLAGS = -Wno-unused-value
696endif
697
698#
699# Always optimize the interpreter.
700#
701if $(USERNAME) != "bird" || "$(KBUILD_TYPE)" == "release" #|| "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64"
702 if1of ($(KBUILD_TARGET), win)
703# -noover is recognized despite the statement saying otherwise. It silences these warnings:
704# cl : Command line warning D9025 : overriding '/Od' with '/O2'
705# cl : Command line warning D9025 : overriding '/Oy-' with '/Oy'
706VMMAll/IEMAll.cpp_CXXFLAGS += -noover -O2xy
707 else
708VMMAll/IEMAll.cpp_CXXFLAGS += -O2
709#VMMAll/IEMAll.cpp_CXXFLAGS += -fno-align-functions -fno-align-jumps -fno-align-loops # Saves a few of percents, not worth it.
710#VMMAll/IEMAll.cpp_CXXFLAGS += -fno-reorder-blocks # Saves one or two percent ... never mind.
711VMMAll/IEMAll.cpp_CXXFLAGS += -fomit-frame-pointer # Omitting the frame pointer results in larger code, but it might be worth it. (esp addressing vs ebp?)
712 endif
713endif # bird wants good stacks
714
715
716# Alias the CPU database entries.
717$(foreach base,$(notdir $(basename $(wildcard $(PATH_SUB_CURRENT)/VMMR3/cpus/*.h))), $(eval $(base).o $(base).obj: CPUMR3Db.o))
718
719
720#
721# Process python source(s).
722#
723BLDDIRS += $(PATH_TARGET)/pylint
724
725define def_vbox_vmm_py_check
726$(eval name:=$(basename $(notdir $(py))))
727
728pylint: $(name)-py-phony.o
729$(name).o: $(name)-py-phony.o
730$(PATH_TARGET)/pylint/$(name).o $(name)-py-phony.o:: $(py) | $(PATH_TARGET)/pylint/
731ifdef VBOX_WITH_PYLINT
732 $(QUIET2)$(call MSG_L1,Subjecting $(py) to pylint...)
733 $(QUIET)$(REDIRECT) -C "$(dir $(py))" -E LC_ALL=C -- \
734 $(VBOX_PYLINT) --rcfile=$(PATH_TARGET)/no-such-pylintrc \
735 $$(VBOX_PYLINT_FLAGS) $$($(py)_VBOX_PYLINT_FLAGS) ./$(notdir $(py))
736endif
737 $(QUIET)$(APPEND) -t "$(PATH_TARGET)/pylint/$(name).o"
738
739TESTING += $(name)-py-phony.o
740endef # def_vbox_vmm_py_check
741
742$(foreach py, $(addprefix $(PATH_SUB_CURRENT)/VMMAll/, IEMAllInstructionsPython.py ) , $(eval $(def_vbox_vmm_py_check)))
743
744
745include $(FILE_KBUILD_SUB_FOOTER)
746
747
748# Alias the PGM templates to the object in which they are defined.
749PGMInternal.o: PGM.o
750
751PGMAllBth.o PGMAllGst.o PGMAllShw.o \
752PGMAllBth.obj PGMAllGst.obj PGMAllShw.obj: PGMAll.o
753
754PGMRCBth.o PGMRCGst.o PGMRCShw.o \
755PGMRCBth.obj PGMRCGst.obj PGMRCShw.obj: PGMRC.o
756
757PGMPhysRWTmpl.o PGMPhysRWTmpl.obj: PGMPhys.o
758
759PGMInline.o PGMInline.obj: PGMDbg.o
760
761# Alias the IEM templates to the object in which they are instantiated.
762IEMInternal.o \
763IEMAllInstructions.cpp.o IEMAllInstructions.cpp.obj \
764IEMAllInstructionsOneByte.cpp.o IEMAllInstructionsOneByte.cpp.obj \
765IEMAllInstructionsTwoByte0f.cpp.o IEMAllInstructionsTwoByte0f.cpp.obj \
766IEMAllInstructionsThree0f38.cpp.o IEMAllInstructionsThree0f38.cpp.obj \
767IEMAllInstructionsThree0f3a.cpp.o IEMAllInstructionsThree0f3a.cpp.obj \
768IEMAllInstructionsVexMap1.cpp.o IEMAllInstructionsVexMap1.cpp.obj \
769IEMAllInstructionsVexMap2.cpp.o IEMAllInstructionsVexMap2.cpp.obj \
770IEMAllInstructionsVexMap3.cpp.o IEMAllInstructionsVexMap3.cpp.obj \
771IEMAllInstructions3DNow.cpp.o IEMAllInstructions3DNow.cpp.obj \
772IEMAllCImpl.cpp.o IEMAllCImpl.cpp.obj \
773IEMAllCImplStrInstr.cpp.o IEMAllCImplStrInstr.cpp.obj \
774IEMAllCImplSvmInstr.cpp.o IEMAllCImplSvmInstr.cpp.obj \
775IEMAllCImplVmxInstr.cpp.o IEMAllCImplVmxInstr.cpp.obj: IEMAll.o
776
777# Alias the NEM template to the objects where it is used:
778NEMAllNativeTemplate-win.cpp.o: NEMR3Native-win.o NEMR0Native-win.o
779
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