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