VirtualBox

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

Last change on this file since 92392 was 92392, checked in by vboxsync, 3 years ago

VMM: Removed the callring-3 API and some of the associated stuff. bugref:10093

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 23.4 KB
Line 
1/** @file
2 * VMM - The Virtual Machine Monitor.
3 */
4
5/*
6 * Copyright (C) 2006-2020 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
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/**
51 * Ring-0 assertion notification callback.
52 *
53 * @returns VBox status code.
54 * @param pVCpu The cross context virtual CPU structure.
55 * @param pvUser The user argument.
56 */
57typedef DECLCALLBACKTYPE(int, FNVMMR0ASSERTIONNOTIFICATION,(PVMCPUCC pVCpu, void *pvUser));
58/** Pointer to a FNVMMR0ASSERTIONNOTIFICATION(). */
59typedef FNVMMR0ASSERTIONNOTIFICATION *PFNVMMR0ASSERTIONNOTIFICATION;
60
61/**
62 * Rendezvous callback.
63 *
64 * @returns VBox strict status code - EM scheduling. Do not return
65 * informational status code other than the ones used by EM for
66 * scheduling.
67 *
68 * @param pVM The cross context VM structure.
69 * @param pVCpu The cross context virtual CPU structure of the calling EMT.
70 * @param pvUser The user argument.
71 */
72typedef DECLCALLBACKTYPE(VBOXSTRICTRC, FNVMMEMTRENDEZVOUS,(PVM pVM, PVMCPU pVCpu, void *pvUser));
73/** Pointer to a rendezvous callback function. */
74typedef FNVMMEMTRENDEZVOUS *PFNVMMEMTRENDEZVOUS;
75
76/**
77 * Method table that the VMM uses to call back the user of the VMM.
78 */
79typedef struct VMM2USERMETHODS
80{
81 /** Magic value (VMM2USERMETHODS_MAGIC). */
82 uint32_t u32Magic;
83 /** Structure version (VMM2USERMETHODS_VERSION). */
84 uint32_t u32Version;
85
86 /**
87 * Save the VM state.
88 *
89 * @returns VBox status code.
90 * @param pThis Pointer to the callback method table.
91 * @param pUVM The user mode VM handle.
92 *
93 * @remarks This member shall be set to NULL if the operation is not
94 * supported.
95 */
96 DECLR3CALLBACKMEMBER(int, pfnSaveState,(PCVMM2USERMETHODS pThis, PUVM pUVM));
97 /** @todo Move pfnVMAtError and pfnCFGMConstructor here? */
98
99 /**
100 * EMT initialization notification callback.
101 *
102 * This is intended for doing per-thread initialization for EMTs (like COM
103 * init).
104 *
105 * @param pThis Pointer to the callback method table.
106 * @param pUVM The user mode VM handle.
107 * @param pUVCpu The user mode virtual CPU handle.
108 *
109 * @remarks This is optional and shall be set to NULL if not wanted.
110 */
111 DECLR3CALLBACKMEMBER(void, pfnNotifyEmtInit,(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu));
112
113 /**
114 * EMT termination notification callback.
115 *
116 * This is intended for doing per-thread cleanups for EMTs (like COM).
117 *
118 * @param pThis Pointer to the callback method table.
119 * @param pUVM The user mode VM handle.
120 * @param pUVCpu The user mode virtual CPU handle.
121 *
122 * @remarks This is optional and shall be set to NULL if not wanted.
123 */
124 DECLR3CALLBACKMEMBER(void, pfnNotifyEmtTerm,(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu));
125
126 /**
127 * PDM thread initialization notification callback.
128 *
129 * This is intended for doing per-thread initialization (like COM init).
130 *
131 * @param pThis Pointer to the callback method table.
132 * @param pUVM The user mode VM handle.
133 *
134 * @remarks This is optional and shall be set to NULL if not wanted.
135 */
136 DECLR3CALLBACKMEMBER(void, pfnNotifyPdmtInit,(PCVMM2USERMETHODS pThis, PUVM pUVM));
137
138 /**
139 * EMT termination notification callback.
140 *
141 * This is intended for doing per-thread cleanups for EMTs (like COM).
142 *
143 * @param pThis Pointer to the callback method table.
144 * @param pUVM The user mode VM handle.
145 *
146 * @remarks This is optional and shall be set to NULL if not wanted.
147 */
148 DECLR3CALLBACKMEMBER(void, pfnNotifyPdmtTerm,(PCVMM2USERMETHODS pThis, PUVM pUVM));
149
150 /**
151 * Notification callback that that a VM reset will be turned into a power off.
152 *
153 * @param pThis Pointer to the callback method table.
154 * @param pUVM The user mode VM handle.
155 *
156 * @remarks This is optional and shall be set to NULL if not wanted.
157 */
158 DECLR3CALLBACKMEMBER(void, pfnNotifyResetTurnedIntoPowerOff,(PCVMM2USERMETHODS pThis, PUVM pUVM));
159
160 /**
161 * Generic object query by UUID.
162 *
163 * @returns pointer to queried the object on success, NULL if not found.
164 *
165 * @param pThis Pointer to the callback method table.
166 * @param pUVM The user mode VM handle.
167 * @param pUuid The UUID of what's being queried. The UUIDs and the
168 * usage conventions are defined by the user.
169 *
170 * @remarks This is optional and shall be set to NULL if not wanted.
171 */
172 DECLR3CALLBACKMEMBER(void *, pfnQueryGenericObject,(PCVMM2USERMETHODS pThis, PUVM pUVM, PCRTUUID pUuid));
173
174 /** Magic value (VMM2USERMETHODS_MAGIC) marking the end of the structure. */
175 uint32_t u32EndMagic;
176} VMM2USERMETHODS;
177
178/** Magic value of the VMM2USERMETHODS (Franz Kafka). */
179#define VMM2USERMETHODS_MAGIC UINT32_C(0x18830703)
180/** The VMM2USERMETHODS structure version. */
181#define VMM2USERMETHODS_VERSION UINT32_C(0x00030000)
182
183
184/**
185 * Checks whether we've armed the ring-0 long jump machinery.
186 *
187 * @returns @c true / @c false
188 * @param a_pVCpu The caller's cross context virtual CPU structure.
189 * @thread EMT
190 * @sa VMMR0IsLongJumpArmed
191 */
192#ifdef IN_RING0
193# define VMMIsLongJumpArmed(a_pVCpu) VMMR0IsLongJumpArmed(a_pVCpu)
194#else
195# define VMMIsLongJumpArmed(a_pVCpu) (false)
196#endif
197
198
199VMMDECL(VMCPUID) VMMGetCpuId(PVMCC pVM);
200VMMDECL(PVMCPUCC) VMMGetCpu(PVMCC pVM);
201VMMDECL(PVMCPUCC) VMMGetCpu0(PVMCC pVM);
202VMMDECL(PVMCPUCC) VMMGetCpuById(PVMCC pVM, VMCPUID idCpu);
203VMMR3DECL(PVMCPUCC) VMMR3GetCpuByIdU(PUVM pVM, VMCPUID idCpu);
204VMM_INT_DECL(uint32_t) VMMGetSvnRev(void);
205VMM_INT_DECL(bool) VMMIsInRing3Call(PVMCPUCC pVCpu);
206VMM_INT_DECL(void) VMMTrashVolatileXMMRegs(void);
207
208
209/** @defgroup grp_vmm_api_r0 The VMM Host Context Ring 0 API
210 * @{
211 */
212
213/**
214 * The VMMR0Entry() codes.
215 */
216typedef enum VMMR0OPERATION
217{
218 /** Run guest code using the available hardware acceleration technology. */
219 VMMR0_DO_HM_RUN = SUP_VMMR0_DO_HM_RUN,
220 /** Official NOP that we use for profiling. */
221 VMMR0_DO_NEM_RUN = SUP_VMMR0_DO_NEM_RUN,
222 /** Official NOP that we use for profiling. */
223 VMMR0_DO_NOP = SUP_VMMR0_DO_NOP,
224 /** Official slow iocl NOP that we use for profiling. */
225 VMMR0_DO_SLOW_NOP,
226
227 /** Ask the GVMM to create a new VM. */
228 VMMR0_DO_GVMM_CREATE_VM = 32,
229 /** Ask the GVMM to destroy the VM. */
230 VMMR0_DO_GVMM_DESTROY_VM,
231 /** Call GVMMR0RegisterVCpu(). */
232 VMMR0_DO_GVMM_REGISTER_VMCPU,
233 /** Call GVMMR0DeregisterVCpu(). */
234 VMMR0_DO_GVMM_DEREGISTER_VMCPU,
235 /** Call GVMMR0RegisterWorkerThread(). */
236 VMMR0_DO_GVMM_REGISTER_WORKER_THREAD,
237 /** Call GVMMR0DeregisterWorkerThread(). */
238 VMMR0_DO_GVMM_DEREGISTER_WORKER_THREAD,
239 /** Call GVMMR0SchedHalt(). */
240 VMMR0_DO_GVMM_SCHED_HALT,
241 /** Call GVMMR0SchedWakeUp(). */
242 VMMR0_DO_GVMM_SCHED_WAKE_UP,
243 /** Call GVMMR0SchedPoke(). */
244 VMMR0_DO_GVMM_SCHED_POKE,
245 /** Call GVMMR0SchedWakeUpAndPokeCpus(). */
246 VMMR0_DO_GVMM_SCHED_WAKE_UP_AND_POKE_CPUS,
247 /** Call GVMMR0SchedPoll(). */
248 VMMR0_DO_GVMM_SCHED_POLL,
249 /** Call GVMMR0QueryStatistics(). */
250 VMMR0_DO_GVMM_QUERY_STATISTICS,
251 /** Call GVMMR0ResetStatistics(). */
252 VMMR0_DO_GVMM_RESET_STATISTICS,
253
254 /** Call VMMR0 Per VM Init. */
255 VMMR0_DO_VMMR0_INIT = 64,
256 /** Call VMMR0 Per VM EMT Init */
257 VMMR0_DO_VMMR0_INIT_EMT,
258 /** Call VMMR0 Per VM Termination. */
259 VMMR0_DO_VMMR0_TERM,
260 /** Copy logger settings from userland, VMMR0UpdateLoggersReq(). */
261 VMMR0_DO_VMMR0_UPDATE_LOGGERS,
262 /** Used by the log flusher, VMMR0LogFlusher. */
263 VMMR0_DO_VMMR0_LOG_FLUSHER,
264 /** Used by EMTs to wait for the log flusher to finish, VMMR0LogWaitFlushed. */
265 VMMR0_DO_VMMR0_LOG_WAIT_FLUSHED,
266
267 /** Setup hardware-assisted VM session. */
268 VMMR0_DO_HM_SETUP_VM = 128,
269 /** Attempt to enable or disable hardware-assisted mode. */
270 VMMR0_DO_HM_ENABLE,
271
272 /** Call PGMR0PhysAllocateHandyPages(). */
273 VMMR0_DO_PGM_ALLOCATE_HANDY_PAGES = 192,
274 /** Call PGMR0PhysFlushHandyPages(). */
275 VMMR0_DO_PGM_FLUSH_HANDY_PAGES,
276 /** Call PGMR0AllocateLargePage(). */
277 VMMR0_DO_PGM_ALLOCATE_LARGE_PAGE,
278 /** Call PGMR0PhysSetupIommu(). */
279 VMMR0_DO_PGM_PHYS_SETUP_IOMMU,
280 /** Call PGMR0PoolGrow(). */
281 VMMR0_DO_PGM_POOL_GROW,
282
283 /** Call GMMR0InitialReservation(). */
284 VMMR0_DO_GMM_INITIAL_RESERVATION = 256,
285 /** Call GMMR0UpdateReservation(). */
286 VMMR0_DO_GMM_UPDATE_RESERVATION,
287 /** Call GMMR0AllocatePages(). */
288 VMMR0_DO_GMM_ALLOCATE_PAGES,
289 /** Call GMMR0FreePages(). */
290 VMMR0_DO_GMM_FREE_PAGES,
291 /** Call GMMR0FreeLargePage(). */
292 VMMR0_DO_GMM_FREE_LARGE_PAGE,
293 /** Call GMMR0QueryHypervisorMemoryStatsReq(). */
294 VMMR0_DO_GMM_QUERY_HYPERVISOR_MEM_STATS,
295 /** Call GMMR0QueryMemoryStatsReq(). */
296 VMMR0_DO_GMM_QUERY_MEM_STATS,
297 /** Call GMMR0BalloonedPages(). */
298 VMMR0_DO_GMM_BALLOONED_PAGES,
299 /** Call GMMR0MapUnmapChunk(). */
300 VMMR0_DO_GMM_MAP_UNMAP_CHUNK,
301 /** Call GMMR0RegisterSharedModule. */
302 VMMR0_DO_GMM_REGISTER_SHARED_MODULE,
303 /** Call GMMR0UnregisterSharedModule. */
304 VMMR0_DO_GMM_UNREGISTER_SHARED_MODULE,
305 /** Call GMMR0ResetSharedModules. */
306 VMMR0_DO_GMM_RESET_SHARED_MODULES,
307 /** Call GMMR0CheckSharedModules. */
308 VMMR0_DO_GMM_CHECK_SHARED_MODULES,
309 /** Call GMMR0FindDuplicatePage. */
310 VMMR0_DO_GMM_FIND_DUPLICATE_PAGE,
311 /** Call GMMR0QueryStatistics(). */
312 VMMR0_DO_GMM_QUERY_STATISTICS,
313 /** Call GMMR0ResetStatistics(). */
314 VMMR0_DO_GMM_RESET_STATISTICS,
315
316 /** Call PDMR0DriverCallReqHandler. */
317 VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER = 320,
318 /** Call PDMR0DeviceCreateReqHandler. */
319 VMMR0_DO_PDM_DEVICE_CREATE,
320 /** Call PDMR0DeviceGenCallReqHandler. */
321 VMMR0_DO_PDM_DEVICE_GEN_CALL,
322 /** Old style device compat: Set ring-0 critical section. */
323 VMMR0_DO_PDM_DEVICE_COMPAT_SET_CRITSECT,
324
325 /** Set a GVMM or GMM configuration value. */
326 VMMR0_DO_GCFGM_SET_VALUE = 400,
327 /** Query a GVMM or GMM configuration value. */
328 VMMR0_DO_GCFGM_QUERY_VALUE,
329
330 /** The start of the R0 service operations. */
331 VMMR0_DO_SRV_START = 448,
332 /** Call IntNetR0Open(). */
333 VMMR0_DO_INTNET_OPEN,
334 /** Call IntNetR0IfClose(). */
335 VMMR0_DO_INTNET_IF_CLOSE,
336 /** Call IntNetR0IfGetBufferPtrs(). */
337 VMMR0_DO_INTNET_IF_GET_BUFFER_PTRS,
338 /** Call IntNetR0IfSetPromiscuousMode(). */
339 VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE,
340 /** Call IntNetR0IfSetMacAddress(). */
341 VMMR0_DO_INTNET_IF_SET_MAC_ADDRESS,
342 /** Call IntNetR0IfSetActive(). */
343 VMMR0_DO_INTNET_IF_SET_ACTIVE,
344 /** Call IntNetR0IfSend(). */
345 VMMR0_DO_INTNET_IF_SEND,
346 /** Call IntNetR0IfWait(). */
347 VMMR0_DO_INTNET_IF_WAIT,
348 /** Call IntNetR0IfAbortWait(). */
349 VMMR0_DO_INTNET_IF_ABORT_WAIT,
350
351#if 0
352 /** Forward call to the PCI driver */
353 VMMR0_DO_PCIRAW_REQ = 512,
354#endif
355
356 /** The end of the R0 service operations. */
357 VMMR0_DO_SRV_END,
358
359 /** Call NEMR0InitVM() (host specific). */
360 VMMR0_DO_NEM_INIT_VM = 576,
361 /** Call NEMR0InitVMPart2() (host specific). */
362 VMMR0_DO_NEM_INIT_VM_PART_2,
363 /** Call NEMR0MapPages() (host specific). */
364 VMMR0_DO_NEM_MAP_PAGES,
365 /** Call NEMR0UnmapPages() (host specific). */
366 VMMR0_DO_NEM_UNMAP_PAGES,
367 /** Call NEMR0ExportState() (host specific). */
368 VMMR0_DO_NEM_EXPORT_STATE,
369 /** Call NEMR0ImportState() (host specific). */
370 VMMR0_DO_NEM_IMPORT_STATE,
371 /** Call NEMR0QueryCpuTick() (host specific). */
372 VMMR0_DO_NEM_QUERY_CPU_TICK,
373 /** Call NEMR0ResumeCpuTickOnAll() (host specific). */
374 VMMR0_DO_NEM_RESUME_CPU_TICK_ON_ALL,
375 /** Call NEMR0UpdateStatistics() (host specific). */
376 VMMR0_DO_NEM_UPDATE_STATISTICS,
377 /** Call NEMR0DoExperiment() (host specific, experimental, debug only). */
378 VMMR0_DO_NEM_EXPERIMENT,
379
380 /** Grow the I/O port registration tables. */
381 VMMR0_DO_IOM_GROW_IO_PORTS = 640,
382 /** Grow the I/O port statistics tables. */
383 VMMR0_DO_IOM_GROW_IO_PORT_STATS,
384 /** Grow the MMIO registration tables. */
385 VMMR0_DO_IOM_GROW_MMIO_REGS,
386 /** Grow the MMIO statistics tables. */
387 VMMR0_DO_IOM_GROW_MMIO_STATS,
388 /** Synchronize statistics indices for I/O ports and MMIO regions. */
389 VMMR0_DO_IOM_SYNC_STATS_INDICES,
390
391 /** Call DBGFR0TraceCreateReqHandler. */
392 VMMR0_DO_DBGF_TRACER_CREATE = 704,
393 /** Call DBGFR0TraceCallReqHandler. */
394 VMMR0_DO_DBGF_TRACER_CALL_REQ_HANDLER,
395 /** Call DBGFR0BpInitReqHandler(). */
396 VMMR0_DO_DBGF_BP_INIT,
397 /** Call DBGFR0BpChunkAllocReqHandler(). */
398 VMMR0_DO_DBGF_BP_CHUNK_ALLOC,
399 /** Call DBGFR0BpL2TblChunkAllocReqHandler(). */
400 VMMR0_DO_DBGF_BP_L2_TBL_CHUNK_ALLOC,
401 /** Call DBGFR0BpOwnerInitReqHandler(). */
402 VMMR0_DO_DBGF_BP_OWNER_INIT,
403 /** Call DBGFR0BpPortIoInitReqHandler(). */
404 VMMR0_DO_DBGF_BP_PORTIO_INIT,
405
406 /** Grow a timer queue. */
407 VMMR0_DO_TM_GROW_TIMER_QUEUE = 768,
408
409 /** Official call we use for testing Ring-0 APIs. */
410 VMMR0_DO_TESTS = 2048,
411
412 /** The usual 32-bit type blow up. */
413 VMMR0_DO_32BIT_HACK = 0x7fffffff
414} VMMR0OPERATION;
415
416
417/**
418 * Request buffer for VMMR0_DO_GCFGM_SET_VALUE and VMMR0_DO_GCFGM_QUERY_VALUE.
419 * @todo Move got GCFGM.h when it's implemented.
420 */
421typedef struct GCFGMVALUEREQ
422{
423 /** The request header.*/
424 SUPVMMR0REQHDR Hdr;
425 /** The support driver session handle. */
426 PSUPDRVSESSION pSession;
427 /** The value.
428 * This is input for the set request and output for the query. */
429 uint64_t u64Value;
430 /** The variable name.
431 * This is fixed sized just to make things simple for the mock-up. */
432 char szName[48];
433} GCFGMVALUEREQ;
434/** Pointer to a VMMR0_DO_GCFGM_SET_VALUE and VMMR0_DO_GCFGM_QUERY_VALUE request buffer.
435 * @todo Move got GCFGM.h when it's implemented.
436 */
437typedef GCFGMVALUEREQ *PGCFGMVALUEREQ;
438
439
440/**
441 * Request package for VMMR0_DO_VMMR0_UPDATE_LOGGERS.
442 *
443 * In addition the u64Arg selects the logger sets: @c false for debug, @c true
444 * for release.
445 */
446typedef struct VMMR0UPDATELOGGERSREQ
447{
448 /** The request header. */
449 SUPVMMR0REQHDR Hdr;
450 /** The current logger flags (RTLOGFLAGS). */
451 uint64_t fFlags;
452 /** Groups, assuming same group layout as ring-3. */
453 uint32_t cGroups;
454 /** CRC32 of the group names. */
455 uint32_t uGroupCrc32;
456 /** Per-group settings, variable size. */
457 RT_FLEXIBLE_ARRAY_EXTENSION
458 uint32_t afGroups[RT_FLEXIBLE_ARRAY];
459} VMMR0UPDATELOGGERSREQ;
460/** Pointer to a VMMR0_DO_VMMR0_UPDATE_LOGGERS request. */
461typedef VMMR0UPDATELOGGERSREQ *PVMMR0UPDATELOGGERSREQ;
462
463#if defined(IN_RING0) || defined(DOXYGEN_RUNNING)
464
465/**
466 * Structure VMMR0EmtPrepareToBlock uses to pass info to
467 * VMMR0EmtResumeAfterBlocking.
468 */
469typedef struct VMMR0EMTBLOCKCTX
470{
471 /** Magic value (VMMR0EMTBLOCKCTX_MAGIC). */
472 uint32_t uMagic;
473 /** Set if we were in HM context, clear if not. */
474 bool fWasInHmContext;
475} VMMR0EMTBLOCKCTX;
476/** Pointer to a VMMR0EmtPrepareToBlock context structure. */
477typedef VMMR0EMTBLOCKCTX *PVMMR0EMTBLOCKCTX;
478/** Magic value for VMMR0EMTBLOCKCTX::uMagic (Paul Desmond). */
479#define VMMR0EMTBLOCKCTX_MAGIC UINT32_C(0x19261125)
480/** Magic value for VMMR0EMTBLOCKCTX::uMagic when its out of context. */
481#define VMMR0EMTBLOCKCTX_MAGIC_DEAD UINT32_C(0x19770530)
482
483VMMR0DECL(void) VMMR0EntryFast(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation);
484VMMR0DECL(int) VMMR0EntryEx(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation,
485 PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION);
486VMMR0_INT_DECL(int) VMMR0InitPerVMData(PGVM pGVM);
487VMMR0_INT_DECL(int) VMMR0TermVM(PGVM pGVM, VMCPUID idCpu);
488VMMR0_INT_DECL(void) VMMR0CleanupVM(PGVM pGVM);
489VMMR0_INT_DECL(bool) VMMR0IsLongJumpArmed(PVMCPUCC pVCpu);
490VMMR0_INT_DECL(bool) VMMR0IsInRing3LongJump(PVMCPUCC pVCpu);
491VMMR0_INT_DECL(int) VMMR0ThreadCtxHookCreateForEmt(PVMCPUCC pVCpu);
492VMMR0_INT_DECL(void) VMMR0ThreadCtxHookDestroyForEmt(PVMCPUCC pVCpu);
493VMMR0_INT_DECL(void) VMMR0ThreadCtxHookDisable(PVMCPUCC pVCpu);
494VMMR0_INT_DECL(bool) VMMR0ThreadCtxHookIsEnabled(PVMCPUCC pVCpu);
495VMMR0_INT_DECL(int) VMMR0EmtPrepareToBlock(PVMCPUCC pVCpu, int rcBusy, const char *pszCaller, void *pvLock,
496 PVMMR0EMTBLOCKCTX pCtx);
497VMMR0_INT_DECL(void) VMMR0EmtResumeAfterBlocking(PVMCPUCC pVCpu, PVMMR0EMTBLOCKCTX pCtx);
498VMMR0_INT_DECL(int) VMMR0EmtWaitEventInner(PGVMCPU pGVCpu, uint32_t fFlags, RTSEMEVENT hEvent, RTMSINTERVAL cMsTimeout);
499VMMR0_INT_DECL(int) VMMR0EmtSignalSupEvent(PGVM pGVM, PGVMCPU pGVCpu, SUPSEMEVENT hEvent);
500VMMR0_INT_DECL(int) VMMR0EmtSignalSupEventByGVM(PGVM pGVM, SUPSEMEVENT hEvent);
501VMMR0_INT_DECL(int) VMMR0AssertionSetNotification(PVMCPUCC pVCpu, PFNVMMR0ASSERTIONNOTIFICATION pfnCallback, RTR0PTR pvUser);
502VMMR0_INT_DECL(void) VMMR0AssertionRemoveNotification(PVMCPUCC pVCpu);
503VMMR0_INT_DECL(bool) VMMR0AssertionIsNotificationSet(PVMCPUCC pVCpu);
504
505/** @name VMMR0EMTWAIT_F_XXX - flags for VMMR0EmtWaitEventInner and friends.
506 * @{ */
507/** Try suppress VERR_INTERRUPTED for a little while (~10 sec). */
508#define VMMR0EMTWAIT_F_TRY_SUPPRESS_INTERRUPTED RT_BIT_32(0)
509/** @} */
510#endif /* IN_RING0 */
511
512VMMR0_INT_DECL(PRTLOGGER) VMMR0GetReleaseLogger(PVMCPUCC pVCpu);
513/** @} */
514
515
516#if defined(IN_RING3) || defined(DOXYGEN_RUNNING)
517/** @defgroup grp_vmm_api_r3 The VMM Host Context Ring 3 API
518 * @{
519 */
520VMMR3_INT_DECL(int) VMMR3Init(PVM pVM);
521VMMR3_INT_DECL(int) VMMR3InitR0(PVM pVM);
522VMMR3_INT_DECL(int) VMMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
523VMMR3_INT_DECL(int) VMMR3Term(PVM pVM);
524VMMR3_INT_DECL(void) VMMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
525VMMR3_INT_DECL(int) VMMR3UpdateLoggers(PVM pVM);
526VMMR3DECL(const char *) VMMR3GetRZAssertMsg1(PVM pVM);
527VMMR3DECL(const char *) VMMR3GetRZAssertMsg2(PVM pVM);
528VMMR3_INT_DECL(int) VMMR3HmRunGC(PVM pVM, PVMCPU pVCpu);
529VMMR3DECL(int) VMMR3CallR0(PVM pVM, uint32_t uOperation, uint64_t u64Arg, PSUPVMMR0REQHDR pReqHdr);
530VMMR3_INT_DECL(int) VMMR3CallR0Emt(PVM pVM, PVMCPU pVCpu, VMMR0OPERATION enmOperation, uint64_t u64Arg, PSUPVMMR0REQHDR pReqHdr);
531VMMR3_INT_DECL(VBOXSTRICTRC) VMMR3CallR0EmtFast(PVM pVM, PVMCPU pVCpu, VMMR0OPERATION enmOperation);
532VMMR3DECL(void) VMMR3FatalDump(PVM pVM, PVMCPU pVCpu, int rcErr);
533VMMR3_INT_DECL(void) VMMR3YieldSuspend(PVM pVM);
534VMMR3_INT_DECL(void) VMMR3YieldStop(PVM pVM);
535VMMR3_INT_DECL(void) VMMR3YieldResume(PVM pVM);
536VMMR3_INT_DECL(void) VMMR3SendStartupIpi(PVM pVM, VMCPUID idCpu, uint32_t uVector);
537VMMR3_INT_DECL(void) VMMR3SendInitIpi(PVM pVM, VMCPUID idCpu);
538VMMR3DECL(int) VMMR3RegisterPatchMemory(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem);
539VMMR3DECL(int) VMMR3DeregisterPatchMemory(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem);
540VMMR3DECL(int) VMMR3EmtRendezvous(PVM pVM, uint32_t fFlags, PFNVMMEMTRENDEZVOUS pfnRendezvous, void *pvUser);
541/** @defgroup grp_VMMR3EmtRendezvous_fFlags VMMR3EmtRendezvous flags
542 * @{ */
543/** Execution type mask. */
544#define VMMEMTRENDEZVOUS_FLAGS_TYPE_MASK UINT32_C(0x00000007)
545/** Invalid execution type. */
546#define VMMEMTRENDEZVOUS_FLAGS_TYPE_INVALID UINT32_C(0)
547/** Let the EMTs execute the callback one by one (in no particular order).
548 * Recursion from within the callback possible. */
549#define VMMEMTRENDEZVOUS_FLAGS_TYPE_ONE_BY_ONE UINT32_C(1)
550/** Let all the EMTs execute the callback at the same time.
551 * Cannot recurse from the callback. */
552#define VMMEMTRENDEZVOUS_FLAGS_TYPE_ALL_AT_ONCE UINT32_C(2)
553/** Only execute the callback on one EMT (no particular one).
554 * Recursion from within the callback possible. */
555#define VMMEMTRENDEZVOUS_FLAGS_TYPE_ONCE UINT32_C(3)
556/** Let the EMTs execute the callback one by one in ascending order.
557 * Recursion from within the callback possible. */
558#define VMMEMTRENDEZVOUS_FLAGS_TYPE_ASCENDING UINT32_C(4)
559/** Let the EMTs execute the callback one by one in descending order.
560 * Recursion from within the callback possible. */
561#define VMMEMTRENDEZVOUS_FLAGS_TYPE_DESCENDING UINT32_C(5)
562/** Stop after the first error.
563 * This is not valid for any execution type where more than one EMT is active
564 * at a time. */
565#define VMMEMTRENDEZVOUS_FLAGS_STOP_ON_ERROR UINT32_C(0x00000008)
566/** Use VMREQFLAGS_PRIORITY when contacting the EMTs. */
567#define VMMEMTRENDEZVOUS_FLAGS_PRIORITY UINT32_C(0x00000010)
568/** The valid flags. */
569#define VMMEMTRENDEZVOUS_FLAGS_VALID_MASK UINT32_C(0x0000001f)
570/** @} */
571VMMR3_INT_DECL(int) VMMR3EmtRendezvousFF(PVM pVM, PVMCPU pVCpu);
572VMMR3_INT_DECL(void) VMMR3SetMayHaltInRing0(PVMCPU pVCpu, bool fMayHaltInRing0, uint32_t cNsSpinBlockThreshold);
573VMMR3_INT_DECL(int) VMMR3ReadR0Stack(PVM pVM, VMCPUID idCpu, RTHCUINTPTR R0Addr, void *pvBuf, size_t cbRead);
574VMMR3_INT_DECL(void) VMMR3InitR0StackUnwindState(PUVM pUVM, VMCPUID idCpu, PRTDBGUNWINDSTATE pState);
575/** @} */
576#endif /* IN_RING3 */
577
578
579#if defined(IN_RC) || defined(IN_RING0) || defined(DOXYGEN_RUNNING)
580/** @defgroup grp_vmm_api_rz The VMM Raw-Mode and Ring-0 Context API
581 * @{
582 */
583VMMRZDECL(void) VMMRZCallRing3Disable(PVMCPUCC pVCpu);
584VMMRZDECL(void) VMMRZCallRing3Enable(PVMCPUCC pVCpu);
585VMMRZDECL(bool) VMMRZCallRing3IsEnabled(PVMCPUCC pVCpu);
586/** @} */
587#endif
588
589
590/** Wrapper around AssertReleaseMsgReturn that avoid tripping up in the
591 * kernel when we don't have a setjmp in place. */
592#ifdef IN_RING0
593# define VMM_ASSERT_RELEASE_MSG_RETURN(a_pVM, a_Expr, a_Msg, a_rc) do { \
594 if (RT_LIKELY(a_Expr)) { /* likely */ } \
595 else \
596 { \
597 PVMCPUCC pVCpuAssert = VMMGetCpu(a_pVM); \
598 if (pVCpuAssert && VMMR0IsLongJumpArmed(pVCpuAssert)) \
599 AssertReleaseMsg(a_Expr, a_Msg); \
600 else \
601 AssertLogRelMsg(a_Expr, a_Msg); \
602 return (a_rc); \
603 } \
604 } while (0)
605#else
606# define VMM_ASSERT_RELEASE_MSG_RETURN(a_pVM, a_Expr, a_Msg, a_rc) AssertReleaseMsgReturn(a_Expr, a_Msg, a_rc)
607#endif
608
609/** @} */
610
611/** @} */
612RT_C_DECLS_END
613
614#endif /* !VBOX_INCLUDED_vmm_vmm_h */
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