VirtualBox

source: vbox/trunk/include/VBox/vmm/ssm.h@ 93963

Last change on this file since 93963 was 93444, checked in by vboxsync, 3 years ago

VMM,Main,HostServices: Use a function table for accessing the VBoxVMM.dll/so/dylib functionality, and load it dynamically when the Console object is initialized. Also converted a few drivers in Main to use device helpers to get config values and such. bugref:10074

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 56.9 KB
Line 
1/** @file
2 * SSM - The Save State Manager.
3 */
4
5/*
6 * Copyright (C) 2006-2022 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_INCLUDED_vmm_ssm_h
27#define VBOX_INCLUDED_vmm_ssm_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include <VBox/types.h>
33#include <VBox/vmm/tm.h>
34#include <VBox/vmm/vmapi.h>
35
36
37RT_C_DECLS_BEGIN
38
39/** @defgroup grp_ssm The Saved State Manager API
40 * @ingroup grp_vmm
41 * @{
42 */
43
44/**
45 * Determine the major version of the SSM version. If the major SSM version of two snapshots is
46 * different, the snapshots are incompatible.
47 */
48#define SSM_VERSION_MAJOR(ver) ((ver) & 0xffff0000)
49
50/**
51 * Determine the minor version of the SSM version. If the major SSM version of two snapshots is
52 * the same, the code must handle incompatibilies between minor version changes (e.g. use dummy
53 * values for non-existent fields).
54 */
55#define SSM_VERSION_MINOR(ver) ((ver) & 0x0000ffff)
56
57/**
58 * Determine if the major version changed between two SSM versions.
59 */
60#define SSM_VERSION_MAJOR_CHANGED(ver1,ver2) (SSM_VERSION_MAJOR(ver1) != SSM_VERSION_MAJOR(ver2))
61
62/** The special value for the final pass. */
63#define SSM_PASS_FINAL UINT32_MAX
64
65
66#ifdef IN_RING3
67/** @defgroup grp_ssm_r3 The SSM Host Context Ring-3 API
68 * @{
69 */
70
71
72/**
73 * What to do after the save/load operation.
74 */
75typedef enum SSMAFTER
76{
77 /** Invalid. */
78 SSMAFTER_INVALID = 0,
79 /** Will resume the loaded state. */
80 SSMAFTER_RESUME,
81 /** Will destroy the VM after saving. */
82 SSMAFTER_DESTROY,
83 /** Will continue execution after saving the VM. */
84 SSMAFTER_CONTINUE,
85 /** Will teleport the VM.
86 * The source VM will be destroyed (then one saving), the destination VM
87 * will continue execution. */
88 SSMAFTER_TELEPORT,
89 /** Will debug the saved state.
90 * This is used to drop some of the stricter consitentcy checks so it'll
91 * load fine in the debugger or animator. */
92 SSMAFTER_DEBUG_IT,
93 /** The file was opened using SSMR3Open() and we have no idea what the plan is. */
94 SSMAFTER_OPENED
95} SSMAFTER;
96
97
98/** Pointer to a structure field description. */
99typedef struct SSMFIELD *PSSMFIELD;
100/** Pointer to a const structure field description. */
101typedef const struct SSMFIELD *PCSSMFIELD;
102
103/**
104 * SSMFIELD Get/Put callback function.
105 *
106 * This is call for getting and putting the field it is associated with. It's
107 * up to the callback to work the saved state correctly.
108 *
109 * @returns VBox status code.
110 *
111 * @param pSSM The saved state handle.
112 * @param pField The field that is being processed.
113 * @param pvStruct Pointer to the structure.
114 * @param fFlags SSMSTRUCT_FLAGS_XXX.
115 * @param fGetOrPut True if getting, false if putting.
116 * @param pvUser The user argument specified to SSMR3GetStructEx or
117 * SSMR3PutStructEx.
118 */
119typedef DECLCALLBACKTYPE(int, FNSSMFIELDGETPUT,(PSSMHANDLE pSSM, const struct SSMFIELD *pField, void *pvStruct,
120 uint32_t fFlags, bool fGetOrPut, void *pvUser));
121/** Pointer to a SSMFIELD Get/Put callback. */
122typedef FNSSMFIELDGETPUT *PFNSSMFIELDGETPUT;
123
124/**
125 * SSM field transformers.
126 *
127 * These are stored in the SSMFIELD::pfnGetPutOrTransformer and must therefore
128 * have values outside the valid pointer range.
129 */
130typedef enum SSMFIELDTRANS
131{
132 /** Invalid. */
133 SSMFIELDTRANS_INVALID = 0,
134 /** No transformation. */
135 SSMFIELDTRANS_NO_TRANSFORMATION,
136 /** Guest context (GC) physical address. */
137 SSMFIELDTRANS_GCPHYS,
138 /** Guest context (GC) virtual address. */
139 SSMFIELDTRANS_GCPTR,
140 /** Raw-mode context (RC) virtual address. */
141 SSMFIELDTRANS_RCPTR,
142 /** Array of raw-mode context (RC) virtual addresses. */
143 SSMFIELDTRANS_RCPTR_ARRAY,
144 /** Host context (HC) virtual address used as a NULL indicator. See
145 * SSMFIELD_ENTRY_HCPTR_NI. */
146 SSMFIELDTRANS_HCPTR_NI,
147 /** Array of SSMFIELDTRANS_HCPTR_NI. */
148 SSMFIELDTRANS_HCPTR_NI_ARRAY,
149 /** Host context (HC) virtual address used to hold a unsigned 32-bit value. */
150 SSMFIELDTRANS_HCPTR_HACK_U32,
151 /** Load a 32-bit unsigned filed from the state and zero extend it into a 64-bit
152 * structure member. */
153 SSMFIELDTRANS_U32_ZX_U64,
154
155 /** Ignorable field. See SSMFIELD_ENTRY_IGNORE. */
156 SSMFIELDTRANS_IGNORE,
157 /** Ignorable guest context (GC) physical address. */
158 SSMFIELDTRANS_IGN_GCPHYS,
159 /** Ignorable guest context (GC) virtual address. */
160 SSMFIELDTRANS_IGN_GCPTR,
161 /** Ignorable raw-mode context (RC) virtual address. */
162 SSMFIELDTRANS_IGN_RCPTR,
163 /** Ignorable host context (HC) virtual address. */
164 SSMFIELDTRANS_IGN_HCPTR,
165
166 /** Old field.
167 * Save as zeros and skip on restore (nowhere to restore it any longer). */
168 SSMFIELDTRANS_OLD,
169 /** Old guest context (GC) physical address. */
170 SSMFIELDTRANS_OLD_GCPHYS,
171 /** Old guest context (GC) virtual address. */
172 SSMFIELDTRANS_OLD_GCPTR,
173 /** Old raw-mode context (RC) virtual address. */
174 SSMFIELDTRANS_OLD_RCPTR,
175 /** Old host context (HC) virtual address. */
176 SSMFIELDTRANS_OLD_HCPTR,
177 /** Old host context specific padding.
178 * The lower word is the size of 32-bit hosts, the upper for 64-bit hosts. */
179 SSMFIELDTRANS_OLD_PAD_HC,
180 /** Old padding specific to the 32-bit Microsoft C Compiler. */
181 SSMFIELDTRANS_OLD_PAD_MSC32,
182
183 /** Padding that differs between 32-bit and 64-bit hosts.
184 * The first byte of SSMFIELD::cb contains the size for 32-bit hosts.
185 * The second byte of SSMFIELD::cb contains the size for 64-bit hosts.
186 * The upper word of SSMFIELD::cb contains the actual field size.
187 */
188 SSMFIELDTRANS_PAD_HC,
189 /** Padding for 32-bit hosts only.
190 * SSMFIELD::cb has the same format as for SSMFIELDTRANS_PAD_HC. */
191 SSMFIELDTRANS_PAD_HC32,
192 /** Padding for 64-bit hosts only.
193 * SSMFIELD::cb has the same format as for SSMFIELDTRANS_PAD_HC. */
194 SSMFIELDTRANS_PAD_HC64,
195 /** Automatic compiler padding that may differ between 32-bit and
196 * 64-bit hosts. SSMFIELD::cb has the same format as for
197 * SSMFIELDTRANS_PAD_HC. */
198 SSMFIELDTRANS_PAD_HC_AUTO,
199 /** Automatic compiler padding specific to the 32-bit Microsoft C
200 * compiler.
201 * SSMFIELD::cb has the same format as for SSMFIELDTRANS_PAD_HC. */
202 SSMFIELDTRANS_PAD_MSC32_AUTO
203} SSMFIELDTRANS;
204
205/** Tests if it's a padding field with the special SSMFIELD::cb format.
206 * @returns true / false.
207 * @param pfn The SSMFIELD::pfnGetPutOrTransformer value.
208 */
209#define SSMFIELDTRANS_IS_PADDING(pfn) \
210 ( (uintptr_t)(pfn) >= SSMFIELDTRANS_PAD_HC && (uintptr_t)(pfn) <= SSMFIELDTRANS_PAD_MSC32_AUTO )
211
212/** Tests if it's an entry for an old field.
213 *
214 * @returns true / false.
215 * @param pfn The SSMFIELD::pfnGetPutOrTransformer value.
216 */
217#define SSMFIELDTRANS_IS_OLD(pfn) \
218 ( (uintptr_t)(pfn) >= SSMFIELDTRANS_OLD && (uintptr_t)(pfn) <= SSMFIELDTRANS_OLD_PAD_MSC32 )
219
220/**
221 * A structure field description.
222 */
223typedef struct SSMFIELD
224{
225 /** Getter and putter callback or transformer index. */
226 PFNSSMFIELDGETPUT pfnGetPutOrTransformer;
227 /** Field offset into the structure. */
228 uint32_t off;
229 /** The size of the field. */
230 uint32_t cb;
231 /** This field was first saved by this unit version number. */
232 uint32_t uFirstVer;
233 /** Field name. */
234 const char *pszName;
235} SSMFIELD;
236
237/** Emit a SSMFIELD array entry.
238 * @internal */
239#define SSMFIELD_ENTRY_INT(Name, off, cb, enmTransformer, uFirstVer) \
240 { (PFNSSMFIELDGETPUT)(uintptr_t)(enmTransformer), (uint32_t)(off), (uint32_t)(cb), (uFirstVer), Name }
241/** Emit a SSMFIELD array entry.
242 * @internal */
243#define SSMFIELD_ENTRY_TF_INT(Type, Field, enmTransformer, uFirstVer) \
244 SSMFIELD_ENTRY_INT(#Type "::" #Field, RT_UOFFSETOF(Type, Field), RT_SIZEOFMEMB(Type, Field), enmTransformer, uFirstVer)
245/** Emit a SSMFIELD array entry for an old field.
246 * @internal */
247#define SSMFIELD_ENTRY_OLD_INT(Field, cb, enmTransformer) \
248 SSMFIELD_ENTRY_INT("old::" #Field, UINT32_MAX / 2, (cb), enmTransformer, 0)
249/** Emit a SSMFIELD array entry for an alignment padding.
250 * @internal */
251#define SSMFIELD_ENTRY_PAD_INT(Type, Field, cb32, cb64, enmTransformer) \
252 SSMFIELD_ENTRY_INT(#Type "::" #Field, RT_UOFFSETOF(Type, Field), \
253 (RT_SIZEOFMEMB(Type, Field) << 16) | (cb32) | ((cb64) << 8), enmTransformer, 0)
254/** Emit a SSMFIELD array entry for an alignment padding.
255 * @internal */
256#define SSMFIELD_ENTRY_PAD_OTHER_INT(Type, Field, cb32, cb64, enmTransformer) \
257 SSMFIELD_ENTRY_INT(#Type "::" #Field, UINT32_MAX / 2, 0 | (cb32) | ((cb64) << 8), enmTransformer, 0)
258
259/** Emit a SSMFIELD array entry. */
260#define SSMFIELD_ENTRY(Type, Field) SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_NO_TRANSFORMATION, 0)
261/** Emit a SSMFIELD array entry with first version. */
262#define SSMFIELD_ENTRY_VER(Type, Field, uFirstVer) SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_NO_TRANSFORMATION, uFirstVer)
263/** Emit a SSMFIELD array entry for a custom made field. This is intended
264 * for working around bitfields in old structures. */
265#define SSMFIELD_ENTRY_CUSTOM(Field, off, cb) SSMFIELD_ENTRY_INT("custom::" #Field, off, cb, \
266 SSMFIELDTRANS_NO_TRANSFORMATION, 0)
267/** Emit a SSMFIELD array entry for a RTGCPHYS type. */
268#define SSMFIELD_ENTRY_GCPHYS(Type, Field) SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_GCPHYS, 0)
269/** Emit a SSMFIELD array entry for a RTGCPTR type. */
270#define SSMFIELD_ENTRY_GCPTR(Type, Field) SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_GCPTR, 0)
271/** Emit a SSMFIELD array entry for a raw-mode context pointer. */
272#define SSMFIELD_ENTRY_RCPTR(Type, Field) SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_RCPTR, 0)
273/** Emit a SSMFIELD array entry for a raw-mode context pointer. */
274#define SSMFIELD_ENTRY_RCPTR_ARRAY(Type, Field) SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_RCPTR_ARRAY, 0)
275/** Emit a SSMFIELD array entry for a ring-0 or ring-3 pointer type that is only
276 * of interest as a NULL indicator.
277 *
278 * This is always restored as a 0 (NULL) or 1 value. When
279 * SSMSTRUCT_FLAGS_DONT_IGNORE is set, the pointer will be saved in its
280 * entirety, when clear it will be saved as a boolean. */
281#define SSMFIELD_ENTRY_HCPTR_NI(Type, Field) SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_HCPTR_NI, 0)
282/** Same as SSMFIELD_ENTRY_HCPTR_NI, except it's an array of the buggers. */
283#define SSMFIELD_ENTRY_HCPTR_NI_ARRAY(Type, Field) SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_HCPTR_NI_ARRAY, 0)
284/** Emit a SSMFIELD array entry for a ring-0 or ring-3 pointer type that has
285 * been hacked such that it will never exceed 32-bit. No sign extending. */
286#define SSMFIELD_ENTRY_HCPTR_HACK_U32(Type, Field) SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_HCPTR_HACK_U32, 0)
287/** Emit a SSMFIELD array entry for loading a 32-bit field into a 64-bit
288 * structure member, zero extending the value. */
289#define SSMFIELD_ENTRY_U32_ZX_U64(Type, Field) SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_U32_ZX_U64, 0)
290
291/** Emit a SSMFIELD array entry for a field that can be ignored.
292 * It is stored as zeros if SSMSTRUCT_FLAGS_DONT_IGNORE is specified to
293 * SSMR3PutStructEx. The member is never touched upon restore. */
294#define SSMFIELD_ENTRY_IGNORE(Type, Field) SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_IGNORE, 0)
295/** Emit a SSMFIELD array entry for an ignorable RTGCPHYS type. */
296#define SSMFIELD_ENTRY_IGN_GCPHYS(Type, Field) SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_IGN_GCPHYS, 0)
297/** Emit a SSMFIELD array entry for an ignorable RTGCPHYS type. */
298#define SSMFIELD_ENTRY_IGN_GCPTR(Type, Field) SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_IGN_GCPTR, 0)
299/** Emit a SSMFIELD array entry for an ignorable raw-mode context pointer. */
300#define SSMFIELD_ENTRY_IGN_RCPTR(Type, Field) SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_IGN_RCPTR, 0)
301/** Emit a SSMFIELD array entry for an ignorable ring-3 or/and ring-0 pointer. */
302#define SSMFIELD_ENTRY_IGN_HCPTR(Type, Field) SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_IGN_HCPTR, 0)
303
304/** Emit a SSMFIELD array entry for an old field that should be ignored now.
305 * It is stored as zeros and skipped on load. */
306#define SSMFIELD_ENTRY_OLD(Field, cb) SSMFIELD_ENTRY_OLD_INT(Field, cb, SSMFIELDTRANS_OLD)
307/** Same as SSMFIELD_ENTRY_IGN_GCPHYS, except there is no structure field. */
308#define SSMFIELD_ENTRY_OLD_GCPHYS(Field) SSMFIELD_ENTRY_OLD_INT(Field, sizeof(RTGCPHYS), SSMFIELDTRANS_OLD_GCPHYS)
309/** Same as SSMFIELD_ENTRY_IGN_GCPTR, except there is no structure field. */
310#define SSMFIELD_ENTRY_OLD_GCPTR(Field) SSMFIELD_ENTRY_OLD_INT(Field, sizeof(RTGCPTR), SSMFIELDTRANS_OLD_GCPTR)
311/** Same as SSMFIELD_ENTRY_IGN_RCPTR, except there is no structure field. */
312#define SSMFIELD_ENTRY_OLD_RCPTR(Field) SSMFIELD_ENTRY_OLD_INT(Field, sizeof(RTRCPTR), SSMFIELDTRANS_OLD_RCPTR)
313/** Same as SSMFIELD_ENTRY_IGN_HCPTR, except there is no structure field. */
314#define SSMFIELD_ENTRY_OLD_HCPTR(Field) SSMFIELD_ENTRY_OLD_INT(Field, sizeof(RTHCPTR), SSMFIELDTRANS_OLD_HCPTR)
315/** Same as SSMFIELD_ENTRY_PAD_HC, except there is no structure field. */
316#define SSMFIELD_ENTRY_OLD_PAD_HC(Field, cb32, cb64) \
317 SSMFIELD_ENTRY_OLD_INT(Field, RT_MAKE_U32((cb32), (cb64)), SSMFIELDTRANS_OLD_PAD_HC)
318/** Same as SSMFIELD_ENTRY_PAD_HC64, except there is no structure field. */
319#define SSMFIELD_ENTRY_OLD_PAD_HC64(Field, cb) SSMFIELD_ENTRY_OLD_PAD_HC(Field, 0, cb)
320/** Same as SSMFIELD_ENTRY_PAD_HC32, except there is no structure field. */
321#define SSMFIELD_ENTRY_OLD_PAD_HC32(Field, cb) SSMFIELD_ENTRY_OLD_PAD_HC(Field, cb, 0)
322/** Same as SSMFIELD_ENTRY_PAD_HC, except there is no structure field. */
323#define SSMFIELD_ENTRY_OLD_PAD_MSC32(Field, cb) SSMFIELD_ENTRY_OLD_INT(Field, cb, SSMFIELDTRANS_OLD_PAD_MSC32)
324
325/** Emit a SSMFIELD array entry for a padding that differs in size between
326 * 64-bit and 32-bit hosts. */
327#define SSMFIELD_ENTRY_PAD_HC(Type, Field, cb32, cb64) SSMFIELD_ENTRY_PAD_INT( Type, Field, cb32, cb64, SSMFIELDTRANS_PAD_HC)
328/** Emit a SSMFIELD array entry for a padding that is exclusive to 64-bit hosts. */
329#if HC_ARCH_BITS == 64
330# define SSMFIELD_ENTRY_PAD_HC64(Type, Field, cb) SSMFIELD_ENTRY_PAD_INT( Type, Field, 0, cb, SSMFIELDTRANS_PAD_HC64)
331#else
332# define SSMFIELD_ENTRY_PAD_HC64(Type, Field, cb) SSMFIELD_ENTRY_PAD_OTHER_INT(Type, Field, 0, cb, SSMFIELDTRANS_PAD_HC64)
333#endif
334/** Emit a SSMFIELD array entry for a 32-bit padding for on 64-bits hosts. */
335#if HC_ARCH_BITS == 32
336# define SSMFIELD_ENTRY_PAD_HC32(Type, Field, cb) SSMFIELD_ENTRY_PAD_INT( Type, Field, cb, 0, SSMFIELDTRANS_PAD_HC32)
337#else
338# define SSMFIELD_ENTRY_PAD_HC32(Type, Field, cb) SSMFIELD_ENTRY_PAD_OTHER_INT(Type, Field, cb, 0, SSMFIELDTRANS_PAD_HC32)
339#endif
340/** Emit a SSMFIELD array entry for an automatic compiler padding that may
341 * differ in size between 64-bit and 32-bit hosts. */
342#if HC_ARCH_BITS == 64
343# define SSMFIELD_ENTRY_PAD_HC_AUTO(cb32, cb64) \
344 { \
345 (PFNSSMFIELDGETPUT)(uintptr_t)(SSMFIELDTRANS_PAD_HC_AUTO), \
346 UINT32_MAX / 2, (cb64 << 16) | (cb32) | ((cb64) << 8), 0, "<compiler-padding>" \
347 }
348#else
349# define SSMFIELD_ENTRY_PAD_HC_AUTO(cb32, cb64) \
350 { \
351 (PFNSSMFIELDGETPUT)(uintptr_t)(SSMFIELDTRANS_PAD_HC_AUTO), \
352 UINT32_MAX / 2, (cb32 << 16) | (cb32) | ((cb64) << 8), 0, "<compiler-padding>" \
353 }
354#endif
355/** Emit a SSMFIELD array entry for an automatic compiler padding that is unique
356 * to the 32-bit microsoft compiler. This is usually used together with
357 * SSMFIELD_ENTRY_PAD_HC*. */
358#if HC_ARCH_BITS == 32 && defined(_MSC_VER)
359# define SSMFIELD_ENTRY_PAD_MSC32_AUTO(cb) \
360 { \
361 (PFNSSMFIELDGETPUT)(uintptr_t)(SSMFIELDTRANS_PAD_MSC32_AUTO), \
362 UINT32_MAX / 2, ((cb) << 16) | (cb), 0, "<msc32-padding>" \
363 }
364#else
365# define SSMFIELD_ENTRY_PAD_MSC32_AUTO(cb) \
366 { \
367 (PFNSSMFIELDGETPUT)(uintptr_t)(SSMFIELDTRANS_PAD_MSC32_AUTO), \
368 UINT32_MAX / 2, (cb), 0, "<msc32-padding>" \
369 }
370#endif
371
372/** Emit a SSMFIELD array entry for a field with a custom callback. */
373#define SSMFIELD_ENTRY_CALLBACK(Type, Field, pfnGetPut) \
374 { (pfnGetPut), RT_UOFFSETOF(Type, Field), RT_SIZEOFMEMB(Type, Field), 0, #Type "::" #Field }
375/** Emit the terminating entry of a SSMFIELD array. */
376#define SSMFIELD_ENTRY_TERM() \
377 { (PFNSSMFIELDGETPUT)(uintptr_t)SSMFIELDTRANS_INVALID, UINT32_MAX, UINT32_MAX, UINT32_MAX, NULL }
378
379
380/** @name SSMR3GetStructEx and SSMR3PutStructEx flags.
381 * @{ */
382/** The field descriptors must exactly cover the entire struct, A to Z. */
383#define SSMSTRUCT_FLAGS_FULL_STRUCT RT_BIT_32(0)
384/** No start and end markers, just the raw bits. */
385#define SSMSTRUCT_FLAGS_NO_MARKERS RT_BIT_32(1)
386/** Do not ignore any ignorable fields. */
387#define SSMSTRUCT_FLAGS_DONT_IGNORE RT_BIT_32(2)
388/** Saved using SSMR3PutMem, don't be too strict. */
389#define SSMSTRUCT_FLAGS_SAVED_AS_MEM RT_BIT_32(3)
390/** No introductory structure marker. Use when splitting up structures. */
391#define SSMSTRUCT_FLAGS_NO_LEAD_MARKER RT_BIT_32(4)
392/** No trailing structure marker. Use when splitting up structures. */
393#define SSMSTRUCT_FLAGS_NO_TAIL_MARKER RT_BIT_32(5)
394
395/** Band-aid for old SSMR3PutMem/SSMR3GetMem of structurs with host pointers.
396 * @remarks This type is normally only used up to the first changes to the
397 * structures take place in order to make sure the conversion from
398 * SSMR3PutMem to field descriptors went smoothly. Replace with
399 * SSMSTRUCT_FLAGS_MEM_BAND_AID_RELAXED when changing the structure. */
400#define SSMSTRUCT_FLAGS_MEM_BAND_AID ( SSMSTRUCT_FLAGS_DONT_IGNORE | SSMSTRUCT_FLAGS_FULL_STRUCT \
401 | SSMSTRUCT_FLAGS_NO_MARKERS | SSMSTRUCT_FLAGS_SAVED_AS_MEM)
402/** Band-aid for old SSMR3PutMem/SSMR3GetMem of structurs with host
403 * pointers, with relaxed checks. */
404#define SSMSTRUCT_FLAGS_MEM_BAND_AID_RELAXED ( SSMSTRUCT_FLAGS_DONT_IGNORE \
405 | SSMSTRUCT_FLAGS_NO_MARKERS | SSMSTRUCT_FLAGS_SAVED_AS_MEM)
406/** Mask of the valid bits. */
407#define SSMSTRUCT_FLAGS_VALID_MASK UINT32_C(0x0000003f)
408/** @} */
409
410
411/** The PDM Device callback variants.
412 * @{
413 */
414
415/**
416 * Prepare state live save operation.
417 *
418 * @returns VBox status code.
419 * @param pDevIns Device instance of the device which registered the data unit.
420 * @param pSSM SSM operation handle.
421 * @remarks The caller enters the device critical section prior to the call.
422 * @thread Any.
423 */
424typedef DECLCALLBACKTYPE(int, FNSSMDEVLIVEPREP,(PPDMDEVINS pDevIns, PSSMHANDLE pSSM));
425/** Pointer to a FNSSMDEVLIVEPREP() function. */
426typedef FNSSMDEVLIVEPREP *PFNSSMDEVLIVEPREP;
427
428/**
429 * Execute state live save operation.
430 *
431 * This will be called repeatedly until all units vote that the live phase has
432 * been concluded.
433 *
434 * @returns VBox status code.
435 * @param pDevIns Device instance of the device which registered the data unit.
436 * @param pSSM SSM operation handle.
437 * @param uPass The pass.
438 * @remarks The caller enters the device critical section prior to the call.
439 * @thread Any.
440 */
441typedef DECLCALLBACKTYPE(int, FNSSMDEVLIVEEXEC,(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass));
442/** Pointer to a FNSSMDEVLIVEEXEC() function. */
443typedef FNSSMDEVLIVEEXEC *PFNSSMDEVLIVEEXEC;
444
445/**
446 * Vote on whether the live part of the saving has been concluded.
447 *
448 * The vote stops once a unit has vetoed the decision, so don't rely upon this
449 * being called every time.
450 *
451 * @returns VBox status code.
452 * @retval VINF_SUCCESS if done.
453 * @retval VINF_SSM_VOTE_FOR_ANOTHER_PASS if another pass is needed.
454 * @retval VINF_SSM_VOTE_DONE_DONT_CALL_AGAIN if the live saving of the unit is
455 * done and there is not need calling it again before the final pass.
456 * @retval VERR_SSM_VOTE_FOR_GIVING_UP if its time to give up.
457 *
458 * @param pDevIns Device instance of the device which registered the data unit.
459 * @param pSSM SSM operation handle.
460 * @param uPass The data pass.
461 * @remarks The caller enters the device critical section prior to the call.
462 * @thread Any.
463 */
464typedef DECLCALLBACKTYPE(int, FNSSMDEVLIVEVOTE,(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass));
465/** Pointer to a FNSSMDEVLIVEVOTE() function. */
466typedef FNSSMDEVLIVEVOTE *PFNSSMDEVLIVEVOTE;
467
468/**
469 * Prepare state save operation.
470 *
471 * @returns VBox status code.
472 * @param pDevIns Device instance of the device which registered the data unit.
473 * @param pSSM SSM operation handle.
474 * @remarks The caller enters the device critical section prior to the call.
475 */
476typedef DECLCALLBACKTYPE(int, FNSSMDEVSAVEPREP,(PPDMDEVINS pDevIns, PSSMHANDLE pSSM));
477/** Pointer to a FNSSMDEVSAVEPREP() function. */
478typedef FNSSMDEVSAVEPREP *PFNSSMDEVSAVEPREP;
479
480/**
481 * Execute state save operation.
482 *
483 * @returns VBox status code.
484 * @param pDevIns Device instance of the device which registered the data unit.
485 * @param pSSM SSM operation handle.
486 * @remarks The caller enters the device critical section prior to the call.
487 */
488typedef DECLCALLBACKTYPE(int, FNSSMDEVSAVEEXEC,(PPDMDEVINS pDevIns, PSSMHANDLE pSSM));
489/** Pointer to a FNSSMDEVSAVEEXEC() function. */
490typedef FNSSMDEVSAVEEXEC *PFNSSMDEVSAVEEXEC;
491
492/**
493 * Done state save operation.
494 *
495 * @returns VBox status code.
496 * @param pDevIns Device instance of the device which registered the data unit.
497 * @param pSSM SSM operation handle.
498 * @remarks The caller enters the device critical section prior to the call.
499 */
500typedef DECLCALLBACKTYPE(int, FNSSMDEVSAVEDONE,(PPDMDEVINS pDevIns, PSSMHANDLE pSSM));
501/** Pointer to a FNSSMDEVSAVEDONE() function. */
502typedef FNSSMDEVSAVEDONE *PFNSSMDEVSAVEDONE;
503
504/**
505 * Prepare state load operation.
506 *
507 * @returns VBox status code.
508 * @param pDevIns Device instance of the device which registered the data unit.
509 * @param pSSM SSM operation handle.
510 * @remarks The caller enters the device critical section prior to the call.
511 */
512typedef DECLCALLBACKTYPE(int, FNSSMDEVLOADPREP,(PPDMDEVINS pDevIns, PSSMHANDLE pSSM));
513/** Pointer to a FNSSMDEVLOADPREP() function. */
514typedef FNSSMDEVLOADPREP *PFNSSMDEVLOADPREP;
515
516/**
517 * Execute state load operation.
518 *
519 * @returns VBox status code.
520 * @param pDevIns Device instance of the device which registered the data unit.
521 * @param pSSM SSM operation handle.
522 * @param uVersion Data layout version.
523 * @param uPass The pass. This is always SSM_PASS_FINAL for units
524 * that doesn't specify a pfnSaveLive callback.
525 * @remarks The caller enters the device critical section prior to the call.
526 */
527typedef DECLCALLBACKTYPE(int, FNSSMDEVLOADEXEC,(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass));
528/** Pointer to a FNSSMDEVLOADEXEC() function. */
529typedef FNSSMDEVLOADEXEC *PFNSSMDEVLOADEXEC;
530
531/**
532 * Done state load operation.
533 *
534 * @returns VBox load code.
535 * @param pDevIns Device instance of the device which registered the data unit.
536 * @param pSSM SSM operation handle.
537 * @remarks The caller enters the device critical section prior to the call.
538 */
539typedef DECLCALLBACKTYPE(int, FNSSMDEVLOADDONE,(PPDMDEVINS pDevIns, PSSMHANDLE pSSM));
540/** Pointer to a FNSSMDEVLOADDONE() function. */
541typedef FNSSMDEVLOADDONE *PFNSSMDEVLOADDONE;
542
543/** @} */
544
545
546/** The PDM USB device callback variants.
547 * @{
548 */
549
550/**
551 * Prepare state live save operation.
552 *
553 * @returns VBox status code.
554 * @param pUsbIns The USB device instance of the USB device which
555 * registered the data unit.
556 * @param pSSM SSM operation handle.
557 * @thread Any.
558 */
559typedef DECLCALLBACKTYPE(int, FNSSMUSBLIVEPREP,(PPDMUSBINS pUsbIns, PSSMHANDLE pSSM));
560/** Pointer to a FNSSMUSBLIVEPREP() function. */
561typedef FNSSMUSBLIVEPREP *PFNSSMUSBLIVEPREP;
562
563/**
564 * Execute state live save operation.
565 *
566 * This will be called repeatedly until all units vote that the live phase has
567 * been concluded.
568 *
569 * @returns VBox status code.
570 * @param pUsbIns The USB device instance of the USB device which
571 * registered the data unit.
572 * @param pSSM SSM operation handle.
573 * @param uPass The pass.
574 * @thread Any.
575 */
576typedef DECLCALLBACKTYPE(int, FNSSMUSBLIVEEXEC,(PPDMUSBINS pUsbIns, PSSMHANDLE pSSM, uint32_t uPass));
577/** Pointer to a FNSSMUSBLIVEEXEC() function. */
578typedef FNSSMUSBLIVEEXEC *PFNSSMUSBLIVEEXEC;
579
580/**
581 * Vote on whether the live part of the saving has been concluded.
582 *
583 * The vote stops once a unit has vetoed the decision, so don't rely upon this
584 * being called every time.
585 *
586 * @returns VBox status code.
587 * @retval VINF_SUCCESS if done.
588 * @retval VINF_SSM_VOTE_FOR_ANOTHER_PASS if another pass is needed.
589 * @retval VINF_SSM_VOTE_DONE_DONT_CALL_AGAIN if the live saving of the unit is
590 * done and there is not need calling it again before the final pass.
591 * @retval VERR_SSM_VOTE_FOR_GIVING_UP if its time to give up.
592 *
593 * @param pUsbIns The USB device instance of the USB device which
594 * registered the data unit.
595 * @param pSSM SSM operation handle.
596 * @param uPass The data pass.
597 * @thread Any.
598 */
599typedef DECLCALLBACKTYPE(int, FNSSMUSBLIVEVOTE,(PPDMUSBINS pUsbIns, PSSMHANDLE pSSM, uint32_t uPass));
600/** Pointer to a FNSSMUSBLIVEVOTE() function. */
601typedef FNSSMUSBLIVEVOTE *PFNSSMUSBLIVEVOTE;
602
603/**
604 * Prepare state save operation.
605 *
606 * @returns VBox status code.
607 * @param pUsbIns The USB device instance of the USB device which
608 * registered the data unit.
609 * @param pSSM SSM operation handle.
610 */
611typedef DECLCALLBACKTYPE(int, FNSSMUSBSAVEPREP,(PPDMUSBINS pUsbIns, PSSMHANDLE pSSM));
612/** Pointer to a FNSSMUSBSAVEPREP() function. */
613typedef FNSSMUSBSAVEPREP *PFNSSMUSBSAVEPREP;
614
615/**
616 * Execute state save operation.
617 *
618 * @returns VBox status code.
619 * @param pUsbIns The USB device instance of the USB device which
620 * registered the data unit.
621 * @param pSSM SSM operation handle.
622 */
623typedef DECLCALLBACKTYPE(int, FNSSMUSBSAVEEXEC,(PPDMUSBINS pUsbIns, PSSMHANDLE pSSM));
624/** Pointer to a FNSSMUSBSAVEEXEC() function. */
625typedef FNSSMUSBSAVEEXEC *PFNSSMUSBSAVEEXEC;
626
627/**
628 * Done state save operation.
629 *
630 * @returns VBox status code.
631 * @param pUsbIns The USB device instance of the USB device which
632 * registered the data unit.
633 * @param pSSM SSM operation handle.
634 */
635typedef DECLCALLBACKTYPE(int, FNSSMUSBSAVEDONE,(PPDMUSBINS pUsbIns, PSSMHANDLE pSSM));
636/** Pointer to a FNSSMUSBSAVEDONE() function. */
637typedef FNSSMUSBSAVEDONE *PFNSSMUSBSAVEDONE;
638
639/**
640 * Prepare state load operation.
641 *
642 * @returns VBox status code.
643 * @param pUsbIns The USB device instance of the USB device which
644 * registered the data unit.
645 * @param pSSM SSM operation handle.
646 */
647typedef DECLCALLBACKTYPE(int, FNSSMUSBLOADPREP,(PPDMUSBINS pUsbIns, PSSMHANDLE pSSM));
648/** Pointer to a FNSSMUSBLOADPREP() function. */
649typedef FNSSMUSBLOADPREP *PFNSSMUSBLOADPREP;
650
651/**
652 * Execute state load operation.
653 *
654 * @returns VBox status code.
655 * @param pUsbIns The USB device instance of the USB device which
656 * registered the data unit.
657 * @param pSSM SSM operation handle.
658 * @param uVersion Data layout version.
659 * @param uPass The pass. This is always SSM_PASS_FINAL for units
660 * that doesn't specify a pfnSaveLive callback.
661 */
662typedef DECLCALLBACKTYPE(int, FNSSMUSBLOADEXEC,(PPDMUSBINS pUsbIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass));
663/** Pointer to a FNSSMUSBLOADEXEC() function. */
664typedef FNSSMUSBLOADEXEC *PFNSSMUSBLOADEXEC;
665
666/**
667 * Done state load operation.
668 *
669 * @returns VBox load code.
670 * @param pUsbIns The USB device instance of the USB device which
671 * registered the data unit.
672 * @param pSSM SSM operation handle.
673 */
674typedef DECLCALLBACKTYPE(int, FNSSMUSBLOADDONE,(PPDMUSBINS pUsbIns, PSSMHANDLE pSSM));
675/** Pointer to a FNSSMUSBLOADDONE() function. */
676typedef FNSSMUSBLOADDONE *PFNSSMUSBLOADDONE;
677
678/** @} */
679
680
681/** The PDM Driver callback variants.
682 * @{
683 */
684
685/**
686 * Prepare state live save operation.
687 *
688 * @returns VBox status code.
689 * @param pDrvIns Driver instance of the driver which registered the
690 * data unit.
691 * @param pSSM SSM operation handle.
692 * @thread Any.
693 */
694typedef DECLCALLBACKTYPE(int, FNSSMDRVLIVEPREP,(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM));
695/** Pointer to a FNSSMDRVLIVEPREP() function. */
696typedef FNSSMDRVLIVEPREP *PFNSSMDRVLIVEPREP;
697
698/**
699 * Execute state live save operation.
700 *
701 * This will be called repeatedly until all units vote that the live phase has
702 * been concluded.
703 *
704 * @returns VBox status code.
705 * @param pDrvIns Driver instance of the driver which registered the
706 * data unit.
707 * @param pSSM SSM operation handle.
708 * @param uPass The data pass.
709 * @thread Any.
710 */
711typedef DECLCALLBACKTYPE(int, FNSSMDRVLIVEEXEC,(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uPass));
712/** Pointer to a FNSSMDRVLIVEEXEC() function. */
713typedef FNSSMDRVLIVEEXEC *PFNSSMDRVLIVEEXEC;
714
715/**
716 * Vote on whether the live part of the saving has been concluded.
717 *
718 * The vote stops once a unit has vetoed the decision, so don't rely upon this
719 * being called every time.
720 *
721 * @returns VBox status code.
722 * @retval VINF_SUCCESS if done.
723 * @retval VINF_SSM_VOTE_FOR_ANOTHER_PASS if another pass is needed.
724 * @retval VINF_SSM_VOTE_DONE_DONT_CALL_AGAIN if the live saving of the unit is
725 * done and there is not need calling it again before the final pass.
726 * @retval VERR_SSM_VOTE_FOR_GIVING_UP if its time to give up.
727 *
728 * @param pDrvIns Driver instance of the driver which registered the
729 * data unit.
730 * @param pSSM SSM operation handle.
731 * @param uPass The data pass.
732 * @thread Any.
733 */
734typedef DECLCALLBACKTYPE(int, FNSSMDRVLIVEVOTE,(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uPass));
735/** Pointer to a FNSSMDRVLIVEVOTE() function. */
736typedef FNSSMDRVLIVEVOTE *PFNSSMDRVLIVEVOTE;
737
738
739/**
740 * Prepare state save operation.
741 *
742 * @returns VBox status code.
743 * @param pDrvIns Driver instance of the driver which registered the data unit.
744 * @param pSSM SSM operation handle.
745 */
746typedef DECLCALLBACKTYPE(int, FNSSMDRVSAVEPREP,(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM));
747/** Pointer to a FNSSMDRVSAVEPREP() function. */
748typedef FNSSMDRVSAVEPREP *PFNSSMDRVSAVEPREP;
749
750/**
751 * Execute state save operation.
752 *
753 * @returns VBox status code.
754 * @param pDrvIns Driver instance of the driver which registered the data unit.
755 * @param pSSM SSM operation handle.
756 */
757typedef DECLCALLBACKTYPE(int, FNSSMDRVSAVEEXEC,(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM));
758/** Pointer to a FNSSMDRVSAVEEXEC() function. */
759typedef FNSSMDRVSAVEEXEC *PFNSSMDRVSAVEEXEC;
760
761/**
762 * Done state save operation.
763 *
764 * @returns VBox status code.
765 * @param pDrvIns Driver instance of the driver which registered the data unit.
766 * @param pSSM SSM operation handle.
767 */
768typedef DECLCALLBACKTYPE(int, FNSSMDRVSAVEDONE,(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM));
769/** Pointer to a FNSSMDRVSAVEDONE() function. */
770typedef FNSSMDRVSAVEDONE *PFNSSMDRVSAVEDONE;
771
772/**
773 * Prepare state load operation.
774 *
775 * @returns VBox status code.
776 * @param pDrvIns Driver instance of the driver which registered the data unit.
777 * @param pSSM SSM operation handle.
778 */
779typedef DECLCALLBACKTYPE(int, FNSSMDRVLOADPREP,(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM));
780/** Pointer to a FNSSMDRVLOADPREP() function. */
781typedef FNSSMDRVLOADPREP *PFNSSMDRVLOADPREP;
782
783/**
784 * Execute state load operation.
785 *
786 * @returns VBox status code.
787 * @param pDrvIns Driver instance of the driver which registered the data unit.
788 * @param pSSM SSM operation handle.
789 * @param uVersion Data layout version.
790 * @param uPass The pass. This is always SSM_PASS_FINAL for units
791 * that doesn't specify a pfnSaveLive callback.
792 */
793typedef DECLCALLBACKTYPE(int, FNSSMDRVLOADEXEC,(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass));
794/** Pointer to a FNSSMDRVLOADEXEC() function. */
795typedef FNSSMDRVLOADEXEC *PFNSSMDRVLOADEXEC;
796
797/**
798 * Done state load operation.
799 *
800 * @returns VBox load code.
801 * @param pDrvIns Driver instance of the driver which registered the data unit.
802 * @param pSSM SSM operation handle.
803 */
804typedef DECLCALLBACKTYPE(int, FNSSMDRVLOADDONE,(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM));
805/** Pointer to a FNSSMDRVLOADDONE() function. */
806typedef FNSSMDRVLOADDONE *PFNSSMDRVLOADDONE;
807
808/** @} */
809
810
811/** The internal callback variants.
812 * @{
813 */
814
815
816/**
817 * Prepare state live save operation.
818 *
819 * @returns VBox status code.
820 * @param pVM The cross context VM structure.
821 * @param pSSM SSM operation handle.
822 * @thread Any.
823 */
824typedef DECLCALLBACKTYPE(int, FNSSMINTLIVEPREP,(PVM pVM, PSSMHANDLE pSSM));
825/** Pointer to a FNSSMINTLIVEPREP() function. */
826typedef FNSSMINTLIVEPREP *PFNSSMINTLIVEPREP;
827
828/**
829 * Execute state live save operation.
830 *
831 * This will be called repeatedly until all units vote that the live phase has
832 * been concluded.
833 *
834 * @returns VBox status code.
835 * @param pVM The cross context VM structure.
836 * @param pSSM SSM operation handle.
837 * @param uPass The data pass.
838 * @thread Any.
839 */
840typedef DECLCALLBACKTYPE(int, FNSSMINTLIVEEXEC,(PVM pVM, PSSMHANDLE pSSM, uint32_t uPass));
841/** Pointer to a FNSSMINTLIVEEXEC() function. */
842typedef FNSSMINTLIVEEXEC *PFNSSMINTLIVEEXEC;
843
844/**
845 * Vote on whether the live part of the saving has been concluded.
846 *
847 * The vote stops once a unit has vetoed the decision, so don't rely upon this
848 * being called every time.
849 *
850 * @returns VBox status code.
851 * @retval VINF_SUCCESS if done.
852 * @retval VINF_SSM_VOTE_FOR_ANOTHER_PASS if another pass is needed.
853 * @retval VINF_SSM_VOTE_DONE_DONT_CALL_AGAIN if the live saving of the unit is
854 * done and there is not need calling it again before the final pass.
855 * @retval VERR_SSM_VOTE_FOR_GIVING_UP if its time to give up.
856 *
857 * @param pVM The cross context VM structure.
858 * @param pSSM SSM operation handle.
859 * @param uPass The data pass.
860 * @thread Any.
861 */
862typedef DECLCALLBACKTYPE(int, FNSSMINTLIVEVOTE,(PVM pVM, PSSMHANDLE pSSM, uint32_t uPass));
863/** Pointer to a FNSSMINTLIVEVOTE() function. */
864typedef FNSSMINTLIVEVOTE *PFNSSMINTLIVEVOTE;
865
866/**
867 * Prepare state save operation.
868 *
869 * @returns VBox status code.
870 * @param pVM The cross context VM structure.
871 * @param pSSM SSM operation handle.
872 */
873typedef DECLCALLBACKTYPE(int, FNSSMINTSAVEPREP,(PVM pVM, PSSMHANDLE pSSM));
874/** Pointer to a FNSSMINTSAVEPREP() function. */
875typedef FNSSMINTSAVEPREP *PFNSSMINTSAVEPREP;
876
877/**
878 * Execute state save operation.
879 *
880 * @returns VBox status code.
881 * @param pVM The cross context VM structure.
882 * @param pSSM SSM operation handle.
883 */
884typedef DECLCALLBACKTYPE(int, FNSSMINTSAVEEXEC,(PVM pVM, PSSMHANDLE pSSM));
885/** Pointer to a FNSSMINTSAVEEXEC() function. */
886typedef FNSSMINTSAVEEXEC *PFNSSMINTSAVEEXEC;
887
888/**
889 * Done state save operation.
890 *
891 * @returns VBox status code.
892 * @param pVM The cross context VM structure.
893 * @param pSSM SSM operation handle.
894 */
895typedef DECLCALLBACKTYPE(int, FNSSMINTSAVEDONE,(PVM pVM, PSSMHANDLE pSSM));
896/** Pointer to a FNSSMINTSAVEDONE() function. */
897typedef FNSSMINTSAVEDONE *PFNSSMINTSAVEDONE;
898
899/**
900 * Prepare state load operation.
901 *
902 * @returns VBox status code.
903 * @param pVM The cross context VM structure.
904 * @param pSSM SSM operation handle.
905 */
906typedef DECLCALLBACKTYPE(int, FNSSMINTLOADPREP,(PVM pVM, PSSMHANDLE pSSM));
907/** Pointer to a FNSSMINTLOADPREP() function. */
908typedef FNSSMINTLOADPREP *PFNSSMINTLOADPREP;
909
910/**
911 * Execute state load operation.
912 *
913 * @returns VBox status code.
914 * @param pVM The cross context VM structure.
915 * @param pSSM SSM operation handle.
916 * @param uVersion Data layout version.
917 * @param uPass The pass. This is always SSM_PASS_FINAL for units
918 * that doesn't specify a pfnSaveLive callback.
919 */
920typedef DECLCALLBACKTYPE(int, FNSSMINTLOADEXEC,(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass));
921/** Pointer to a FNSSMINTLOADEXEC() function. */
922typedef FNSSMINTLOADEXEC *PFNSSMINTLOADEXEC;
923
924/**
925 * Done state load operation.
926 *
927 * @returns VBox load code.
928 * @param pVM The cross context VM structure.
929 * @param pSSM SSM operation handle.
930 */
931typedef DECLCALLBACKTYPE(int, FNSSMINTLOADDONE,(PVM pVM, PSSMHANDLE pSSM));
932/** Pointer to a FNSSMINTLOADDONE() function. */
933typedef FNSSMINTLOADDONE *PFNSSMINTLOADDONE;
934
935/** @} */
936
937
938/** The External callback variants.
939 * @{
940 */
941
942/**
943 * Prepare state live save operation.
944 *
945 * @returns VBox status code.
946 * @param pSSM SSM operation handle.
947 * @param pVMM The VMM ring-3 vtable.
948 * @param pvUser User argument.
949 * @thread Any.
950 */
951typedef DECLCALLBACKTYPE(int, FNSSMEXTLIVEPREP,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser));
952/** Pointer to a FNSSMEXTLIVEPREP() function. */
953typedef FNSSMEXTLIVEPREP *PFNSSMEXTLIVEPREP;
954
955/**
956 * Execute state live save operation.
957 *
958 * This will be called repeatedly until all units vote that the live phase has
959 * been concluded.
960 *
961 * @returns VBox status code.
962 * @param pSSM SSM operation handle.
963 * @param pVMM The VMM ring-3 vtable.
964 * @param pvUser User argument.
965 * @param uPass The data pass.
966 * @thread Any.
967 */
968typedef DECLCALLBACKTYPE(int, FNSSMEXTLIVEEXEC,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser, uint32_t uPass));
969/** Pointer to a FNSSMEXTLIVEEXEC() function. */
970typedef FNSSMEXTLIVEEXEC *PFNSSMEXTLIVEEXEC;
971
972/**
973 * Vote on whether the live part of the saving has been concluded.
974 *
975 * The vote stops once a unit has vetoed the decision, so don't rely upon this
976 * being called every time.
977 *
978 * @returns VBox status code.
979 * @retval VINF_SUCCESS if done.
980 * @retval VINF_SSM_VOTE_FOR_ANOTHER_PASS if another pass is needed.
981 * @retval VINF_SSM_VOTE_DONE_DONT_CALL_AGAIN if the live saving of the unit is
982 * done and there is not need calling it again before the final pass.
983 * @retval VERR_SSM_VOTE_FOR_GIVING_UP if its time to give up.
984 *
985 * @param pSSM SSM operation handle.
986 * @param pVMM The VMM ring-3 vtable.
987 * @param pvUser User argument.
988 * @param uPass The data pass.
989 * @thread Any.
990 */
991typedef DECLCALLBACKTYPE(int, FNSSMEXTLIVEVOTE,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser, uint32_t uPass));
992/** Pointer to a FNSSMEXTLIVEVOTE() function. */
993typedef FNSSMEXTLIVEVOTE *PFNSSMEXTLIVEVOTE;
994
995/**
996 * Prepare state save operation.
997 *
998 * @returns VBox status code.
999 * @param pSSM SSM operation handle.
1000 * @param pVMM The VMM ring-3 vtable.
1001 * @param pvUser User argument.
1002 */
1003typedef DECLCALLBACKTYPE(int, FNSSMEXTSAVEPREP,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser));
1004/** Pointer to a FNSSMEXTSAVEPREP() function. */
1005typedef FNSSMEXTSAVEPREP *PFNSSMEXTSAVEPREP;
1006
1007/**
1008 * Execute state save operation.
1009 *
1010 * @returns VBox status code.
1011 * @param pSSM SSM operation handle.
1012 * @param pVMM The VMM ring-3 vtable.
1013 * @param pvUser User argument.
1014 */
1015typedef DECLCALLBACKTYPE(int, FNSSMEXTSAVEEXEC,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser));
1016/** Pointer to a FNSSMEXTSAVEEXEC() function. */
1017typedef FNSSMEXTSAVEEXEC *PFNSSMEXTSAVEEXEC;
1018
1019/**
1020 * Done state save operation.
1021 *
1022 * @returns VBox status code.
1023 * @param pSSM SSM operation handle.
1024 * @param pVMM The VMM ring-3 vtable.
1025 * @param pvUser User argument.
1026 */
1027typedef DECLCALLBACKTYPE(int, FNSSMEXTSAVEDONE,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser));
1028/** Pointer to a FNSSMEXTSAVEDONE() function. */
1029typedef FNSSMEXTSAVEDONE *PFNSSMEXTSAVEDONE;
1030
1031/**
1032 * Prepare state load operation.
1033 *
1034 * @returns VBox status code.
1035 * @param pSSM SSM operation handle.
1036 * @param pVMM The VMM ring-3 vtable.
1037 * @param pvUser User argument.
1038 */
1039typedef DECLCALLBACKTYPE(int, FNSSMEXTLOADPREP,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser));
1040/** Pointer to a FNSSMEXTLOADPREP() function. */
1041typedef FNSSMEXTLOADPREP *PFNSSMEXTLOADPREP;
1042
1043/**
1044 * Execute state load operation.
1045 *
1046 * @returns VBox status code.
1047 * @param pSSM SSM operation handle.
1048 * @param pVMM The VMM ring-3 vtable.
1049 * @param pvUser User argument.
1050 * @param uVersion Data layout version.
1051 * @param uPass The pass. This is always SSM_PASS_FINAL for units
1052 * that doesn't specify a pfnSaveLive callback.
1053 * @remark The odd return value is for legacy reasons.
1054 */
1055typedef DECLCALLBACKTYPE(int, FNSSMEXTLOADEXEC,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser,
1056 uint32_t uVersion, uint32_t uPass));
1057/** Pointer to a FNSSMEXTLOADEXEC() function. */
1058typedef FNSSMEXTLOADEXEC *PFNSSMEXTLOADEXEC;
1059
1060/**
1061 * Done state load operation.
1062 *
1063 * @returns VBox load code.
1064 * @param pSSM SSM operation handle.
1065 * @param pVMM The VMM ring-3 vtable.
1066 * @param pvUser User argument.
1067 */
1068typedef DECLCALLBACKTYPE(int, FNSSMEXTLOADDONE,(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser));
1069/** Pointer to a FNSSMEXTLOADDONE() function. */
1070typedef FNSSMEXTLOADDONE *PFNSSMEXTLOADDONE;
1071
1072/** @} */
1073
1074
1075/**
1076 * SSM stream method table.
1077 *
1078 * This is used by external parties for teleporting over TCP or any other media.
1079 * SSM also uses this internally for file access, thus the 2-3 file centric
1080 * methods.
1081 */
1082typedef struct SSMSTRMOPS
1083{
1084 /** Struct magic + version (SSMSTRMOPS_VERSION). */
1085 uint32_t u32Version;
1086
1087 /**
1088 * Write bytes to the stream.
1089 *
1090 * @returns VBox status code.
1091 * @param pvUser The user argument.
1092 * @param offStream The stream offset we're (supposed to be) at.
1093 * @param pvBuf Pointer to the data.
1094 * @param cbToWrite The number of bytes to write.
1095 */
1096 DECLCALLBACKMEMBER(int, pfnWrite,(void *pvUser, uint64_t offStream, const void *pvBuf, size_t cbToWrite));
1097
1098 /**
1099 * Read bytes to the stream.
1100 *
1101 * @returns VBox status code.
1102 * @param pvUser The user argument.
1103 * @param offStream The stream offset we're (supposed to be) at.
1104 * @param pvBuf Where to return the bytes.
1105 * @param cbToRead The number of bytes to read.
1106 * @param pcbRead Where to return the number of bytes actually
1107 * read. This may differ from cbToRead when the
1108 * end of the stream is encountered.
1109 */
1110 DECLCALLBACKMEMBER(int, pfnRead,(void *pvUser, uint64_t offStream, void *pvBuf, size_t cbToRead, size_t *pcbRead));
1111
1112 /**
1113 * Seeks in the stream.
1114 *
1115 * @returns VBox status code.
1116 * @retval VERR_NOT_SUPPORTED if the stream doesn't support this action.
1117 *
1118 * @param pvUser The user argument.
1119 * @param offSeek The seek offset.
1120 * @param uMethod RTFILE_SEEK_BEGIN, RTFILE_SEEK_END or
1121 * RTFILE_SEEK_CURRENT.
1122 * @param poffActual Where to store the new file position. Optional.
1123 */
1124 DECLCALLBACKMEMBER(int, pfnSeek,(void *pvUser, int64_t offSeek, unsigned uMethod, uint64_t *poffActual));
1125
1126 /**
1127 * Get the current stream position.
1128 *
1129 * @returns The correct stream position.
1130 * @param pvUser The user argument.
1131 */
1132 DECLCALLBACKMEMBER(uint64_t, pfnTell,(void *pvUser));
1133
1134 /**
1135 * Get the size/length of the stream.
1136 *
1137 * @returns VBox status code.
1138 * @retval VERR_NOT_SUPPORTED if the stream doesn't support this action.
1139 *
1140 * @param pvUser The user argument.
1141 * @param pcb Where to return the size/length.
1142 */
1143 DECLCALLBACKMEMBER(int, pfnSize,(void *pvUser, uint64_t *pcb));
1144
1145 /**
1146 * Check if the stream is OK or not (cancelled).
1147 *
1148 * @returns VBox status code.
1149 * @param pvUser The user argument.
1150 *
1151 * @remarks The method is expected to do a LogRel on failure.
1152 */
1153 DECLCALLBACKMEMBER(int, pfnIsOk,(void *pvUser));
1154
1155 /**
1156 * Close the stream.
1157 *
1158 * @returns VBox status code.
1159 * @param pvUser The user argument.
1160 * @param fCancelled True if the operation was cancelled.
1161 */
1162 DECLCALLBACKMEMBER(int, pfnClose,(void *pvUser, bool fCancelled));
1163
1164 /** Struct magic + version (SSMSTRMOPS_VERSION). */
1165 uint32_t u32EndVersion;
1166} SSMSTRMOPS;
1167/** Struct magic + version (SSMSTRMOPS_VERSION). */
1168#define SSMSTRMOPS_VERSION UINT32_C(0x55aa0001)
1169
1170
1171VMMR3DECL(void) SSMR3Term(PVM pVM);
1172VMMR3_INT_DECL(int)
1173SSMR3RegisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t uInstance, uint32_t uVersion,
1174 size_t cbGuess, const char *pszBefore,
1175 PFNSSMDEVLIVEPREP pfnLivePrep, PFNSSMDEVLIVEEXEC pfnLiveExec, PFNSSMDEVLIVEVOTE pfnLiveVote,
1176 PFNSSMDEVSAVEPREP pfnSavePrep, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVSAVEDONE pfnSaveDone,
1177 PFNSSMDEVLOADPREP pfnLoadPrep, PFNSSMDEVLOADEXEC pfnLoadExec, PFNSSMDEVLOADDONE pfnLoadDone);
1178VMMR3_INT_DECL(int)
1179SSMR3RegisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
1180 PFNSSMDRVLIVEPREP pfnLivePrep, PFNSSMDRVLIVEEXEC pfnLiveExec, PFNSSMDRVLIVEVOTE pfnLiveVote,
1181 PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone,
1182 PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone);
1183VMMR3_INT_DECL(int)
1184SSMR3RegisterUsb(PVM pVM, PPDMUSBINS pUsbIns, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
1185 PFNSSMUSBLIVEPREP pfnLivePrep, PFNSSMUSBLIVEEXEC pfnLiveExec, PFNSSMUSBLIVEVOTE pfnLiveVote,
1186 PFNSSMUSBSAVEPREP pfnSavePrep, PFNSSMUSBSAVEEXEC pfnSaveExec, PFNSSMUSBSAVEDONE pfnSaveDone,
1187 PFNSSMUSBLOADPREP pfnLoadPrep, PFNSSMUSBLOADEXEC pfnLoadExec, PFNSSMUSBLOADDONE pfnLoadDone);
1188VMMR3DECL(int)
1189SSMR3RegisterInternal(PVM pVM, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
1190 PFNSSMINTLIVEPREP pfnLivePrep, PFNSSMINTLIVEEXEC pfnLiveExec, PFNSSMINTLIVEVOTE pfnLiveVote,
1191 PFNSSMINTSAVEPREP pfnSavePrep, PFNSSMINTSAVEEXEC pfnSaveExec, PFNSSMINTSAVEDONE pfnSaveDone,
1192 PFNSSMINTLOADPREP pfnLoadPrep, PFNSSMINTLOADEXEC pfnLoadExec, PFNSSMINTLOADDONE pfnLoadDone);
1193VMMR3DECL(int)
1194SSMR3RegisterExternal(PUVM pUVM, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
1195 PFNSSMEXTLIVEPREP pfnLivePrep, PFNSSMEXTLIVEEXEC pfnLiveExec, PFNSSMEXTLIVEVOTE pfnLiveVote,
1196 PFNSSMEXTSAVEPREP pfnSavePrep, PFNSSMEXTSAVEEXEC pfnSaveExec, PFNSSMEXTSAVEDONE pfnSaveDone,
1197 PFNSSMEXTLOADPREP pfnLoadPrep, PFNSSMEXTLOADEXEC pfnLoadExec, PFNSSMEXTLOADDONE pfnLoadDone, void *pvUser);
1198VMMR3DECL(int) SSMR3RegisterStub(PVM pVM, const char *pszName, uint32_t uInstance);
1199VMMR3_INT_DECL(int) SSMR3DeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t uInstance);
1200VMMR3_INT_DECL(int) SSMR3DeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t uInstance);
1201VMMR3_INT_DECL(int) SSMR3DeregisterUsb(PVM pVM, PPDMUSBINS pUsbIns, const char *pszName, uint32_t uInstance);
1202VMMR3DECL(int) SSMR3DeregisterInternal(PVM pVM, const char *pszName);
1203VMMR3DECL(int) SSMR3DeregisterExternal(PUVM pUVM, const char *pszName);
1204VMMR3DECL(int) SSMR3Save(PVM pVM, const char *pszFilename, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvUser);
1205VMMR3_INT_DECL(int) SSMR3LiveSave(PVM pVM, uint32_t cMsMaxDowntime,
1206 const char *pszFilename, PCSSMSTRMOPS pStreamOps, void *pvStreamOps,
1207 SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvProgressUser,
1208 PSSMHANDLE *ppSSM);
1209VMMR3_INT_DECL(int) SSMR3LiveDoStep1(PSSMHANDLE pSSM);
1210VMMR3_INT_DECL(int) SSMR3LiveDoStep2(PSSMHANDLE pSSM);
1211VMMR3_INT_DECL(int) SSMR3LiveDone(PSSMHANDLE pSSM);
1212VMMR3DECL(int) SSMR3Load(PVM pVM, const char *pszFilename, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser,
1213 SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvProgressUser);
1214VMMR3DECL(int) SSMR3ValidateFile(const char *pszFilename, bool fChecksumIt);
1215VMMR3DECL(int) SSMR3Open(const char *pszFilename, unsigned fFlags, PSSMHANDLE *ppSSM);
1216VMMR3DECL(int) SSMR3Close(PSSMHANDLE pSSM);
1217VMMR3DECL(int) SSMR3Seek(PSSMHANDLE pSSM, const char *pszUnit, uint32_t iInstance, uint32_t *piVersion);
1218VMMR3DECL(int) SSMR3HandleGetStatus(PSSMHANDLE pSSM);
1219VMMR3DECL(int) SSMR3HandleSetStatus(PSSMHANDLE pSSM, int iStatus);
1220VMMR3DECL(SSMAFTER) SSMR3HandleGetAfter(PSSMHANDLE pSSM);
1221VMMR3DECL(bool) SSMR3HandleIsLiveSave(PSSMHANDLE pSSM);
1222VMMR3DECL(uint32_t) SSMR3HandleMaxDowntime(PSSMHANDLE pSSM);
1223VMMR3DECL(uint32_t) SSMR3HandleHostBits(PSSMHANDLE pSSM);
1224VMMR3DECL(uint32_t) SSMR3HandleRevision(PSSMHANDLE pSSM);
1225VMMR3DECL(uint32_t) SSMR3HandleVersion(PSSMHANDLE pSSM);
1226VMMR3DECL(const char *) SSMR3HandleHostOSAndArch(PSSMHANDLE pSSM);
1227VMMR3_INT_DECL(int) SSMR3HandleSetGCPtrSize(PSSMHANDLE pSSM, unsigned cbGCPtr);
1228VMMR3DECL(void) SSMR3HandleReportLivePercent(PSSMHANDLE pSSM, unsigned uPercent);
1229#ifdef DEBUG
1230VMMR3DECL(uint64_t) SSMR3HandleTellInUnit(PSSMHANDLE pSSM);
1231#endif
1232VMMR3DECL(int) SSMR3Cancel(PUVM pUVM);
1233
1234
1235/** Save operations.
1236 * @{
1237 */
1238VMMR3DECL(int) SSMR3PutStruct(PSSMHANDLE pSSM, const void *pvStruct, PCSSMFIELD paFields);
1239VMMR3DECL(int) SSMR3PutStructEx(PSSMHANDLE pSSM, const void *pvStruct, size_t cbStruct, uint32_t fFlags, PCSSMFIELD paFields, void *pvUser);
1240VMMR3DECL(int) SSMR3PutBool(PSSMHANDLE pSSM, bool fBool);
1241VMMR3DECL(int) SSMR3PutU8(PSSMHANDLE pSSM, uint8_t u8);
1242VMMR3DECL(int) SSMR3PutS8(PSSMHANDLE pSSM, int8_t i8);
1243VMMR3DECL(int) SSMR3PutU16(PSSMHANDLE pSSM, uint16_t u16);
1244VMMR3DECL(int) SSMR3PutS16(PSSMHANDLE pSSM, int16_t i16);
1245VMMR3DECL(int) SSMR3PutU32(PSSMHANDLE pSSM, uint32_t u32);
1246VMMR3DECL(int) SSMR3PutS32(PSSMHANDLE pSSM, int32_t i32);
1247VMMR3DECL(int) SSMR3PutU64(PSSMHANDLE pSSM, uint64_t u64);
1248VMMR3DECL(int) SSMR3PutS64(PSSMHANDLE pSSM, int64_t i64);
1249VMMR3DECL(int) SSMR3PutU128(PSSMHANDLE pSSM, uint128_t u128);
1250VMMR3DECL(int) SSMR3PutS128(PSSMHANDLE pSSM, int128_t i128);
1251VMMR3DECL(int) SSMR3PutUInt(PSSMHANDLE pSSM, RTUINT u);
1252VMMR3DECL(int) SSMR3PutSInt(PSSMHANDLE pSSM, RTINT i);
1253VMMR3DECL(int) SSMR3PutGCUInt(PSSMHANDLE pSSM, RTGCUINT u);
1254VMMR3DECL(int) SSMR3PutGCUIntReg(PSSMHANDLE pSSM, RTGCUINTREG u);
1255VMMR3DECL(int) SSMR3PutGCPhys32(PSSMHANDLE pSSM, RTGCPHYS32 GCPhys);
1256VMMR3DECL(int) SSMR3PutGCPhys64(PSSMHANDLE pSSM, RTGCPHYS64 GCPhys);
1257VMMR3DECL(int) SSMR3PutGCPhys(PSSMHANDLE pSSM, RTGCPHYS GCPhys);
1258VMMR3DECL(int) SSMR3PutGCPtr(PSSMHANDLE pSSM, RTGCPTR GCPtr);
1259VMMR3DECL(int) SSMR3PutGCUIntPtr(PSSMHANDLE pSSM, RTGCUINTPTR GCPtr);
1260VMMR3DECL(int) SSMR3PutRCPtr(PSSMHANDLE pSSM, RTRCPTR RCPtr);
1261VMMR3DECL(int) SSMR3PutIOPort(PSSMHANDLE pSSM, RTIOPORT IOPort);
1262VMMR3DECL(int) SSMR3PutSel(PSSMHANDLE pSSM, RTSEL Sel);
1263VMMR3DECL(int) SSMR3PutMem(PSSMHANDLE pSSM, const void *pv, size_t cb);
1264VMMR3DECL(int) SSMR3PutStrZ(PSSMHANDLE pSSM, const char *psz);
1265/** @} */
1266
1267
1268
1269/** Load operations.
1270 * @{
1271 */
1272VMMR3DECL(int) SSMR3GetStruct(PSSMHANDLE pSSM, void *pvStruct, PCSSMFIELD paFields);
1273VMMR3DECL(int) SSMR3GetStructEx(PSSMHANDLE pSSM, void *pvStruct, size_t cbStruct, uint32_t fFlags, PCSSMFIELD paFields, void *pvUser);
1274VMMR3DECL(int) SSMR3GetBool(PSSMHANDLE pSSM, bool *pfBool);
1275VMMR3DECL(int) SSMR3GetBoolV(PSSMHANDLE pSSM, bool volatile *pfBool);
1276VMMR3DECL(int) SSMR3GetU8(PSSMHANDLE pSSM, uint8_t *pu8);
1277VMMR3DECL(int) SSMR3GetU8V(PSSMHANDLE pSSM, uint8_t volatile *pu8);
1278VMMR3DECL(int) SSMR3GetS8(PSSMHANDLE pSSM, int8_t *pi8);
1279VMMR3DECL(int) SSMR3GetS8V(PSSMHANDLE pSSM, int8_t volatile *pi8);
1280VMMR3DECL(int) SSMR3GetU16(PSSMHANDLE pSSM, uint16_t *pu16);
1281VMMR3DECL(int) SSMR3GetU16V(PSSMHANDLE pSSM, uint16_t volatile *pu16);
1282VMMR3DECL(int) SSMR3GetS16(PSSMHANDLE pSSM, int16_t *pi16);
1283VMMR3DECL(int) SSMR3GetS16V(PSSMHANDLE pSSM, int16_t volatile *pi16);
1284VMMR3DECL(int) SSMR3GetU32(PSSMHANDLE pSSM, uint32_t *pu32);
1285VMMR3DECL(int) SSMR3GetU32V(PSSMHANDLE pSSM, uint32_t volatile *pu32);
1286VMMR3DECL(int) SSMR3GetS32(PSSMHANDLE pSSM, int32_t *pi32);
1287VMMR3DECL(int) SSMR3GetS32V(PSSMHANDLE pSSM, int32_t volatile *pi32);
1288VMMR3DECL(int) SSMR3GetU64(PSSMHANDLE pSSM, uint64_t *pu64);
1289VMMR3DECL(int) SSMR3GetU64V(PSSMHANDLE pSSM, uint64_t volatile *pu64);
1290VMMR3DECL(int) SSMR3GetS64(PSSMHANDLE pSSM, int64_t *pi64);
1291VMMR3DECL(int) SSMR3GetS64V(PSSMHANDLE pSSM, int64_t volatile *pi64);
1292VMMR3DECL(int) SSMR3GetU128(PSSMHANDLE pSSM, uint128_t *pu128);
1293VMMR3DECL(int) SSMR3GetU128V(PSSMHANDLE pSSM, uint128_t volatile *pu128);
1294VMMR3DECL(int) SSMR3GetS128(PSSMHANDLE pSSM, int128_t *pi128);
1295VMMR3DECL(int) SSMR3GetS128V(PSSMHANDLE pSSM, int128_t volatile *pi128);
1296VMMR3DECL(int) SSMR3GetGCPhys32(PSSMHANDLE pSSM, PRTGCPHYS32 pGCPhys);
1297VMMR3DECL(int) SSMR3GetGCPhys32V(PSSMHANDLE pSSM, RTGCPHYS32 volatile *pGCPhys);
1298VMMR3DECL(int) SSMR3GetGCPhys64(PSSMHANDLE pSSM, PRTGCPHYS64 pGCPhys);
1299VMMR3DECL(int) SSMR3GetGCPhys64V(PSSMHANDLE pSSM, RTGCPHYS64 volatile *pGCPhys);
1300VMMR3DECL(int) SSMR3GetGCPhys(PSSMHANDLE pSSM, PRTGCPHYS pGCPhys);
1301VMMR3DECL(int) SSMR3GetGCPhysV(PSSMHANDLE pSSM, RTGCPHYS volatile *pGCPhys);
1302VMMR3DECL(int) SSMR3GetUInt(PSSMHANDLE pSSM, PRTUINT pu);
1303VMMR3DECL(int) SSMR3GetSInt(PSSMHANDLE pSSM, PRTINT pi);
1304VMMR3DECL(int) SSMR3GetGCUInt(PSSMHANDLE pSSM, PRTGCUINT pu);
1305VMMR3DECL(int) SSMR3GetGCUIntReg(PSSMHANDLE pSSM, PRTGCUINTREG pu);
1306VMMR3DECL(int) SSMR3GetGCPtr(PSSMHANDLE pSSM, PRTGCPTR pGCPtr);
1307VMMR3DECL(int) SSMR3GetGCUIntPtr(PSSMHANDLE pSSM, PRTGCUINTPTR pGCPtr);
1308VMMR3DECL(int) SSMR3GetRCPtr(PSSMHANDLE pSSM, PRTRCPTR pRCPtr);
1309VMMR3DECL(int) SSMR3GetIOPort(PSSMHANDLE pSSM, PRTIOPORT pIOPort);
1310VMMR3DECL(int) SSMR3GetSel(PSSMHANDLE pSSM, PRTSEL pSel);
1311VMMR3DECL(int) SSMR3GetMem(PSSMHANDLE pSSM, void *pv, size_t cb);
1312VMMR3DECL(int) SSMR3GetStrZ(PSSMHANDLE pSSM, char *psz, size_t cbMax);
1313VMMR3DECL(int) SSMR3GetStrZEx(PSSMHANDLE pSSM, char *psz, size_t cbMax, size_t *pcbStr);
1314VMMR3DECL(int) SSMR3Skip(PSSMHANDLE pSSM, size_t cb);
1315VMMR3DECL(int) SSMR3SkipToEndOfUnit(PSSMHANDLE pSSM);
1316VMMR3DECL(int) SSMR3SetLoadError(PSSMHANDLE pSSM, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(6, 7);
1317VMMR3DECL(int) SSMR3SetLoadErrorV(PSSMHANDLE pSSM, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(6, 0);
1318VMMR3DECL(int) SSMR3SetCfgError(PSSMHANDLE pSSM, RT_SRC_POS_DECL, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(5, 6);
1319VMMR3DECL(int) SSMR3SetCfgErrorV(PSSMHANDLE pSSM, RT_SRC_POS_DECL, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(5, 0);
1320
1321/** Wrapper around SSMR3GetU32 for simplifying getting enum values saved as uint32_t. */
1322# define SSM_GET_ENUM32_RET(a_pSSM, a_enmDst, a_EnumType) \
1323 do { \
1324 uint32_t u32GetEnumTmp = 0; \
1325 int rcGetEnum32Tmp = SSMR3GetU32((a_pSSM), &u32GetEnumTmp); \
1326 AssertRCReturn(rcGetEnum32Tmp, rcGetEnum32Tmp); \
1327 (a_enmDst) = (a_EnumType)u32GetEnumTmp; \
1328 AssertCompile(sizeof(a_EnumType) == sizeof(u32GetEnumTmp)); \
1329 } while (0)
1330
1331/** @} */
1332
1333/** @} */
1334#endif /* IN_RING3 */
1335
1336
1337/** @} */
1338
1339RT_C_DECLS_END
1340
1341#endif /* !VBOX_INCLUDED_vmm_ssm_h */
1342
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette