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