VirtualBox

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

Last change on this file since 47894 was 47760, checked in by vboxsync, 12 years ago

VMM/HM: Preemption hooks. Some common structural changes and cleanup, and initial imlementation
of VT-x/AMD-V specific hook functionality.. Work in progress.

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

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