VirtualBox

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

Last change on this file since 58125 was 58125, checked in by vboxsync, 9 years ago

oops

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