VirtualBox

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

最後變更 在這個檔案從92391是 92391,由 vboxsync 提交於 3 年 前

VMM/PGM,GMM: Made pgmR0PhysAllocateHandyPages & GMMR0AllocateHandyPages callable from ring-0 HM context, eliminating the need for the call-ring-3 fun. bugref:10093

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette