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