VirtualBox

source: vbox/trunk/include/VBox/vmm/vmm.h@ 76507

Last change on this file since 76507 was 76507, checked in by vboxsync, 6 years ago

/include: scm --fix-header-guards. bugref:9344

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