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