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