VirtualBox

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

Last change on this file since 49868 was 48528, checked in by vboxsync, 12 years ago

Change implementation for turning a reset into a power off to prevent the VM from executing while the power down thread is not running

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