1 | /** @file
|
---|
2 | * VM - The Virtual Machine, API.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2017 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_vmapi_h
|
---|
27 | #define ___VBox_vmm_vmapi_h
|
---|
28 |
|
---|
29 | #include <VBox/types.h>
|
---|
30 | #include <VBox/vmm/stam.h>
|
---|
31 | #include <VBox/vmm/cfgm.h>
|
---|
32 |
|
---|
33 | #include <iprt/stdarg.h>
|
---|
34 |
|
---|
35 | RT_C_DECLS_BEGIN
|
---|
36 |
|
---|
37 | /** @defgroup grp_vm_apis VM All Contexts API
|
---|
38 | * @ingroup grp_vm
|
---|
39 | * @{ */
|
---|
40 |
|
---|
41 | /** @def VM_RC_ADDR
|
---|
42 | * Converts a current context address of data within the VM structure to the equivalent
|
---|
43 | * raw-mode address.
|
---|
44 | *
|
---|
45 | * @returns raw-mode virtual address.
|
---|
46 | * @param pVM The cross context VM structure.
|
---|
47 | * @param pvInVM CC Pointer within the VM.
|
---|
48 | */
|
---|
49 | #ifdef IN_RING3
|
---|
50 | # define VM_RC_ADDR(pVM, pvInVM) ( (RTRCPTR)((RTRCUINTPTR)pVM->pVMRC + (uint32_t)((uintptr_t)(pvInVM) - (uintptr_t)pVM->pVMR3)) )
|
---|
51 | #elif defined(IN_RING0)
|
---|
52 | # define VM_RC_ADDR(pVM, pvInVM) ( (RTRCPTR)((RTRCUINTPTR)pVM->pVMRC + (uint32_t)((uintptr_t)(pvInVM) - (uintptr_t)pVM->pVMR0)) )
|
---|
53 | #else
|
---|
54 | # define VM_RC_ADDR(pVM, pvInVM) ( (RTRCPTR)(pvInVM) )
|
---|
55 | #endif
|
---|
56 |
|
---|
57 | /** @def VM_R3_ADDR
|
---|
58 | * Converts a current context address of data within the VM structure to the equivalent
|
---|
59 | * ring-3 host address.
|
---|
60 | *
|
---|
61 | * @returns host virtual address.
|
---|
62 | * @param pVM The cross context VM structure.
|
---|
63 | * @param pvInVM CC pointer within the VM.
|
---|
64 | */
|
---|
65 | #ifdef IN_RC
|
---|
66 | # define VM_R3_ADDR(pVM, pvInVM) ( (RTR3PTR)((RTR3UINTPTR)pVM->pVMR3 + (uint32_t)((uintptr_t)(pvInVM) - (uintptr_t)pVM->pVMRC)) )
|
---|
67 | #elif defined(IN_RING0)
|
---|
68 | # define VM_R3_ADDR(pVM, pvInVM) ( (RTR3PTR)((RTR3UINTPTR)pVM->pVMR3 + (uint32_t)((uintptr_t)(pvInVM) - (uintptr_t)pVM->pVMR0)) )
|
---|
69 | #else
|
---|
70 | # define VM_R3_ADDR(pVM, pvInVM) ( (RTR3PTR)(pvInVM) )
|
---|
71 | #endif
|
---|
72 |
|
---|
73 |
|
---|
74 | /** @def VM_R0_ADDR
|
---|
75 | * Converts a current context address of data within the VM structure to the equivalent
|
---|
76 | * ring-0 host address.
|
---|
77 | *
|
---|
78 | * @returns host virtual address.
|
---|
79 | * @param pVM The cross context VM structure.
|
---|
80 | * @param pvInVM CC pointer within the VM.
|
---|
81 | */
|
---|
82 | #ifdef IN_RC
|
---|
83 | # define VM_R0_ADDR(pVM, pvInVM) ( (RTR0PTR)((RTR0UINTPTR)pVM->pVMR0 + (uint32_t)((uintptr_t)(pvInVM) - (uintptr_t)pVM->pVMRC)) )
|
---|
84 | #elif defined(IN_RING3)
|
---|
85 | # define VM_R0_ADDR(pVM, pvInVM) ( (RTR0PTR)((RTR0UINTPTR)pVM->pVMR0 + (uint32_t)((uintptr_t)(pvInVM) - (uintptr_t)pVM->pVMR3)) )
|
---|
86 | #else
|
---|
87 | # define VM_R0_ADDR(pVM, pvInVM) ( (RTR0PTR)(pvInVM) )
|
---|
88 | #endif
|
---|
89 |
|
---|
90 |
|
---|
91 |
|
---|
92 | /**
|
---|
93 | * VM error callback function.
|
---|
94 | *
|
---|
95 | * @param pUVM The user mode VM handle. Can be NULL if an error
|
---|
96 | * occurred before successfully creating a VM.
|
---|
97 | * @param pvUser The user argument.
|
---|
98 | * @param rc VBox status code.
|
---|
99 | * @param SRC_POS The source position arguments. See RT_SRC_POS and RT_SRC_POS_ARGS.
|
---|
100 | * @param pszFormat Error message format string.
|
---|
101 | * @param args Error message arguments.
|
---|
102 | */
|
---|
103 | typedef DECLCALLBACK(void) FNVMATERROR(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_DECL, const char *pszError, va_list args);
|
---|
104 | /** Pointer to a VM error callback. */
|
---|
105 | typedef FNVMATERROR *PFNVMATERROR;
|
---|
106 |
|
---|
107 | VMMDECL(int) VMSetError(PVM pVM, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(6, 7);
|
---|
108 | VMMDECL(int) VMSetErrorV(PVM pVM, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(6, 7);
|
---|
109 |
|
---|
110 | /** @def VM_SET_ERROR
|
---|
111 | * Macro for setting a simple VM error message.
|
---|
112 | * Don't use '%' in the message!
|
---|
113 | *
|
---|
114 | * @returns rc. Meaning you can do:
|
---|
115 | * @code
|
---|
116 | * return VM_SET_ERROR(pVM, VERR_OF_YOUR_CHOICE, "descriptive message");
|
---|
117 | * @endcode
|
---|
118 | * @param pVM The cross context VM structure.
|
---|
119 | * @param rc VBox status code.
|
---|
120 | * @param pszMessage Error message string.
|
---|
121 | * @thread Any
|
---|
122 | */
|
---|
123 | #define VM_SET_ERROR(pVM, rc, pszMessage) (VMSetError(pVM, rc, RT_SRC_POS, pszMessage))
|
---|
124 |
|
---|
125 | /** @def VM_SET_ERROR
|
---|
126 | * Macro for setting a simple VM error message.
|
---|
127 | * Don't use '%' in the message!
|
---|
128 | *
|
---|
129 | * @returns rc. Meaning you can do:
|
---|
130 | * @code
|
---|
131 | * return VM_SET_ERROR(pVM, VERR_OF_YOUR_CHOICE, "descriptive message");
|
---|
132 | * @endcode
|
---|
133 | * @param pVM The cross context VM structure.
|
---|
134 | * @param rc VBox status code.
|
---|
135 | * @param pszMessage Error message string.
|
---|
136 | * @thread Any
|
---|
137 | */
|
---|
138 | #define VM_SET_ERROR_U(a_pUVM, a_rc, a_pszMessage) (VMR3SetError(a_pUVM, a_rc, RT_SRC_POS, a_pszMessage))
|
---|
139 |
|
---|
140 |
|
---|
141 | /**
|
---|
142 | * VM runtime error callback function.
|
---|
143 | *
|
---|
144 | * See VMSetRuntimeError for the detailed description of parameters.
|
---|
145 | *
|
---|
146 | * @param pUVM The user mode VM handle.
|
---|
147 | * @param pvUser The user argument.
|
---|
148 | * @param fFlags The error flags.
|
---|
149 | * @param pszErrorId Error ID string.
|
---|
150 | * @param pszFormat Error message format string.
|
---|
151 | * @param va Error message arguments.
|
---|
152 | */
|
---|
153 | typedef DECLCALLBACK(void) FNVMATRUNTIMEERROR(PUVM pUVM, void *pvUser, uint32_t fFlags, const char *pszErrorId,
|
---|
154 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(5, 0);
|
---|
155 | /** Pointer to a VM runtime error callback. */
|
---|
156 | typedef FNVMATRUNTIMEERROR *PFNVMATRUNTIMEERROR;
|
---|
157 |
|
---|
158 | VMMDECL(int) VMSetRuntimeError(PVM pVM, uint32_t fFlags, const char *pszErrorId,
|
---|
159 | const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5);
|
---|
160 | VMMDECL(int) VMSetRuntimeErrorV(PVM pVM, uint32_t fFlags, const char *pszErrorId,
|
---|
161 | const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(4, 0);
|
---|
162 |
|
---|
163 | /** @name VMSetRuntimeError fFlags
|
---|
164 | * When no flags are given the VM will continue running and it's up to the front
|
---|
165 | * end to take action on the error condition.
|
---|
166 | *
|
---|
167 | * @{ */
|
---|
168 | /** The error is fatal.
|
---|
169 | * The VM is not in a state where it can be saved and will enter a state
|
---|
170 | * where it can no longer execute code. The caller <b>must</b> propagate status
|
---|
171 | * codes. */
|
---|
172 | #define VMSETRTERR_FLAGS_FATAL RT_BIT_32(0)
|
---|
173 | /** Suspend the VM after, or if possible before, raising the error on EMT. The
|
---|
174 | * caller <b>must</b> propagate status codes. */
|
---|
175 | #define VMSETRTERR_FLAGS_SUSPEND RT_BIT_32(1)
|
---|
176 | /** Don't wait for the EMT to handle the request.
|
---|
177 | * Only valid when on a worker thread and there is a high risk of a dead
|
---|
178 | * lock. Be careful not to flood the user with errors. */
|
---|
179 | #define VMSETRTERR_FLAGS_NO_WAIT RT_BIT_32(2)
|
---|
180 | /** @} */
|
---|
181 |
|
---|
182 | /**
|
---|
183 | * VM state change callback function.
|
---|
184 | *
|
---|
185 | * You are not allowed to call any function which changes the VM state from a
|
---|
186 | * state callback, except VMR3Destroy().
|
---|
187 | *
|
---|
188 | * @param pUVM The user mode VM handle.
|
---|
189 | * @param enmState The new state.
|
---|
190 | * @param enmOldState The old state.
|
---|
191 | * @param pvUser The user argument.
|
---|
192 | */
|
---|
193 | typedef DECLCALLBACK(void) FNVMATSTATE(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
|
---|
194 | /** Pointer to a VM state callback. */
|
---|
195 | typedef FNVMATSTATE *PFNVMATSTATE;
|
---|
196 |
|
---|
197 | VMMDECL(const char *) VMGetStateName(VMSTATE enmState);
|
---|
198 |
|
---|
199 |
|
---|
200 | /**
|
---|
201 | * Request type.
|
---|
202 | */
|
---|
203 | typedef enum VMREQTYPE
|
---|
204 | {
|
---|
205 | /** Invalid request. */
|
---|
206 | VMREQTYPE_INVALID = 0,
|
---|
207 | /** VM: Internal. */
|
---|
208 | VMREQTYPE_INTERNAL,
|
---|
209 | /** Maximum request type (exclusive). Used for validation. */
|
---|
210 | VMREQTYPE_MAX
|
---|
211 | } VMREQTYPE;
|
---|
212 |
|
---|
213 | /**
|
---|
214 | * Request state.
|
---|
215 | */
|
---|
216 | typedef enum VMREQSTATE
|
---|
217 | {
|
---|
218 | /** The state is invalid. */
|
---|
219 | VMREQSTATE_INVALID = 0,
|
---|
220 | /** The request have been allocated and is in the process of being filed. */
|
---|
221 | VMREQSTATE_ALLOCATED,
|
---|
222 | /** The request is queued by the requester. */
|
---|
223 | VMREQSTATE_QUEUED,
|
---|
224 | /** The request is begin processed. */
|
---|
225 | VMREQSTATE_PROCESSING,
|
---|
226 | /** The request is completed, the requester is begin notified. */
|
---|
227 | VMREQSTATE_COMPLETED,
|
---|
228 | /** The request packet is in the free chain. (The requester */
|
---|
229 | VMREQSTATE_FREE
|
---|
230 | } VMREQSTATE;
|
---|
231 |
|
---|
232 | /**
|
---|
233 | * Request flags.
|
---|
234 | */
|
---|
235 | typedef enum VMREQFLAGS
|
---|
236 | {
|
---|
237 | /** The request returns a VBox status code. */
|
---|
238 | VMREQFLAGS_VBOX_STATUS = 0,
|
---|
239 | /** The request is a void request and have no status code. */
|
---|
240 | VMREQFLAGS_VOID = 1,
|
---|
241 | /** Return type mask. */
|
---|
242 | VMREQFLAGS_RETURN_MASK = 1,
|
---|
243 | /** Caller does not wait on the packet, EMT will free it. */
|
---|
244 | VMREQFLAGS_NO_WAIT = 2,
|
---|
245 | /** Poke the destination EMT(s) if executing guest code. Use with care. */
|
---|
246 | VMREQFLAGS_POKE = 4,
|
---|
247 | /** Priority request that can safely be processed while doing async
|
---|
248 | * suspend and power off. */
|
---|
249 | VMREQFLAGS_PRIORITY = 8
|
---|
250 | } VMREQFLAGS;
|
---|
251 |
|
---|
252 |
|
---|
253 | /**
|
---|
254 | * VM Request packet.
|
---|
255 | *
|
---|
256 | * This is used to request an action in the EMT. Usually the requester is
|
---|
257 | * another thread, but EMT can also end up being the requester in which case
|
---|
258 | * it's carried out synchronously.
|
---|
259 | */
|
---|
260 | typedef struct VMREQ
|
---|
261 | {
|
---|
262 | /** Pointer to the next request in the chain. */
|
---|
263 | struct VMREQ * volatile pNext;
|
---|
264 | /** Pointer to ring-3 VM structure which this request belongs to. */
|
---|
265 | PUVM pUVM;
|
---|
266 | /** Request state. */
|
---|
267 | volatile VMREQSTATE enmState;
|
---|
268 | /** VBox status code for the completed request. */
|
---|
269 | volatile int32_t iStatus;
|
---|
270 | /** Requester event sem.
|
---|
271 | * The request can use this event semaphore to wait/poll for completion
|
---|
272 | * of the request.
|
---|
273 | */
|
---|
274 | RTSEMEVENT EventSem;
|
---|
275 | /** Set if the event semaphore is clear. */
|
---|
276 | volatile bool fEventSemClear;
|
---|
277 | /** Flags, VMR3REQ_FLAGS_*. */
|
---|
278 | unsigned fFlags;
|
---|
279 | /** Request type. */
|
---|
280 | VMREQTYPE enmType;
|
---|
281 | /** Request destination. */
|
---|
282 | VMCPUID idDstCpu;
|
---|
283 | /** Request specific data. */
|
---|
284 | union VMREQ_U
|
---|
285 | {
|
---|
286 | /** VMREQTYPE_INTERNAL. */
|
---|
287 | struct
|
---|
288 | {
|
---|
289 | /** Pointer to the function to be called. */
|
---|
290 | PFNRT pfn;
|
---|
291 | /** Number of arguments. */
|
---|
292 | unsigned cArgs;
|
---|
293 | /** Array of arguments. */
|
---|
294 | uintptr_t aArgs[64];
|
---|
295 | } Internal;
|
---|
296 | } u;
|
---|
297 | } VMREQ;
|
---|
298 | /** Pointer to a VM request packet. */
|
---|
299 | typedef VMREQ *PVMREQ;
|
---|
300 |
|
---|
301 | /** @} */
|
---|
302 |
|
---|
303 |
|
---|
304 | #ifndef IN_RC
|
---|
305 | /** @defgroup grp_vmm_apis_hc VM Host Context API
|
---|
306 | * @ingroup grp_vm
|
---|
307 | * @{ */
|
---|
308 |
|
---|
309 | /** @} */
|
---|
310 | #endif
|
---|
311 |
|
---|
312 |
|
---|
313 | #ifdef IN_RING3
|
---|
314 | /** @defgroup grp_vmm_apis_r3 VM Host Context Ring 3 API
|
---|
315 | * This interface is a _draft_!
|
---|
316 | * @ingroup grp_vm
|
---|
317 | * @{ */
|
---|
318 |
|
---|
319 | /**
|
---|
320 | * Completion notification codes.
|
---|
321 | */
|
---|
322 | typedef enum VMINITCOMPLETED
|
---|
323 | {
|
---|
324 | /** The ring-3 init is completed. */
|
---|
325 | VMINITCOMPLETED_RING3 = 1,
|
---|
326 | /** The ring-0 init is completed. */
|
---|
327 | VMINITCOMPLETED_RING0,
|
---|
328 | /** The hardware accelerated virtualization init is completed.
|
---|
329 | * Used to make decisision depending on HM* bits being completely
|
---|
330 | * initialized. */
|
---|
331 | VMINITCOMPLETED_HM,
|
---|
332 | /** The RC init is completed. */
|
---|
333 | VMINITCOMPLETED_RC
|
---|
334 | } VMINITCOMPLETED;
|
---|
335 |
|
---|
336 |
|
---|
337 | /** Reason for VM resume. */
|
---|
338 | typedef enum VMRESUMEREASON
|
---|
339 | {
|
---|
340 | VMRESUMEREASON_INVALID = 0,
|
---|
341 | /** User decided to do so. */
|
---|
342 | VMRESUMEREASON_USER,
|
---|
343 | /** VM reconfiguration (like changing DVD). */
|
---|
344 | VMRESUMEREASON_RECONFIG,
|
---|
345 | /** The host resumed. */
|
---|
346 | VMRESUMEREASON_HOST_RESUME,
|
---|
347 | /** Restored state. */
|
---|
348 | VMRESUMEREASON_STATE_RESTORED,
|
---|
349 | /** Snapshot / saved state. */
|
---|
350 | VMRESUMEREASON_STATE_SAVED,
|
---|
351 | /** Teleported to a new box / instance. */
|
---|
352 | VMRESUMEREASON_TELEPORTED,
|
---|
353 | /** Teleportation failed. */
|
---|
354 | VMRESUMEREASON_TELEPORT_FAILED,
|
---|
355 | /** FTM temporarily suspended the VM. */
|
---|
356 | VMRESUMEREASON_FTM_SYNC,
|
---|
357 | /** End of valid reasons. */
|
---|
358 | VMRESUMEREASON_END,
|
---|
359 | /** Blow the type up to 32-bits. */
|
---|
360 | VMRESUMEREASON_32BIT_HACK = 0x7fffffff
|
---|
361 | } VMRESUMEREASON;
|
---|
362 |
|
---|
363 | /** Reason for VM suspend. */
|
---|
364 | typedef enum VMSUSPENDREASON
|
---|
365 | {
|
---|
366 | VMSUSPENDREASON_INVALID = 0,
|
---|
367 | /** User decided to do so. */
|
---|
368 | VMSUSPENDREASON_USER,
|
---|
369 | /** VM reconfiguration (like changing DVD). */
|
---|
370 | VMSUSPENDREASON_RECONFIG,
|
---|
371 | /** The VM is suspending itself. */
|
---|
372 | VMSUSPENDREASON_VM,
|
---|
373 | /** The Vm is suspending because of a runtime error. */
|
---|
374 | VMSUSPENDREASON_RUNTIME_ERROR,
|
---|
375 | /** The host was suspended. */
|
---|
376 | VMSUSPENDREASON_HOST_SUSPEND,
|
---|
377 | /** The host is running low on battery power. */
|
---|
378 | VMSUSPENDREASON_HOST_BATTERY_LOW,
|
---|
379 | /** FTM is temporarily suspending the VM. */
|
---|
380 | VMSUSPENDREASON_FTM_SYNC,
|
---|
381 | /** End of valid reasons. */
|
---|
382 | VMSUSPENDREASON_END,
|
---|
383 | /** Blow the type up to 32-bits. */
|
---|
384 | VMSUSPENDREASON_32BIT_HACK = 0x7fffffff
|
---|
385 | } VMSUSPENDREASON;
|
---|
386 |
|
---|
387 |
|
---|
388 | /**
|
---|
389 | * Progress callback.
|
---|
390 | *
|
---|
391 | * This will report the completion percentage of an operation.
|
---|
392 | *
|
---|
393 | * @returns VINF_SUCCESS.
|
---|
394 | * @returns Error code to cancel the operation with.
|
---|
395 | * @param pUVM The user mode VM handle.
|
---|
396 | * @param uPercent Completion percentage (0-100).
|
---|
397 | * @param pvUser User specified argument.
|
---|
398 | */
|
---|
399 | typedef DECLCALLBACK(int) FNVMPROGRESS(PUVM pUVM, unsigned uPercent, void *pvUser);
|
---|
400 | /** Pointer to a FNVMPROGRESS function. */
|
---|
401 | typedef FNVMPROGRESS *PFNVMPROGRESS;
|
---|
402 |
|
---|
403 |
|
---|
404 | VMMR3DECL(int) VMR3Create(uint32_t cCpus, PCVMM2USERMETHODS pVm2UserCbs,
|
---|
405 | PFNVMATERROR pfnVMAtError, void *pvUserVM,
|
---|
406 | PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM,
|
---|
407 | PVM *ppVM, PUVM *ppUVM);
|
---|
408 | VMMR3DECL(int) VMR3PowerOn(PUVM pUVM);
|
---|
409 | VMMR3DECL(int) VMR3Suspend(PUVM pUVM, VMSUSPENDREASON enmReason);
|
---|
410 | VMMR3DECL(VMSUSPENDREASON) VMR3GetSuspendReason(PUVM);
|
---|
411 | VMMR3DECL(int) VMR3Resume(PUVM pUVM, VMRESUMEREASON enmReason);
|
---|
412 | VMMR3DECL(VMRESUMEREASON) VMR3GetResumeReason(PUVM);
|
---|
413 | VMMR3DECL(int) VMR3Reset(PUVM pUVM);
|
---|
414 | VMMR3_INT_DECL(VBOXSTRICTRC) VMR3ResetFF(PVM pVM);
|
---|
415 | VMMR3_INT_DECL(VBOXSTRICTRC) VMR3ResetTripleFault(PVM pVM);
|
---|
416 | VMMR3DECL(int) VMR3Save(PUVM pUVM, const char *pszFilename, bool fContinueAfterwards, PFNVMPROGRESS pfnProgress, void *pvUser, bool *pfSuspended);
|
---|
417 | VMMR3_INT_DECL(int) VMR3SaveFT(PUVM pUVM, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, bool *pfSuspended, bool fSkipStateChanges);
|
---|
418 | VMMR3DECL(int) VMR3Teleport(PUVM pUVM, uint32_t cMsDowntime, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, PFNVMPROGRESS pfnProgress, void *pvProgressUser, bool *pfSuspended);
|
---|
419 | VMMR3DECL(int) VMR3LoadFromFile(PUVM pUVM, const char *pszFilename, PFNVMPROGRESS pfnProgress, void *pvUser);
|
---|
420 | VMMR3DECL(int) VMR3LoadFromStream(PUVM pUVM, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser,
|
---|
421 | PFNVMPROGRESS pfnProgress, void *pvProgressUser);
|
---|
422 | VMMR3_INT_DECL(int) VMR3LoadFromStreamFT(PUVM pUVM, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser);
|
---|
423 |
|
---|
424 | VMMR3DECL(int) VMR3PowerOff(PUVM pUVM);
|
---|
425 | VMMR3DECL(int) VMR3Destroy(PUVM pUVM);
|
---|
426 | VMMR3_INT_DECL(void) VMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
|
---|
427 |
|
---|
428 | VMMR3DECL(PVM) VMR3GetVM(PUVM pUVM);
|
---|
429 | VMMR3DECL(PUVM) VMR3GetUVM(PVM pVM);
|
---|
430 | VMMR3DECL(uint32_t) VMR3RetainUVM(PUVM pUVM);
|
---|
431 | VMMR3DECL(uint32_t) VMR3ReleaseUVM(PUVM pUVM);
|
---|
432 | VMMR3DECL(const char *) VMR3GetName(PUVM pUVM);
|
---|
433 | VMMR3DECL(PRTUUID) VMR3GetUuid(PUVM pUVM, PRTUUID pUuid);
|
---|
434 | VMMR3DECL(VMSTATE) VMR3GetState(PVM pVM);
|
---|
435 | VMMR3DECL(VMSTATE) VMR3GetStateU(PUVM pUVM);
|
---|
436 | VMMR3DECL(const char *) VMR3GetStateName(VMSTATE enmState);
|
---|
437 | VMMR3DECL(int) VMR3AtStateRegister(PUVM pUVM, PFNVMATSTATE pfnAtState, void *pvUser);
|
---|
438 | VMMR3DECL(int) VMR3AtStateDeregister(PUVM pUVM, PFNVMATSTATE pfnAtState, void *pvUser);
|
---|
439 | VMMR3_INT_DECL(bool) VMR3SetGuruMeditation(PVM pVM);
|
---|
440 | VMMR3_INT_DECL(bool) VMR3TeleportedAndNotFullyResumedYet(PVM pVM);
|
---|
441 | VMMR3DECL(int) VMR3AtErrorRegister(PUVM pUVM, PFNVMATERROR pfnAtError, void *pvUser);
|
---|
442 | VMMR3DECL(int) VMR3AtErrorDeregister(PUVM pUVM, PFNVMATERROR pfnAtError, void *pvUser);
|
---|
443 | VMMR3DECL(int) VMR3SetError(PUVM pUVM, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(6, 7);
|
---|
444 | VMMR3DECL(int) VMR3SetErrorV(PUVM pUVM, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(6, 0);
|
---|
445 | VMMR3_INT_DECL(void) VMR3SetErrorWorker(PVM pVM);
|
---|
446 | VMMR3_INT_DECL(uint32_t) VMR3GetErrorCount(PUVM pUVM);
|
---|
447 | VMMR3DECL(int) VMR3AtRuntimeErrorRegister(PUVM pUVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser);
|
---|
448 | VMMR3DECL(int) VMR3AtRuntimeErrorDeregister(PUVM pUVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser);
|
---|
449 | VMMR3_INT_DECL(int) VMR3SetRuntimeErrorWorker(PVM pVM);
|
---|
450 | VMMR3_INT_DECL(uint32_t) VMR3GetRuntimeErrorCount(PUVM pUVM);
|
---|
451 |
|
---|
452 | VMMR3DECL(int) VMR3ReqCallU(PUVM pUVM, VMCPUID idDstCpu, PVMREQ *ppReq, RTMSINTERVAL cMillies, uint32_t fFlags, PFNRT pfnFunction, unsigned cArgs, ...);
|
---|
453 | VMMR3DECL(int) VMR3ReqCallVU(PUVM pUVM, VMCPUID idDstCpu, PVMREQ *ppReq, RTMSINTERVAL cMillies, uint32_t fFlags, PFNRT pfnFunction, unsigned cArgs, va_list Args);
|
---|
454 | VMMR3_INT_DECL(int) VMR3ReqCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
|
---|
455 | VMMR3DECL(int) VMR3ReqCallWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
|
---|
456 | VMMR3DECL(int) VMR3ReqCallNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
|
---|
457 | VMMR3DECL(int) VMR3ReqCallNoWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
|
---|
458 | VMMR3_INT_DECL(int) VMR3ReqCallVoidWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
|
---|
459 | VMMR3DECL(int) VMR3ReqCallVoidWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
|
---|
460 | VMMR3DECL(int) VMR3ReqCallVoidNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
|
---|
461 | VMMR3DECL(int) VMR3ReqPriorityCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
|
---|
462 | VMMR3DECL(int) VMR3ReqPriorityCallWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
|
---|
463 | VMMR3DECL(int) VMR3ReqPriorityCallVoidWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
|
---|
464 | VMMR3DECL(int) VMR3ReqAlloc(PUVM pUVM, PVMREQ *ppReq, VMREQTYPE enmType, VMCPUID idDstCpu);
|
---|
465 | VMMR3DECL(int) VMR3ReqFree(PVMREQ pReq);
|
---|
466 | VMMR3DECL(int) VMR3ReqQueue(PVMREQ pReq, RTMSINTERVAL cMillies);
|
---|
467 | VMMR3DECL(int) VMR3ReqWait(PVMREQ pReq, RTMSINTERVAL cMillies);
|
---|
468 | VMMR3_INT_DECL(int) VMR3ReqProcessU(PUVM pUVM, VMCPUID idDstCpu, bool fPriorityOnly);
|
---|
469 |
|
---|
470 | /** @name Flags for VMR3NotifyCpuFFU and VMR3NotifyGlobalFFU.
|
---|
471 | * @{ */
|
---|
472 | /** Whether we've done REM or not. */
|
---|
473 | #define VMNOTIFYFF_FLAGS_DONE_REM RT_BIT_32(0)
|
---|
474 | /** Whether we should poke the CPU if it's executing guest code. */
|
---|
475 | #define VMNOTIFYFF_FLAGS_POKE RT_BIT_32(1)
|
---|
476 | /** @} */
|
---|
477 | VMMR3_INT_DECL(void) VMR3NotifyGlobalFFU(PUVM pUVM, uint32_t fFlags);
|
---|
478 | VMMR3_INT_DECL(void) VMR3NotifyCpuFFU(PUVMCPU pUVMCpu, uint32_t fFlags);
|
---|
479 | VMMR3DECL(int) VMR3NotifyCpuDeviceReady(PVM pVM, VMCPUID idCpu);
|
---|
480 | VMMR3_INT_DECL(int) VMR3WaitHalted(PVM pVM, PVMCPU pVCpu, bool fIgnoreInterrupts);
|
---|
481 | VMMR3_INT_DECL(int) VMR3WaitU(PUVMCPU pUVMCpu);
|
---|
482 | VMMR3DECL(int) VMR3WaitForDeviceReady(PVM pVM, VMCPUID idCpu);
|
---|
483 | VMMR3_INT_DECL(int) VMR3AsyncPdmNotificationWaitU(PUVMCPU pUVCpu);
|
---|
484 | VMMR3_INT_DECL(void) VMR3AsyncPdmNotificationWakeupU(PUVM pUVM);
|
---|
485 | VMMR3_INT_DECL(RTCPUID) VMR3GetVMCPUId(PVM pVM);
|
---|
486 | VMMR3_INT_DECL(bool) VMR3IsLongModeAllowed(PVM pVM);
|
---|
487 | VMMR3DECL(RTTHREAD) VMR3GetVMCPUThread(PUVM pUVM);
|
---|
488 | VMMR3DECL(RTNATIVETHREAD) VMR3GetVMCPUNativeThread(PVM pVM);
|
---|
489 | VMMR3DECL(RTNATIVETHREAD) VMR3GetVMCPUNativeThreadU(PUVM pUVM);
|
---|
490 | VMMR3DECL(int) VMR3GetCpuCoreAndPackageIdFromCpuId(PUVM pUVM, VMCPUID idCpu, uint32_t *pidCpuCore, uint32_t *pidCpuPackage);
|
---|
491 | VMMR3_INT_DECL(uint32_t) VMR3GetActiveEmts(PUVM pUVM);
|
---|
492 | VMMR3DECL(int) VMR3HotUnplugCpu(PUVM pUVM, VMCPUID idCpu);
|
---|
493 | VMMR3DECL(int) VMR3HotPlugCpu(PUVM pUVM, VMCPUID idCpu);
|
---|
494 | VMMR3DECL(int) VMR3SetCpuExecutionCap(PUVM pUVM, uint32_t uCpuExecutionCap);
|
---|
495 | VMMR3DECL(int) VMR3SetPowerOffInsteadOfReset(PUVM pUVM, bool fPowerOffInsteadOfReset);
|
---|
496 | /** @} */
|
---|
497 | #endif /* IN_RING3 */
|
---|
498 |
|
---|
499 |
|
---|
500 | #ifdef IN_RC
|
---|
501 | /** @defgroup grp_vmm_apis_gc VM Guest Context APIs
|
---|
502 | * @ingroup grp_vm
|
---|
503 | * @{ */
|
---|
504 |
|
---|
505 | /** @} */
|
---|
506 | #endif
|
---|
507 |
|
---|
508 | RT_C_DECLS_END
|
---|
509 |
|
---|
510 | /** @} */
|
---|
511 |
|
---|
512 | #endif
|
---|
513 |
|
---|