1 | /** @file
|
---|
2 | * VMM - The Virtual Machine Monitor.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2019 Oracle Corporation
|
---|
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 (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef VBOX_INCLUDED_vmm_vmm_h
|
---|
27 | #define VBOX_INCLUDED_vmm_vmm_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <VBox/types.h>
|
---|
33 | #include <VBox/vmm/vmapi.h>
|
---|
34 | #include <VBox/sup.h>
|
---|
35 | #include <VBox/log.h>
|
---|
36 | #include <iprt/stdarg.h>
|
---|
37 | #include <iprt/thread.h>
|
---|
38 |
|
---|
39 | RT_C_DECLS_BEGIN
|
---|
40 |
|
---|
41 | /** @defgroup grp_vmm The Virtual Machine Monitor
|
---|
42 | * @{
|
---|
43 | */
|
---|
44 |
|
---|
45 | /** @defgroup grp_vmm_api The Virtual Machine Monitor API
|
---|
46 | * @{
|
---|
47 | */
|
---|
48 |
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * VMMRZCallRing3 operations.
|
---|
52 | */
|
---|
53 | typedef enum VMMCALLRING3
|
---|
54 | {
|
---|
55 | /** Invalid operation. */
|
---|
56 | VMMCALLRING3_INVALID = 0,
|
---|
57 | /** Acquire the PDM lock. */
|
---|
58 | VMMCALLRING3_PDM_LOCK,
|
---|
59 | /** Acquire the critical section specified as argument. */
|
---|
60 | VMMCALLRING3_PDM_CRIT_SECT_ENTER,
|
---|
61 | /** Enter the R/W critical section (in argument) exclusively. */
|
---|
62 | VMMCALLRING3_PDM_CRIT_SECT_RW_ENTER_EXCL,
|
---|
63 | /** Enter the R/W critical section (in argument) shared. */
|
---|
64 | VMMCALLRING3_PDM_CRIT_SECT_RW_ENTER_SHARED,
|
---|
65 | /** Acquire the PGM lock. */
|
---|
66 | VMMCALLRING3_PGM_LOCK,
|
---|
67 | /** Grow the PGM shadow page pool. */
|
---|
68 | VMMCALLRING3_PGM_POOL_GROW,
|
---|
69 | /** Maps a chunk into ring-3. */
|
---|
70 | VMMCALLRING3_PGM_MAP_CHUNK,
|
---|
71 | /** Allocates more handy pages. */
|
---|
72 | VMMCALLRING3_PGM_ALLOCATE_HANDY_PAGES,
|
---|
73 | /** Allocates a large (2MB) page. */
|
---|
74 | VMMCALLRING3_PGM_ALLOCATE_LARGE_HANDY_PAGE,
|
---|
75 | /** Acquire the MM hypervisor heap lock. */
|
---|
76 | VMMCALLRING3_MMHYPER_LOCK,
|
---|
77 | /** Replay the REM handler notifications. */
|
---|
78 | VMMCALLRING3_REM_REPLAY_HANDLER_NOTIFICATIONS,
|
---|
79 | /** Flush the GC/R0 logger. */
|
---|
80 | VMMCALLRING3_VMM_LOGGER_FLUSH,
|
---|
81 | /** Set the VM error message. */
|
---|
82 | VMMCALLRING3_VM_SET_ERROR,
|
---|
83 | /** Set the VM runtime error message. */
|
---|
84 | VMMCALLRING3_VM_SET_RUNTIME_ERROR,
|
---|
85 | /** Signal a ring 0 assertion. */
|
---|
86 | VMMCALLRING3_VM_R0_ASSERTION,
|
---|
87 | /** Ring switch to force preemption. This is also used by PDMCritSect to
|
---|
88 | * handle VERR_INTERRUPTED in kernel context. */
|
---|
89 | VMMCALLRING3_VM_R0_PREEMPT,
|
---|
90 | /** The usual 32-bit hack. */
|
---|
91 | VMMCALLRING3_32BIT_HACK = 0x7fffffff
|
---|
92 | } VMMCALLRING3;
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * VMMRZCallRing3 notification callback.
|
---|
96 | *
|
---|
97 | * @returns VBox status code.
|
---|
98 | * @param pVCpu The cross context virtual CPU structure.
|
---|
99 | * @param enmOperation The operation causing the ring-3 jump.
|
---|
100 | * @param pvUser The user argument.
|
---|
101 | */
|
---|
102 | typedef DECLCALLBACK(int) FNVMMR0CALLRING3NOTIFICATION(PVMCPUCC pVCpu, VMMCALLRING3 enmOperation, void *pvUser);
|
---|
103 | /** Pointer to a FNRTMPNOTIFICATION(). */
|
---|
104 | typedef FNVMMR0CALLRING3NOTIFICATION *PFNVMMR0CALLRING3NOTIFICATION;
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * Rendezvous callback.
|
---|
108 | *
|
---|
109 | * @returns VBox strict status code - EM scheduling. Do not return
|
---|
110 | * informational status code other than the ones used by EM for
|
---|
111 | * scheduling.
|
---|
112 | *
|
---|
113 | * @param pVM The cross context VM structure.
|
---|
114 | * @param pVCpu The cross context virtual CPU structure of the calling EMT.
|
---|
115 | * @param pvUser The user argument.
|
---|
116 | */
|
---|
117 | typedef DECLCALLBACK(VBOXSTRICTRC) FNVMMEMTRENDEZVOUS(PVM pVM, PVMCPU pVCpu, void *pvUser);
|
---|
118 | /** Pointer to a rendezvous callback function. */
|
---|
119 | typedef FNVMMEMTRENDEZVOUS *PFNVMMEMTRENDEZVOUS;
|
---|
120 |
|
---|
121 | /**
|
---|
122 | * Method table that the VMM uses to call back the user of the VMM.
|
---|
123 | */
|
---|
124 | typedef struct VMM2USERMETHODS
|
---|
125 | {
|
---|
126 | /** Magic value (VMM2USERMETHODS_MAGIC). */
|
---|
127 | uint32_t u32Magic;
|
---|
128 | /** Structure version (VMM2USERMETHODS_VERSION). */
|
---|
129 | uint32_t u32Version;
|
---|
130 |
|
---|
131 | /**
|
---|
132 | * Save the VM state.
|
---|
133 | *
|
---|
134 | * @returns VBox status code.
|
---|
135 | * @param pThis Pointer to the callback method table.
|
---|
136 | * @param pUVM The user mode VM handle.
|
---|
137 | *
|
---|
138 | * @remarks This member shall be set to NULL if the operation is not
|
---|
139 | * supported.
|
---|
140 | */
|
---|
141 | DECLR3CALLBACKMEMBER(int, pfnSaveState,(PCVMM2USERMETHODS pThis, PUVM pUVM));
|
---|
142 | /** @todo Move pfnVMAtError and pfnCFGMConstructor here? */
|
---|
143 |
|
---|
144 | /**
|
---|
145 | * EMT initialization notification callback.
|
---|
146 | *
|
---|
147 | * This is intended for doing per-thread initialization for EMTs (like COM
|
---|
148 | * init).
|
---|
149 | *
|
---|
150 | * @param pThis Pointer to the callback method table.
|
---|
151 | * @param pUVM The user mode VM handle.
|
---|
152 | * @param pUVCpu The user mode virtual CPU handle.
|
---|
153 | *
|
---|
154 | * @remarks This is optional and shall be set to NULL if not wanted.
|
---|
155 | */
|
---|
156 | DECLR3CALLBACKMEMBER(void, pfnNotifyEmtInit,(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu));
|
---|
157 |
|
---|
158 | /**
|
---|
159 | * EMT termination notification callback.
|
---|
160 | *
|
---|
161 | * This is intended for doing per-thread cleanups for EMTs (like COM).
|
---|
162 | *
|
---|
163 | * @param pThis Pointer to the callback method table.
|
---|
164 | * @param pUVM The user mode VM handle.
|
---|
165 | * @param pUVCpu The user mode virtual CPU handle.
|
---|
166 | *
|
---|
167 | * @remarks This is optional and shall be set to NULL if not wanted.
|
---|
168 | */
|
---|
169 | DECLR3CALLBACKMEMBER(void, pfnNotifyEmtTerm,(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu));
|
---|
170 |
|
---|
171 | /**
|
---|
172 | * PDM thread initialization notification callback.
|
---|
173 | *
|
---|
174 | * This is intended for doing per-thread initialization (like COM init).
|
---|
175 | *
|
---|
176 | * @param pThis Pointer to the callback method table.
|
---|
177 | * @param pUVM The user mode VM handle.
|
---|
178 | *
|
---|
179 | * @remarks This is optional and shall be set to NULL if not wanted.
|
---|
180 | */
|
---|
181 | DECLR3CALLBACKMEMBER(void, pfnNotifyPdmtInit,(PCVMM2USERMETHODS pThis, PUVM pUVM));
|
---|
182 |
|
---|
183 | /**
|
---|
184 | * EMT termination notification callback.
|
---|
185 | *
|
---|
186 | * This is intended for doing per-thread cleanups for EMTs (like COM).
|
---|
187 | *
|
---|
188 | * @param pThis Pointer to the callback method table.
|
---|
189 | * @param pUVM The user mode VM handle.
|
---|
190 | *
|
---|
191 | * @remarks This is optional and shall be set to NULL if not wanted.
|
---|
192 | */
|
---|
193 | DECLR3CALLBACKMEMBER(void, pfnNotifyPdmtTerm,(PCVMM2USERMETHODS pThis, PUVM pUVM));
|
---|
194 |
|
---|
195 | /**
|
---|
196 | * Notification callback that that a VM reset will be turned into a power off.
|
---|
197 | *
|
---|
198 | * @param pThis Pointer to the callback method table.
|
---|
199 | * @param pUVM The user mode VM handle.
|
---|
200 | *
|
---|
201 | * @remarks This is optional and shall be set to NULL if not wanted.
|
---|
202 | */
|
---|
203 | DECLR3CALLBACKMEMBER(void, pfnNotifyResetTurnedIntoPowerOff,(PCVMM2USERMETHODS pThis, PUVM pUVM));
|
---|
204 |
|
---|
205 | /**
|
---|
206 | * Generic object query by UUID.
|
---|
207 | *
|
---|
208 | * @returns pointer to queried the object on success, NULL if not found.
|
---|
209 | *
|
---|
210 | * @param pThis Pointer to the callback method table.
|
---|
211 | * @param pUVM The user mode VM handle.
|
---|
212 | * @param pUuid The UUID of what's being queried. The UUIDs and the
|
---|
213 | * usage conventions are defined by the user.
|
---|
214 | *
|
---|
215 | * @remarks This is optional and shall be set to NULL if not wanted.
|
---|
216 | */
|
---|
217 | DECLR3CALLBACKMEMBER(void *, pfnQueryGenericObject,(PCVMM2USERMETHODS pThis, PUVM pUVM, PCRTUUID pUuid));
|
---|
218 |
|
---|
219 | /** Magic value (VMM2USERMETHODS_MAGIC) marking the end of the structure. */
|
---|
220 | uint32_t u32EndMagic;
|
---|
221 | } VMM2USERMETHODS;
|
---|
222 |
|
---|
223 | /** Magic value of the VMM2USERMETHODS (Franz Kafka). */
|
---|
224 | #define VMM2USERMETHODS_MAGIC UINT32_C(0x18830703)
|
---|
225 | /** The VMM2USERMETHODS structure version. */
|
---|
226 | #define VMM2USERMETHODS_VERSION UINT32_C(0x00030000)
|
---|
227 |
|
---|
228 |
|
---|
229 | /**
|
---|
230 | * Checks whether we've armed the ring-0 long jump machinery.
|
---|
231 | *
|
---|
232 | * @returns @c true / @c false
|
---|
233 | * @param a_pVCpu The caller's cross context virtual CPU structure.
|
---|
234 | * @thread EMT
|
---|
235 | * @sa VMMR0IsLongJumpArmed
|
---|
236 | */
|
---|
237 | #ifdef IN_RING0
|
---|
238 | # define VMMIsLongJumpArmed(a_pVCpu) VMMR0IsLongJumpArmed(a_pVCpu)
|
---|
239 | #else
|
---|
240 | # define VMMIsLongJumpArmed(a_pVCpu) (false)
|
---|
241 | #endif
|
---|
242 |
|
---|
243 |
|
---|
244 | VMMDECL(VMCPUID) VMMGetCpuId(PVMCC pVM);
|
---|
245 | VMMDECL(PVMCPUCC) VMMGetCpu(PVMCC pVM);
|
---|
246 | VMMDECL(PVMCPUCC) VMMGetCpu0(PVMCC pVM);
|
---|
247 | VMMDECL(PVMCPUCC) VMMGetCpuById(PVMCC pVM, VMCPUID idCpu);
|
---|
248 | VMMR3DECL(PVMCPUCC) VMMR3GetCpuByIdU(PUVM pVM, VMCPUID idCpu);
|
---|
249 | VMM_INT_DECL(uint32_t) VMMGetSvnRev(void);
|
---|
250 | VMM_INT_DECL(bool) VMMIsInRing3Call(PVMCPUCC pVCpu);
|
---|
251 | VMM_INT_DECL(void) VMMTrashVolatileXMMRegs(void);
|
---|
252 |
|
---|
253 |
|
---|
254 | /** @defgroup grp_vmm_api_r0 The VMM Host Context Ring 0 API
|
---|
255 | * @{
|
---|
256 | */
|
---|
257 |
|
---|
258 | /**
|
---|
259 | * The VMMR0Entry() codes.
|
---|
260 | */
|
---|
261 | typedef enum VMMR0OPERATION
|
---|
262 | {
|
---|
263 | /** Run guest code using the available hardware acceleration technology. */
|
---|
264 | VMMR0_DO_HM_RUN = SUP_VMMR0_DO_HM_RUN,
|
---|
265 | /** Official NOP that we use for profiling. */
|
---|
266 | VMMR0_DO_NOP = SUP_VMMR0_DO_NOP,
|
---|
267 | /** Official NOP that we use for profiling. */
|
---|
268 | VMMR0_DO_NEM_RUN = SUP_VMMR0_DO_NEM_RUN,
|
---|
269 | /** Official slow iocl NOP that we use for profiling. */
|
---|
270 | VMMR0_DO_SLOW_NOP,
|
---|
271 |
|
---|
272 | /** Ask the GVMM to create a new VM. */
|
---|
273 | VMMR0_DO_GVMM_CREATE_VM = 32,
|
---|
274 | /** Ask the GVMM to destroy the VM. */
|
---|
275 | VMMR0_DO_GVMM_DESTROY_VM,
|
---|
276 | /** Call GVMMR0RegisterVCpu(). */
|
---|
277 | VMMR0_DO_GVMM_REGISTER_VMCPU,
|
---|
278 | /** Call GVMMR0DeregisterVCpu(). */
|
---|
279 | VMMR0_DO_GVMM_DEREGISTER_VMCPU,
|
---|
280 | /** Call GVMMR0SchedHalt(). */
|
---|
281 | VMMR0_DO_GVMM_SCHED_HALT,
|
---|
282 | /** Call GVMMR0SchedWakeUp(). */
|
---|
283 | VMMR0_DO_GVMM_SCHED_WAKE_UP,
|
---|
284 | /** Call GVMMR0SchedPoke(). */
|
---|
285 | VMMR0_DO_GVMM_SCHED_POKE,
|
---|
286 | /** Call GVMMR0SchedWakeUpAndPokeCpus(). */
|
---|
287 | VMMR0_DO_GVMM_SCHED_WAKE_UP_AND_POKE_CPUS,
|
---|
288 | /** Call GVMMR0SchedPoll(). */
|
---|
289 | VMMR0_DO_GVMM_SCHED_POLL,
|
---|
290 | /** Call GVMMR0QueryStatistics(). */
|
---|
291 | VMMR0_DO_GVMM_QUERY_STATISTICS,
|
---|
292 | /** Call GVMMR0ResetStatistics(). */
|
---|
293 | VMMR0_DO_GVMM_RESET_STATISTICS,
|
---|
294 |
|
---|
295 | /** Call VMMR0 Per VM Init. */
|
---|
296 | VMMR0_DO_VMMR0_INIT = 64,
|
---|
297 | /** Call VMMR0 Per VM EMT Init */
|
---|
298 | VMMR0_DO_VMMR0_INIT_EMT,
|
---|
299 | /** Call VMMR0 Per VM Termination. */
|
---|
300 | VMMR0_DO_VMMR0_TERM,
|
---|
301 |
|
---|
302 | /** Setup hardware-assisted VM session. */
|
---|
303 | VMMR0_DO_HM_SETUP_VM = 128,
|
---|
304 | /** Attempt to enable or disable hardware-assisted mode. */
|
---|
305 | VMMR0_DO_HM_ENABLE,
|
---|
306 |
|
---|
307 | /** Call PGMR0PhysAllocateHandyPages(). */
|
---|
308 | VMMR0_DO_PGM_ALLOCATE_HANDY_PAGES = 192,
|
---|
309 | /** Call PGMR0PhysFlushHandyPages(). */
|
---|
310 | VMMR0_DO_PGM_FLUSH_HANDY_PAGES,
|
---|
311 | /** Call PGMR0AllocateLargePage(). */
|
---|
312 | VMMR0_DO_PGM_ALLOCATE_LARGE_HANDY_PAGE,
|
---|
313 | /** Call PGMR0PhysSetupIommu(). */
|
---|
314 | VMMR0_DO_PGM_PHYS_SETUP_IOMMU,
|
---|
315 |
|
---|
316 | /** Call GMMR0InitialReservation(). */
|
---|
317 | VMMR0_DO_GMM_INITIAL_RESERVATION = 256,
|
---|
318 | /** Call GMMR0UpdateReservation(). */
|
---|
319 | VMMR0_DO_GMM_UPDATE_RESERVATION,
|
---|
320 | /** Call GMMR0AllocatePages(). */
|
---|
321 | VMMR0_DO_GMM_ALLOCATE_PAGES,
|
---|
322 | /** Call GMMR0FreePages(). */
|
---|
323 | VMMR0_DO_GMM_FREE_PAGES,
|
---|
324 | /** Call GMMR0FreeLargePage(). */
|
---|
325 | VMMR0_DO_GMM_FREE_LARGE_PAGE,
|
---|
326 | /** Call GMMR0QueryHypervisorMemoryStatsReq(). */
|
---|
327 | VMMR0_DO_GMM_QUERY_HYPERVISOR_MEM_STATS,
|
---|
328 | /** Call GMMR0QueryMemoryStatsReq(). */
|
---|
329 | VMMR0_DO_GMM_QUERY_MEM_STATS,
|
---|
330 | /** Call GMMR0BalloonedPages(). */
|
---|
331 | VMMR0_DO_GMM_BALLOONED_PAGES,
|
---|
332 | /** Call GMMR0MapUnmapChunk(). */
|
---|
333 | VMMR0_DO_GMM_MAP_UNMAP_CHUNK,
|
---|
334 | /** Call GMMR0SeedChunk(). */
|
---|
335 | VMMR0_DO_GMM_SEED_CHUNK,
|
---|
336 | /** Call GMMR0RegisterSharedModule. */
|
---|
337 | VMMR0_DO_GMM_REGISTER_SHARED_MODULE,
|
---|
338 | /** Call GMMR0UnregisterSharedModule. */
|
---|
339 | VMMR0_DO_GMM_UNREGISTER_SHARED_MODULE,
|
---|
340 | /** Call GMMR0ResetSharedModules. */
|
---|
341 | VMMR0_DO_GMM_RESET_SHARED_MODULES,
|
---|
342 | /** Call GMMR0CheckSharedModules. */
|
---|
343 | VMMR0_DO_GMM_CHECK_SHARED_MODULES,
|
---|
344 | /** Call GMMR0FindDuplicatePage. */
|
---|
345 | VMMR0_DO_GMM_FIND_DUPLICATE_PAGE,
|
---|
346 | /** Call GMMR0QueryStatistics(). */
|
---|
347 | VMMR0_DO_GMM_QUERY_STATISTICS,
|
---|
348 | /** Call GMMR0ResetStatistics(). */
|
---|
349 | VMMR0_DO_GMM_RESET_STATISTICS,
|
---|
350 |
|
---|
351 | /** Call PDMR0DriverCallReqHandler. */
|
---|
352 | VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER = 320,
|
---|
353 | /** Call PDMR0DeviceCallReqHandler. */
|
---|
354 | VMMR0_DO_PDM_DEVICE_CALL_REQ_HANDLER,
|
---|
355 | /** Call PDMR0DeviceCreateReqHandler. */
|
---|
356 | VMMR0_DO_PDM_DEVICE_CREATE,
|
---|
357 | /** Call PDMR0DeviceGenCallReqHandler. */
|
---|
358 | VMMR0_DO_PDM_DEVICE_GEN_CALL,
|
---|
359 | /** Old style device compat: Set ring-0 critical section. */
|
---|
360 | VMMR0_DO_PDM_DEVICE_COMPAT_SET_CRITSECT,
|
---|
361 | /** Old style device compat: Register PCI device. */
|
---|
362 | VMMR0_DO_PDM_DEVICE_COMPAT_REG_PCIDEV,
|
---|
363 |
|
---|
364 | /** Set a GVMM or GMM configuration value. */
|
---|
365 | VMMR0_DO_GCFGM_SET_VALUE = 400,
|
---|
366 | /** Query a GVMM or GMM configuration value. */
|
---|
367 | VMMR0_DO_GCFGM_QUERY_VALUE,
|
---|
368 |
|
---|
369 | /** The start of the R0 service operations. */
|
---|
370 | VMMR0_DO_SRV_START = 448,
|
---|
371 | /** Call IntNetR0Open(). */
|
---|
372 | VMMR0_DO_INTNET_OPEN,
|
---|
373 | /** Call IntNetR0IfClose(). */
|
---|
374 | VMMR0_DO_INTNET_IF_CLOSE,
|
---|
375 | /** Call IntNetR0IfGetBufferPtrs(). */
|
---|
376 | VMMR0_DO_INTNET_IF_GET_BUFFER_PTRS,
|
---|
377 | /** Call IntNetR0IfSetPromiscuousMode(). */
|
---|
378 | VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE,
|
---|
379 | /** Call IntNetR0IfSetMacAddress(). */
|
---|
380 | VMMR0_DO_INTNET_IF_SET_MAC_ADDRESS,
|
---|
381 | /** Call IntNetR0IfSetActive(). */
|
---|
382 | VMMR0_DO_INTNET_IF_SET_ACTIVE,
|
---|
383 | /** Call IntNetR0IfSend(). */
|
---|
384 | VMMR0_DO_INTNET_IF_SEND,
|
---|
385 | /** Call IntNetR0IfWait(). */
|
---|
386 | VMMR0_DO_INTNET_IF_WAIT,
|
---|
387 | /** Call IntNetR0IfAbortWait(). */
|
---|
388 | VMMR0_DO_INTNET_IF_ABORT_WAIT,
|
---|
389 |
|
---|
390 | /** Forward call to the PCI driver */
|
---|
391 | VMMR0_DO_PCIRAW_REQ = 512,
|
---|
392 |
|
---|
393 | /** The end of the R0 service operations. */
|
---|
394 | VMMR0_DO_SRV_END,
|
---|
395 |
|
---|
396 | /** Call NEMR0InitVM() (host specific). */
|
---|
397 | VMMR0_DO_NEM_INIT_VM = 576,
|
---|
398 | /** Call NEMR0InitVMPart2() (host specific). */
|
---|
399 | VMMR0_DO_NEM_INIT_VM_PART_2,
|
---|
400 | /** Call NEMR0MapPages() (host specific). */
|
---|
401 | VMMR0_DO_NEM_MAP_PAGES,
|
---|
402 | /** Call NEMR0UnmapPages() (host specific). */
|
---|
403 | VMMR0_DO_NEM_UNMAP_PAGES,
|
---|
404 | /** Call NEMR0ExportState() (host specific). */
|
---|
405 | VMMR0_DO_NEM_EXPORT_STATE,
|
---|
406 | /** Call NEMR0ImportState() (host specific). */
|
---|
407 | VMMR0_DO_NEM_IMPORT_STATE,
|
---|
408 | /** Call NEMR0QueryCpuTick() (host specific). */
|
---|
409 | VMMR0_DO_NEM_QUERY_CPU_TICK,
|
---|
410 | /** Call NEMR0ResumeCpuTickOnAll() (host specific). */
|
---|
411 | VMMR0_DO_NEM_RESUME_CPU_TICK_ON_ALL,
|
---|
412 | /** Call NEMR0UpdateStatistics() (host specific). */
|
---|
413 | VMMR0_DO_NEM_UPDATE_STATISTICS,
|
---|
414 | /** Call NEMR0DoExperiment() (host specific, experimental, debug only). */
|
---|
415 | VMMR0_DO_NEM_EXPERIMENT,
|
---|
416 |
|
---|
417 | /** Grow the I/O port registration tables. */
|
---|
418 | VMMR0_DO_IOM_GROW_IO_PORTS = 640,
|
---|
419 | /** Grow the I/O port statistics tables. */
|
---|
420 | VMMR0_DO_IOM_GROW_IO_PORT_STATS,
|
---|
421 |
|
---|
422 | /** Official call we use for testing Ring-0 APIs. */
|
---|
423 | VMMR0_DO_TESTS = 704,
|
---|
424 |
|
---|
425 | /** The usual 32-bit type blow up. */
|
---|
426 | VMMR0_DO_32BIT_HACK = 0x7fffffff
|
---|
427 | } VMMR0OPERATION;
|
---|
428 |
|
---|
429 |
|
---|
430 | /**
|
---|
431 | * Request buffer for VMMR0_DO_GCFGM_SET_VALUE and VMMR0_DO_GCFGM_QUERY_VALUE.
|
---|
432 | * @todo Move got GCFGM.h when it's implemented.
|
---|
433 | */
|
---|
434 | typedef struct GCFGMVALUEREQ
|
---|
435 | {
|
---|
436 | /** The request header.*/
|
---|
437 | SUPVMMR0REQHDR Hdr;
|
---|
438 | /** The support driver session handle. */
|
---|
439 | PSUPDRVSESSION pSession;
|
---|
440 | /** The value.
|
---|
441 | * This is input for the set request and output for the query. */
|
---|
442 | uint64_t u64Value;
|
---|
443 | /** The variable name.
|
---|
444 | * This is fixed sized just to make things simple for the mock-up. */
|
---|
445 | char szName[48];
|
---|
446 | } GCFGMVALUEREQ;
|
---|
447 | /** Pointer to a VMMR0_DO_GCFGM_SET_VALUE and VMMR0_DO_GCFGM_QUERY_VALUE request buffer.
|
---|
448 | * @todo Move got GCFGM.h when it's implemented.
|
---|
449 | */
|
---|
450 | typedef GCFGMVALUEREQ *PGCFGMVALUEREQ;
|
---|
451 |
|
---|
452 | #if defined(IN_RING0) || defined(DOXYGEN_RUNNING)
|
---|
453 | VMMR0DECL(void) VMMR0EntryFast(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation);
|
---|
454 | VMMR0DECL(int) VMMR0EntryEx(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation,
|
---|
455 | PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION);
|
---|
456 | VMMR0_INT_DECL(int) VMMR0TermVM(PGVM pGVM, VMCPUID idCpu);
|
---|
457 | VMMR0_INT_DECL(bool) VMMR0IsLongJumpArmed(PVMCPUCC pVCpu);
|
---|
458 | VMMR0_INT_DECL(bool) VMMR0IsInRing3LongJump(PVMCPUCC pVCpu);
|
---|
459 | VMMR0_INT_DECL(int) VMMR0ThreadCtxHookCreateForEmt(PVMCPUCC pVCpu);
|
---|
460 | VMMR0_INT_DECL(void) VMMR0ThreadCtxHookDestroyForEmt(PVMCPUCC pVCpu);
|
---|
461 | VMMR0_INT_DECL(void) VMMR0ThreadCtxHookDisable(PVMCPUCC pVCpu);
|
---|
462 | VMMR0_INT_DECL(bool) VMMR0ThreadCtxHookIsEnabled(PVMCPUCC pVCpu);
|
---|
463 |
|
---|
464 | # ifdef LOG_ENABLED
|
---|
465 | VMMR0_INT_DECL(void) VMMR0LogFlushDisable(PVMCPUCC pVCpu);
|
---|
466 | VMMR0_INT_DECL(void) VMMR0LogFlushEnable(PVMCPUCC pVCpu);
|
---|
467 | VMMR0_INT_DECL(bool) VMMR0IsLogFlushDisabled(PVMCPUCC pVCpu);
|
---|
468 | # else
|
---|
469 | # define VMMR0LogFlushDisable(pVCpu) do { } while(0)
|
---|
470 | # define VMMR0LogFlushEnable(pVCpu) do { } while(0)
|
---|
471 | # define VMMR0IsLogFlushDisabled(pVCpu) (true)
|
---|
472 | # endif /* LOG_ENABLED */
|
---|
473 | #endif /* IN_RING0 */
|
---|
474 |
|
---|
475 | /** @} */
|
---|
476 |
|
---|
477 |
|
---|
478 | #if defined(IN_RING3) || defined(DOXYGEN_RUNNING)
|
---|
479 | /** @defgroup grp_vmm_api_r3 The VMM Host Context Ring 3 API
|
---|
480 | * @{
|
---|
481 | */
|
---|
482 | VMMR3_INT_DECL(int) VMMR3Init(PVM pVM);
|
---|
483 | VMMR3_INT_DECL(int) VMMR3InitR0(PVM pVM);
|
---|
484 | VMMR3_INT_DECL(int) VMMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
|
---|
485 | VMMR3_INT_DECL(int) VMMR3Term(PVM pVM);
|
---|
486 | VMMR3_INT_DECL(void) VMMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
|
---|
487 | VMMR3_INT_DECL(int) VMMR3UpdateLoggers(PVM pVM);
|
---|
488 | VMMR3DECL(const char *) VMMR3GetRZAssertMsg1(PVM pVM);
|
---|
489 | VMMR3DECL(const char *) VMMR3GetRZAssertMsg2(PVM pVM);
|
---|
490 | VMMR3_INT_DECL(int) VMMR3HmRunGC(PVM pVM, PVMCPU pVCpu);
|
---|
491 | VMMR3DECL(int) VMMR3CallR0(PVM pVM, uint32_t uOperation, uint64_t u64Arg, PSUPVMMR0REQHDR pReqHdr);
|
---|
492 | VMMR3_INT_DECL(int) VMMR3CallR0Emt(PVM pVM, PVMCPU pVCpu, VMMR0OPERATION enmOperation, uint64_t u64Arg, PSUPVMMR0REQHDR pReqHdr);
|
---|
493 | VMMR3_INT_DECL(VBOXSTRICTRC) VMMR3CallR0EmtFast(PVM pVM, PVMCPU pVCpu, VMMR0OPERATION enmOperation);
|
---|
494 | VMMR3DECL(void) VMMR3FatalDump(PVM pVM, PVMCPU pVCpu, int rcErr);
|
---|
495 | VMMR3_INT_DECL(void) VMMR3YieldSuspend(PVM pVM);
|
---|
496 | VMMR3_INT_DECL(void) VMMR3YieldStop(PVM pVM);
|
---|
497 | VMMR3_INT_DECL(void) VMMR3YieldResume(PVM pVM);
|
---|
498 | VMMR3_INT_DECL(void) VMMR3SendStartupIpi(PVM pVM, VMCPUID idCpu, uint32_t uVector);
|
---|
499 | VMMR3_INT_DECL(void) VMMR3SendInitIpi(PVM pVM, VMCPUID idCpu);
|
---|
500 | VMMR3DECL(int) VMMR3RegisterPatchMemory(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem);
|
---|
501 | VMMR3DECL(int) VMMR3DeregisterPatchMemory(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem);
|
---|
502 | VMMR3DECL(int) VMMR3EmtRendezvous(PVM pVM, uint32_t fFlags, PFNVMMEMTRENDEZVOUS pfnRendezvous, void *pvUser);
|
---|
503 | /** @defgroup grp_VMMR3EmtRendezvous_fFlags VMMR3EmtRendezvous flags
|
---|
504 | * @{ */
|
---|
505 | /** Execution type mask. */
|
---|
506 | #define VMMEMTRENDEZVOUS_FLAGS_TYPE_MASK UINT32_C(0x00000007)
|
---|
507 | /** Invalid execution type. */
|
---|
508 | #define VMMEMTRENDEZVOUS_FLAGS_TYPE_INVALID UINT32_C(0)
|
---|
509 | /** Let the EMTs execute the callback one by one (in no particular order).
|
---|
510 | * Recursion from within the callback possible. */
|
---|
511 | #define VMMEMTRENDEZVOUS_FLAGS_TYPE_ONE_BY_ONE UINT32_C(1)
|
---|
512 | /** Let all the EMTs execute the callback at the same time.
|
---|
513 | * Cannot recurse from the callback. */
|
---|
514 | #define VMMEMTRENDEZVOUS_FLAGS_TYPE_ALL_AT_ONCE UINT32_C(2)
|
---|
515 | /** Only execute the callback on one EMT (no particular one).
|
---|
516 | * Recursion from within the callback possible. */
|
---|
517 | #define VMMEMTRENDEZVOUS_FLAGS_TYPE_ONCE UINT32_C(3)
|
---|
518 | /** Let the EMTs execute the callback one by one in ascending order.
|
---|
519 | * Recursion from within the callback possible. */
|
---|
520 | #define VMMEMTRENDEZVOUS_FLAGS_TYPE_ASCENDING UINT32_C(4)
|
---|
521 | /** Let the EMTs execute the callback one by one in descending order.
|
---|
522 | * Recursion from within the callback possible. */
|
---|
523 | #define VMMEMTRENDEZVOUS_FLAGS_TYPE_DESCENDING UINT32_C(5)
|
---|
524 | /** Stop after the first error.
|
---|
525 | * This is not valid for any execution type where more than one EMT is active
|
---|
526 | * at a time. */
|
---|
527 | #define VMMEMTRENDEZVOUS_FLAGS_STOP_ON_ERROR UINT32_C(0x00000008)
|
---|
528 | /** Use VMREQFLAGS_PRIORITY when contacting the EMTs. */
|
---|
529 | #define VMMEMTRENDEZVOUS_FLAGS_PRIORITY UINT32_C(0x00000010)
|
---|
530 | /** The valid flags. */
|
---|
531 | #define VMMEMTRENDEZVOUS_FLAGS_VALID_MASK UINT32_C(0x0000001f)
|
---|
532 | /** @} */
|
---|
533 | VMMR3_INT_DECL(int) VMMR3EmtRendezvousFF(PVM pVM, PVMCPU pVCpu);
|
---|
534 | VMMR3_INT_DECL(void) VMMR3SetMayHaltInRing0(PVMCPU pVCpu, bool fMayHaltInRing0, uint32_t cNsSpinBlockThreshold);
|
---|
535 | VMMR3_INT_DECL(int) VMMR3ReadR0Stack(PVM pVM, VMCPUID idCpu, RTHCUINTPTR R0Addr, void *pvBuf, size_t cbRead);
|
---|
536 | VMMR3_INT_DECL(void) VMMR3InitR0StackUnwindState(PUVM pUVM, VMCPUID idCpu, PRTDBGUNWINDSTATE pState);
|
---|
537 | /** @} */
|
---|
538 | #endif /* IN_RING3 */
|
---|
539 |
|
---|
540 |
|
---|
541 | #if defined(IN_RC) || defined(IN_RING0) || defined(DOXYGEN_RUNNING)
|
---|
542 | /** @defgroup grp_vmm_api_rz The VMM Raw-Mode and Ring-0 Context API
|
---|
543 | * @{
|
---|
544 | */
|
---|
545 | VMMRZDECL(int) VMMRZCallRing3(PVMCC pVMCC, PVMCPUCC pVCpu, VMMCALLRING3 enmOperation, uint64_t uArg);
|
---|
546 | VMMRZDECL(int) VMMRZCallRing3NoCpu(PVMCC pVM, VMMCALLRING3 enmOperation, uint64_t uArg);
|
---|
547 | VMMRZDECL(void) VMMRZCallRing3Disable(PVMCPUCC pVCpu);
|
---|
548 | VMMRZDECL(void) VMMRZCallRing3Enable(PVMCPUCC pVCpu);
|
---|
549 | VMMRZDECL(bool) VMMRZCallRing3IsEnabled(PVMCPUCC pVCpu);
|
---|
550 | VMMRZDECL(int) VMMRZCallRing3SetNotification(PVMCPUCC pVCpu, R0PTRTYPE(PFNVMMR0CALLRING3NOTIFICATION) pfnCallback, RTR0PTR pvUser);
|
---|
551 | VMMRZDECL(void) VMMRZCallRing3RemoveNotification(PVMCPUCC pVCpu);
|
---|
552 | VMMRZDECL(bool) VMMRZCallRing3IsNotificationSet(PVMCPUCC pVCpu);
|
---|
553 | /** @} */
|
---|
554 | #endif
|
---|
555 |
|
---|
556 |
|
---|
557 | /** @} */
|
---|
558 |
|
---|
559 | /** @} */
|
---|
560 | RT_C_DECLS_END
|
---|
561 |
|
---|
562 | #endif /* !VBOX_INCLUDED_vmm_vmm_h */
|
---|