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