VirtualBox

source: vbox/trunk/include/VBox/ssm.h@ 22803

Last change on this file since 22803 was 22803, checked in by vboxsync, 15 years ago

ssm: Use VMMR3_INT_DECL.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 27.2 KB
Line 
1/** @file
2 * SSM - The Save State Manager. (VMM)
3 */
4
5/*
6 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 */
29
30#ifndef ___VBox_ssm_h
31#define ___VBox_ssm_h
32
33#include <VBox/cdefs.h>
34#include <VBox/types.h>
35#include <VBox/tm.h>
36#include <VBox/vmapi.h>
37
38RT_C_DECLS_BEGIN
39
40/** @defgroup grp_ssm The Saved State Manager API
41 * @{
42 */
43
44/**
45 * Determine the major version of the SSM version. If the major SSM version of two snapshots is
46 * different, the snapshots are incompatible.
47 */
48#define SSM_VERSION_MAJOR(ver) ((ver) & 0xffff0000)
49
50/**
51 * Determine the minor version of the SSM version. If the major SSM version of two snapshots is
52 * the same, the code must handle incompatibilies between minor version changes (e.g. use dummy
53 * values for non-existent fields).
54 */
55#define SSM_VERSION_MINOR(ver) ((ver) & 0x0000ffff)
56
57/**
58 * Determine if the major version changed between two SSM versions.
59 */
60#define SSM_VERSION_MAJOR_CHANGED(ver1,ver2) (SSM_VERSION_MAJOR(ver1) != SSM_VERSION_MAJOR(ver2))
61
62/** The special value for the final pass. */
63#define SSM_PASS_FINAL UINT32_MAX
64
65
66#ifdef IN_RING3
67/** @defgroup grp_ssm_r3 The SSM Host Context Ring-3 API
68 * @{
69 */
70
71
72/**
73 * What to do after the save/load operation.
74 */
75typedef enum SSMAFTER
76{
77 /** Invalid. */
78 SSMAFTER_INVALID = 0,
79 /** Will resume the loaded state. */
80 SSMAFTER_RESUME,
81 /** Will destroy the VM after saving. */
82 SSMAFTER_DESTROY,
83 /** Will continue execution after saving the VM. */
84 SSMAFTER_CONTINUE,
85 /** Will migrate the VM.
86 * The source VM will be destroyed (then one saving), the destination VM
87 * will continue execution. */
88 SSMAFTER_MIGRATE,
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/**
99 * A structure field description.
100 *
101 * @todo Add an type field here for recording what's a GCPtr, GCPhys or anything
102 * else that may change and is expected to continue to work.
103 * @todo Later we need to add load transformations to this structure. I think a
104 * callback with a number of default transformations in SIG_DEF style
105 * would be good enough. The callback would take a user context from a new
106 * SSMR3GetStruct parameter or something.
107 */
108typedef struct SSMFIELD
109{
110 /** Field offset into the structure. */
111 uint32_t off;
112 /** The size of the field. */
113 uint32_t cb;
114} SSMFIELD;
115/** Pointer to a structure field description. */
116typedef SSMFIELD *PSSMFIELD;
117/** Pointer to a const structure field description. */
118typedef const SSMFIELD *PCSSMFIELD;
119
120/** Emit a SSMFIELD array entry. */
121#define SSMFIELD_ENTRY(Type, Field) { RT_OFFSETOF(Type, Field), RT_SIZEOFMEMB(Type, Field) }
122/** Emit a SSMFIELD array entry for a RTGCPTR type. */
123#define SSMFIELD_ENTRY_GCPTR(Type, Field) SSMFIELD_ENTRY(Type, Field)
124/** Emit a SSMFIELD array entry for a RTGCPHYS type. */
125#define SSMFIELD_ENTRY_GCPHYS(Type, Field) SSMFIELD_ENTRY(Type, Field)
126/** Emit the terminating entry of a SSMFIELD array. */
127#define SSMFIELD_ENTRY_TERM() { UINT32_MAX, UINT32_MAX }
128
129
130
131/** The PDM Device callback variants.
132 * @{
133 */
134
135/**
136 * Prepare state live save operation.
137 *
138 * @returns VBox status code.
139 * @param pDevIns Device instance of the device which registered the data unit.
140 * @param pSSM SSM operation handle.
141 * @thread Any.
142 */
143typedef DECLCALLBACK(int) FNSSMDEVLIVEPREP(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
144/** Pointer to a FNSSMDEVLIVEPREP() function. */
145typedef FNSSMDEVLIVEPREP *PFNSSMDEVLIVEPREP;
146
147/**
148 * Execute state live save operation.
149 *
150 * This will be called repeatedly until all units vote that the live phase has
151 * been concluded.
152 *
153 * @returns VBox status code.
154 * @param pDevIns Device instance of the device which registered the data unit.
155 * @param pSSM SSM operation handle.
156 * @param uPass The pass.
157 * @thread Any.
158 */
159typedef DECLCALLBACK(int) FNSSMDEVLIVEEXEC(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass);
160/** Pointer to a FNSSMDEVLIVEEXEC() function. */
161typedef FNSSMDEVLIVEEXEC *PFNSSMDEVLIVEEXEC;
162
163/**
164 * Vote on whether the live part of the saving has been concluded.
165 *
166 * The vote stops once a unit has vetoed the decision, so don't rely upon this
167 * being called every time.
168 *
169 * @returns VBox status code.
170 * @retval VINF_SUCCESS if done.
171 * @retval VINF_SSM_VOTE_FOR_ANOTHER_PASS if another pass is needed.
172 * @retval VERR_SSM_VOTE_FOR_GIVING_UP if its time to give up.
173 *
174 * @param pDevIns Device instance of the device which registered the data unit.
175 * @param pSSM SSM operation handle.
176 * @thread Any.
177 */
178typedef DECLCALLBACK(int) FNSSMDEVLIVEVOTE(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
179/** Pointer to a FNSSMDEVLIVEVOTE() function. */
180typedef FNSSMDEVLIVEVOTE *PFNSSMDEVLIVEVOTE;
181
182/**
183 * Prepare state save operation.
184 *
185 * @returns VBox status code.
186 * @param pDevIns Device instance of the device which registered the data unit.
187 * @param pSSM SSM operation handle.
188 */
189typedef DECLCALLBACK(int) FNSSMDEVSAVEPREP(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
190/** Pointer to a FNSSMDEVSAVEPREP() function. */
191typedef FNSSMDEVSAVEPREP *PFNSSMDEVSAVEPREP;
192
193/**
194 * Execute state save operation.
195 *
196 * @returns VBox status code.
197 * @param pDevIns Device instance of the device which registered the data unit.
198 * @param pSSM SSM operation handle.
199 */
200typedef DECLCALLBACK(int) FNSSMDEVSAVEEXEC(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
201/** Pointer to a FNSSMDEVSAVEEXEC() function. */
202typedef FNSSMDEVSAVEEXEC *PFNSSMDEVSAVEEXEC;
203
204/**
205 * Done state save operation.
206 *
207 * @returns VBox status code.
208 * @param pDevIns Device instance of the device which registered the data unit.
209 * @param pSSM SSM operation handle.
210 */
211typedef DECLCALLBACK(int) FNSSMDEVSAVEDONE(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
212/** Pointer to a FNSSMDEVSAVEDONE() function. */
213typedef FNSSMDEVSAVEDONE *PFNSSMDEVSAVEDONE;
214
215/**
216 * Prepare state load operation.
217 *
218 * @returns VBox status code.
219 * @param pDevIns Device instance of the device which registered the data unit.
220 * @param pSSM SSM operation handle.
221 */
222typedef DECLCALLBACK(int) FNSSMDEVLOADPREP(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
223/** Pointer to a FNSSMDEVLOADPREP() function. */
224typedef FNSSMDEVLOADPREP *PFNSSMDEVLOADPREP;
225
226/**
227 * Execute state load operation.
228 *
229 * @returns VBox status code.
230 * @param pDevIns Device instance of the device which registered the data unit.
231 * @param pSSM SSM operation handle.
232 * @param uVersion Data layout version.
233 * @param uPass The pass. This is always SSM_PASS_FINAL for units
234 * that doesn't specify a pfnSaveLive callback.
235 */
236typedef DECLCALLBACK(int) FNSSMDEVLOADEXEC(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
237/** Pointer to a FNSSMDEVLOADEXEC() function. */
238typedef FNSSMDEVLOADEXEC *PFNSSMDEVLOADEXEC;
239
240/**
241 * Done state load operation.
242 *
243 * @returns VBox load code.
244 * @param pDevIns Device instance of the device which registered the data unit.
245 * @param pSSM SSM operation handle.
246 */
247typedef DECLCALLBACK(int) FNSSMDEVLOADDONE(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
248/** Pointer to a FNSSMDEVLOADDONE() function. */
249typedef FNSSMDEVLOADDONE *PFNSSMDEVLOADDONE;
250
251/** @} */
252
253
254/** The PDM Driver callback variants.
255 * @{
256 */
257
258/**
259 * Prepare state live save operation.
260 *
261 * @returns VBox status code.
262 * @param pDrvIns Driver instance of the device which registered the
263 * data unit.
264 * @param pSSM SSM operation handle.
265 * @thread Any.
266 */
267typedef DECLCALLBACK(int) FNSSMDRVLIVEPREP(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
268/** Pointer to a FNSSMDRVLIVEPREP() function. */
269typedef FNSSMDRVLIVEPREP *PFNSSMDRVLIVEPREP;
270
271/**
272 * Execute state live save operation.
273 *
274 * This will be called repeatedly until all units vote that the live phase has
275 * been concluded.
276 *
277 * @returns VBox status code.
278 * @param pDrvIns Driver instance of the device which registered the
279 * data unit.
280 * @param pSSM SSM operation handle.
281 * @param uPass The data pass.
282 * @thread Any.
283 */
284typedef DECLCALLBACK(int) FNSSMDRVLIVEEXEC(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uPass);
285/** Pointer to a FNSSMDRVLIVEEXEC() function. */
286typedef FNSSMDRVLIVEEXEC *PFNSSMDRVLIVEEXEC;
287
288/**
289 * Vote on whether the live part of the saving has been concluded.
290 *
291 * The vote stops once a unit has vetoed the decision, so don't rely upon this
292 * being called every time.
293 *
294 * @returns VBox status code.
295 * @retval VINF_SUCCESS if done.
296 * @retval VINF_SSM_VOTE_FOR_ANOTHER_PASS if another pass is needed.
297 * @retval VERR_SSM_VOTE_FOR_GIVING_UP if its time to give up.
298 *
299 * @param pDrvIns Driver instance of the device which registered the
300 * data unit.
301 * @param pSSM SSM operation handle.
302 * @thread Any.
303 */
304typedef DECLCALLBACK(int) FNSSMDRVLIVEVOTE(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
305/** Pointer to a FNSSMDRVLIVEVOTE() function. */
306typedef FNSSMDRVLIVEVOTE *PFNSSMDRVLIVEVOTE;
307
308
309/**
310 * Prepare state save operation.
311 *
312 * @returns VBox status code.
313 * @param pDrvIns Driver instance of the driver which registered the data unit.
314 * @param pSSM SSM operation handle.
315 */
316typedef DECLCALLBACK(int) FNSSMDRVSAVEPREP(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
317/** Pointer to a FNSSMDRVSAVEPREP() function. */
318typedef FNSSMDRVSAVEPREP *PFNSSMDRVSAVEPREP;
319
320/**
321 * Execute state save operation.
322 *
323 * @returns VBox status code.
324 * @param pDrvIns Driver instance of the driver which registered the data unit.
325 * @param pSSM SSM operation handle.
326 */
327typedef DECLCALLBACK(int) FNSSMDRVSAVEEXEC(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
328/** Pointer to a FNSSMDRVSAVEEXEC() function. */
329typedef FNSSMDRVSAVEEXEC *PFNSSMDRVSAVEEXEC;
330
331/**
332 * Done state save operation.
333 *
334 * @returns VBox status code.
335 * @param pDrvIns Driver instance of the driver which registered the data unit.
336 * @param pSSM SSM operation handle.
337 */
338typedef DECLCALLBACK(int) FNSSMDRVSAVEDONE(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
339/** Pointer to a FNSSMDRVSAVEDONE() function. */
340typedef FNSSMDRVSAVEDONE *PFNSSMDRVSAVEDONE;
341
342/**
343 * Prepare state load operation.
344 *
345 * @returns VBox status code.
346 * @param pDrvIns Driver instance of the driver which registered the data unit.
347 * @param pSSM SSM operation handle.
348 */
349typedef DECLCALLBACK(int) FNSSMDRVLOADPREP(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
350/** Pointer to a FNSSMDRVLOADPREP() function. */
351typedef FNSSMDRVLOADPREP *PFNSSMDRVLOADPREP;
352
353/**
354 * Execute state load operation.
355 *
356 * @returns VBox status code.
357 * @param pDrvIns Driver instance of the driver which registered the data unit.
358 * @param pSSM SSM operation handle.
359 * @param uVersion Data layout version.
360 * @param uPass The pass. This is always SSM_PASS_FINAL for units
361 * that doesn't specify a pfnSaveLive callback.
362 */
363typedef DECLCALLBACK(int) FNSSMDRVLOADEXEC(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
364/** Pointer to a FNSSMDRVLOADEXEC() function. */
365typedef FNSSMDRVLOADEXEC *PFNSSMDRVLOADEXEC;
366
367/**
368 * Done state load operation.
369 *
370 * @returns VBox load code.
371 * @param pDrvIns Driver instance of the driver which registered the data unit.
372 * @param pSSM SSM operation handle.
373 */
374typedef DECLCALLBACK(int) FNSSMDRVLOADDONE(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
375/** Pointer to a FNSSMDRVLOADDONE() function. */
376typedef FNSSMDRVLOADDONE *PFNSSMDRVLOADDONE;
377
378/** @} */
379
380
381/** The internal callback variants.
382 * @{
383 */
384
385
386/**
387 * Prepare state live save operation.
388 *
389 * @returns VBox status code.
390 * @param pVM VM Handle.
391 * @param pSSM SSM operation handle.
392 * @thread Any.
393 */
394typedef DECLCALLBACK(int) FNSSMINTLIVEPREP(PVM pVM, PSSMHANDLE pSSM);
395/** Pointer to a FNSSMINTLIVEPREP() function. */
396typedef FNSSMINTLIVEPREP *PFNSSMINTLIVEPREP;
397
398/**
399 * Execute state live save operation.
400 *
401 * This will be called repeatedly until all units vote that the live phase has
402 * been concluded.
403 *
404 * @returns VBox status code.
405 * @param pVM VM Handle.
406 * @param pSSM SSM operation handle.
407 * @param uPass The data pass.
408 * @thread Any.
409 */
410typedef DECLCALLBACK(int) FNSSMINTLIVEEXEC(PVM pVM, PSSMHANDLE pSSM, uint32_t uPass);
411/** Pointer to a FNSSMINTLIVEEXEC() function. */
412typedef FNSSMINTLIVEEXEC *PFNSSMINTLIVEEXEC;
413
414/**
415 * Vote on whether the live part of the saving has been concluded.
416 *
417 * The vote stops once a unit has vetoed the decision, so don't rely upon this
418 * being called every time.
419 *
420 * @returns VBox status code.
421 * @retval VINF_SUCCESS if done.
422 * @retval VINF_SSM_VOTE_FOR_ANOTHER_PASS if another pass is needed.
423 * @retval VERR_SSM_VOTE_FOR_GIVING_UP if its time to give up.
424 *
425 * @param pVM VM Handle.
426 * @param pSSM SSM operation handle.
427 * @thread Any.
428 */
429typedef DECLCALLBACK(int) FNSSMINTLIVEVOTE(PVM pVM, PSSMHANDLE pSSM);
430/** Pointer to a FNSSMINTLIVEVOTE() function. */
431typedef FNSSMINTLIVEVOTE *PFNSSMINTLIVEVOTE;
432
433/**
434 * Prepare state save operation.
435 *
436 * @returns VBox status code.
437 * @param pVM VM Handle.
438 * @param pSSM SSM operation handle.
439 */
440typedef DECLCALLBACK(int) FNSSMINTSAVEPREP(PVM pVM, PSSMHANDLE pSSM);
441/** Pointer to a FNSSMINTSAVEPREP() function. */
442typedef FNSSMINTSAVEPREP *PFNSSMINTSAVEPREP;
443
444/**
445 * Execute state save operation.
446 *
447 * @returns VBox status code.
448 * @param pVM VM Handle.
449 * @param pSSM SSM operation handle.
450 */
451typedef DECLCALLBACK(int) FNSSMINTSAVEEXEC(PVM pVM, PSSMHANDLE pSSM);
452/** Pointer to a FNSSMINTSAVEEXEC() function. */
453typedef FNSSMINTSAVEEXEC *PFNSSMINTSAVEEXEC;
454
455/**
456 * Done state save operation.
457 *
458 * @returns VBox status code.
459 * @param pVM VM Handle.
460 * @param pSSM SSM operation handle.
461 */
462typedef DECLCALLBACK(int) FNSSMINTSAVEDONE(PVM pVM, PSSMHANDLE pSSM);
463/** Pointer to a FNSSMINTSAVEDONE() function. */
464typedef FNSSMINTSAVEDONE *PFNSSMINTSAVEDONE;
465
466/**
467 * Prepare state load operation.
468 *
469 * @returns VBox status code.
470 * @param pVM VM Handle.
471 * @param pSSM SSM operation handle.
472 */
473typedef DECLCALLBACK(int) FNSSMINTLOADPREP(PVM pVM, PSSMHANDLE pSSM);
474/** Pointer to a FNSSMINTLOADPREP() function. */
475typedef FNSSMINTLOADPREP *PFNSSMINTLOADPREP;
476
477/**
478 * Execute state load operation.
479 *
480 * @returns VBox status code.
481 * @param pVM VM Handle.
482 * @param pSSM SSM operation handle.
483 * @param uVersion Data layout version.
484 * @param uPass The pass. This is always SSM_PASS_FINAL for units
485 * that doesn't specify a pfnSaveLive callback.
486 */
487typedef DECLCALLBACK(int) FNSSMINTLOADEXEC(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
488/** Pointer to a FNSSMINTLOADEXEC() function. */
489typedef FNSSMINTLOADEXEC *PFNSSMINTLOADEXEC;
490
491/**
492 * Done state load operation.
493 *
494 * @returns VBox load code.
495 * @param pVM VM Handle.
496 * @param pSSM SSM operation handle.
497 */
498typedef DECLCALLBACK(int) FNSSMINTLOADDONE(PVM pVM, PSSMHANDLE pSSM);
499/** Pointer to a FNSSMINTLOADDONE() function. */
500typedef FNSSMINTLOADDONE *PFNSSMINTLOADDONE;
501
502/** @} */
503
504
505/** The External callback variants.
506 * @{
507 */
508
509/**
510 * Prepare state live save operation.
511 *
512 * @returns VBox status code.
513 * @param pSSM SSM operation handle.
514 * @param pvUser User argument.
515 * @thread Any.
516 */
517typedef DECLCALLBACK(int) FNSSMEXTLIVEPREP(PSSMHANDLE pSSM, void *pvUser);
518/** Pointer to a FNSSMEXTLIVEPREP() function. */
519typedef FNSSMEXTLIVEPREP *PFNSSMEXTLIVEPREP;
520
521/**
522 * Execute state live save operation.
523 *
524 * This will be called repeatedly until all units vote that the live phase has
525 * been concluded.
526 *
527 * @returns VBox status code.
528 * @param pSSM SSM operation handle.
529 * @param pvUser User argument.
530 * @param uPass The data pass.
531 * @thread Any.
532 */
533typedef DECLCALLBACK(int) FNSSMEXTLIVEEXEC(PSSMHANDLE pSSM, void *pvUser, uint32_t uPass);
534/** Pointer to a FNSSMEXTLIVEEXEC() function. */
535typedef FNSSMEXTLIVEEXEC *PFNSSMEXTLIVEEXEC;
536
537/**
538 * Vote on whether the live part of the saving has been concluded.
539 *
540 * The vote stops once a unit has vetoed the decision, so don't rely upon this
541 * being called every time.
542 *
543 * @returns true if done, false if there is more that needs to be saved first.
544 * @param pSSM SSM operation handle.
545 * @param pvUser User argument.
546 * @thread Any.
547 */
548typedef DECLCALLBACK(int) FNSSMEXTLIVEVOTE(PSSMHANDLE pSSM, void *pvUser);
549/** Pointer to a FNSSMEXTLIVEVOTE() function. */
550typedef FNSSMEXTLIVEVOTE *PFNSSMEXTLIVEVOTE;
551
552/**
553 * Prepare state save operation.
554 *
555 * @returns VBox status code.
556 * @param pSSM SSM operation handle.
557 * @param pvUser User argument.
558 */
559typedef DECLCALLBACK(int) FNSSMEXTSAVEPREP(PSSMHANDLE pSSM, void *pvUser);
560/** Pointer to a FNSSMEXTSAVEPREP() function. */
561typedef FNSSMEXTSAVEPREP *PFNSSMEXTSAVEPREP;
562
563/**
564 * Execute state save operation.
565 *
566 * @param pSSM SSM operation handle.
567 * @param pvUser User argument.
568 * @author The lack of return code is for legacy reasons.
569 */
570typedef DECLCALLBACK(void) FNSSMEXTSAVEEXEC(PSSMHANDLE pSSM, void *pvUser);
571/** Pointer to a FNSSMEXTSAVEEXEC() function. */
572typedef FNSSMEXTSAVEEXEC *PFNSSMEXTSAVEEXEC;
573
574/**
575 * Done state save operation.
576 *
577 * @returns VBox status code.
578 * @param pSSM SSM operation handle.
579 * @param pvUser User argument.
580 */
581typedef DECLCALLBACK(int) FNSSMEXTSAVEDONE(PSSMHANDLE pSSM, void *pvUser);
582/** Pointer to a FNSSMEXTSAVEDONE() function. */
583typedef FNSSMEXTSAVEDONE *PFNSSMEXTSAVEDONE;
584
585/**
586 * Prepare state load operation.
587 *
588 * @returns VBox status code.
589 * @param pSSM SSM operation handle.
590 * @param pvUser User argument.
591 */
592typedef DECLCALLBACK(int) FNSSMEXTLOADPREP(PSSMHANDLE pSSM, void *pvUser);
593/** Pointer to a FNSSMEXTLOADPREP() function. */
594typedef FNSSMEXTLOADPREP *PFNSSMEXTLOADPREP;
595
596/**
597 * Execute state load operation.
598 *
599 * @returns VBox status code.
600 * @param pSSM SSM operation handle.
601 * @param pvUser User argument.
602 * @param uVersion Data layout version.
603 * @param uPass The pass. This is always SSM_PASS_FINAL for units
604 * that doesn't specify a pfnSaveLive callback.
605 * @remark The odd return value is for legacy reasons.
606 */
607typedef DECLCALLBACK(int) FNSSMEXTLOADEXEC(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
608/** Pointer to a FNSSMEXTLOADEXEC() function. */
609typedef FNSSMEXTLOADEXEC *PFNSSMEXTLOADEXEC;
610
611/**
612 * Done state load operation.
613 *
614 * @returns VBox load code.
615 * @param pSSM SSM operation handle.
616 * @param pvUser User argument.
617 */
618typedef DECLCALLBACK(int) FNSSMEXTLOADDONE(PSSMHANDLE pSSM, void *pvUser);
619/** Pointer to a FNSSMEXTLOADDONE() function. */
620typedef FNSSMEXTLOADDONE *PFNSSMEXTLOADDONE;
621
622/** @} */
623
624
625VMMR3DECL(int) SSMR3RegisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess, const char *pszBefore,
626 PFNSSMDEVLIVEPREP pfnLivePrep, PFNSSMDEVLIVEEXEC pfnLiveExec, PFNSSMDEVLIVEVOTE pfnLiveVote,
627 PFNSSMDEVSAVEPREP pfnSavePrep, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVSAVEDONE pfnSaveDone,
628 PFNSSMDEVLOADPREP pfnLoadPrep, PFNSSMDEVLOADEXEC pfnLoadExec, PFNSSMDEVLOADDONE pfnLoadDone);
629VMMR3DECL(int) SSMR3RegisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
630 PFNSSMDRVLIVEPREP pfnLivePrep, PFNSSMDRVLIVEEXEC pfnLiveExec, PFNSSMDRVLIVEVOTE pfnLiveVote,
631 PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone,
632 PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone);
633VMMR3DECL(int) SSMR3RegisterInternal(PVM pVM, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
634 PFNSSMINTLIVEPREP pfnLivePrep, PFNSSMINTLIVEEXEC pfnLiveExec, PFNSSMINTLIVEVOTE pfnLiveVote,
635 PFNSSMINTSAVEPREP pfnSavePrep, PFNSSMINTSAVEEXEC pfnSaveExec, PFNSSMINTSAVEDONE pfnSaveDone,
636 PFNSSMINTLOADPREP pfnLoadPrep, PFNSSMINTLOADEXEC pfnLoadExec, PFNSSMINTLOADDONE pfnLoadDone);
637VMMR3DECL(int) SSMR3RegisterExternal(PVM pVM, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
638 PFNSSMEXTLIVEPREP pfnLivePrep, PFNSSMEXTLIVEEXEC pfnLiveExec, PFNSSMEXTLIVEVOTE pfnLiveVote,
639 PFNSSMEXTSAVEPREP pfnSavePrep, PFNSSMEXTSAVEEXEC pfnSaveExec, PFNSSMEXTSAVEDONE pfnSaveDone,
640 PFNSSMEXTLOADPREP pfnLoadPrep, PFNSSMEXTLOADEXEC pfnLoadExec, PFNSSMEXTLOADDONE pfnLoadDone, void *pvUser);
641VMMR3_INT_DECL(int) SSMR3DeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t uInstance);
642VMMR3_INT_DECL(int) SSMR3DeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t uInstance);
643VMMR3DECL(int) SSMR3DeregisterInternal(PVM pVM, const char *pszName);
644VMMR3DECL(int) SSMR3DeregisterExternal(PVM pVM, const char *pszName);
645VMMR3DECL(int) SSMR3Save(PVM pVM, const char *pszFilename, SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvUser);
646VMMR3_INT_DECL(int) SSMR3LiveToFile(PVM pVM, const char *pszFilename, SSMAFTER enmAfter,
647 PFNVMPROGRESS pfnProgress, void *pvUser, PSSMHANDLE *ppSSM);
648VMMR3_INT_DECL(int) SSMR3LiveDoStep1(PSSMHANDLE pSSM);
649VMMR3_INT_DECL(int) SSMR3LiveDoStep2(PSSMHANDLE pSSM);
650VMMR3_INT_DECL(int) SSMR3LiveDone(PSSMHANDLE pSSM);
651VMMR3DECL(int) SSMR3Load(PVM pVM, const char *pszFilename, SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvUser);
652VMMR3DECL(int) SSMR3ValidateFile(const char *pszFilename, bool fChecksumIt);
653VMMR3DECL(int) SSMR3Open(const char *pszFilename, unsigned fFlags, PSSMHANDLE *ppSSM);
654VMMR3DECL(int) SSMR3Close(PSSMHANDLE pSSM);
655VMMR3DECL(int) SSMR3Seek(PSSMHANDLE pSSM, const char *pszUnit, uint32_t iInstance, uint32_t *piVersion);
656VMMR3DECL(int) SSMR3HandleGetStatus(PSSMHANDLE pSSM);
657VMMR3DECL(int) SSMR3HandleSetStatus(PSSMHANDLE pSSM, int iStatus);
658VMMR3DECL(SSMAFTER) SSMR3HandleGetAfter(PSSMHANDLE pSSM);
659VMMR3DECL(uint64_t) SSMR3HandleGetUnitOffset(PSSMHANDLE pSSM);
660VMMR3_INT_DECL(int) SSMR3SetGCPtrSize(PSSMHANDLE pSSM, unsigned cbGCPtr);
661
662
663/** Save operations.
664 * @{
665 */
666VMMR3DECL(int) SSMR3PutStruct(PSSMHANDLE pSSM, const void *pvStruct, PCSSMFIELD paFields);
667VMMR3DECL(int) SSMR3PutBool(PSSMHANDLE pSSM, bool fBool);
668VMMR3DECL(int) SSMR3PutU8(PSSMHANDLE pSSM, uint8_t u8);
669VMMR3DECL(int) SSMR3PutS8(PSSMHANDLE pSSM, int8_t i8);
670VMMR3DECL(int) SSMR3PutU16(PSSMHANDLE pSSM, uint16_t u16);
671VMMR3DECL(int) SSMR3PutS16(PSSMHANDLE pSSM, int16_t i16);
672VMMR3DECL(int) SSMR3PutU32(PSSMHANDLE pSSM, uint32_t u32);
673VMMR3DECL(int) SSMR3PutS32(PSSMHANDLE pSSM, int32_t i32);
674VMMR3DECL(int) SSMR3PutU64(PSSMHANDLE pSSM, uint64_t u64);
675VMMR3DECL(int) SSMR3PutS64(PSSMHANDLE pSSM, int64_t i64);
676VMMR3DECL(int) SSMR3PutU128(PSSMHANDLE pSSM, uint128_t u128);
677VMMR3DECL(int) SSMR3PutS128(PSSMHANDLE pSSM, int128_t i128);
678VMMR3DECL(int) SSMR3PutUInt(PSSMHANDLE pSSM, RTUINT u);
679VMMR3DECL(int) SSMR3PutSInt(PSSMHANDLE pSSM, RTINT i);
680VMMR3DECL(int) SSMR3PutGCUInt(PSSMHANDLE pSSM, RTGCUINT u);
681VMMR3DECL(int) SSMR3PutGCUIntReg(PSSMHANDLE pSSM, RTGCUINTREG u);
682VMMR3DECL(int) SSMR3PutGCPhys32(PSSMHANDLE pSSM, RTGCPHYS32 GCPhys);
683VMMR3DECL(int) SSMR3PutGCPhys64(PSSMHANDLE pSSM, RTGCPHYS64 GCPhys);
684VMMR3DECL(int) SSMR3PutGCPhys(PSSMHANDLE pSSM, RTGCPHYS GCPhys);
685VMMR3DECL(int) SSMR3PutGCPtr(PSSMHANDLE pSSM, RTGCPTR GCPtr);
686VMMR3DECL(int) SSMR3PutGCUIntPtr(PSSMHANDLE pSSM, RTGCUINTPTR GCPtr);
687VMMR3DECL(int) SSMR3PutRCPtr(PSSMHANDLE pSSM, RTRCPTR RCPtr);
688VMMR3DECL(int) SSMR3PutIOPort(PSSMHANDLE pSSM, RTIOPORT IOPort);
689VMMR3DECL(int) SSMR3PutSel(PSSMHANDLE pSSM, RTSEL Sel);
690VMMR3DECL(int) SSMR3PutMem(PSSMHANDLE pSSM, const void *pv, size_t cb);
691VMMR3DECL(int) SSMR3PutStrZ(PSSMHANDLE pSSM, const char *psz);
692/** @} */
693
694
695
696/** Load operations.
697 * @{
698 */
699VMMR3DECL(int) SSMR3GetStruct(PSSMHANDLE pSSM, void *pvStruct, PCSSMFIELD paFields);
700VMMR3DECL(int) SSMR3GetBool(PSSMHANDLE pSSM, bool *pfBool);
701VMMR3DECL(int) SSMR3GetU8(PSSMHANDLE pSSM, uint8_t *pu8);
702VMMR3DECL(int) SSMR3GetS8(PSSMHANDLE pSSM, int8_t *pi8);
703VMMR3DECL(int) SSMR3GetU16(PSSMHANDLE pSSM, uint16_t *pu16);
704VMMR3DECL(int) SSMR3GetS16(PSSMHANDLE pSSM, int16_t *pi16);
705VMMR3DECL(int) SSMR3GetU32(PSSMHANDLE pSSM, uint32_t *pu32);
706VMMR3DECL(int) SSMR3GetS32(PSSMHANDLE pSSM, int32_t *pi32);
707VMMR3DECL(int) SSMR3GetU64(PSSMHANDLE pSSM, uint64_t *pu64);
708VMMR3DECL(int) SSMR3GetS64(PSSMHANDLE pSSM, int64_t *pi64);
709VMMR3DECL(int) SSMR3GetU128(PSSMHANDLE pSSM, uint128_t *pu128);
710VMMR3DECL(int) SSMR3GetS128(PSSMHANDLE pSSM, int128_t *pi128);
711VMMR3DECL(int) SSMR3GetUInt(PSSMHANDLE pSSM, PRTUINT pu);
712VMMR3DECL(int) SSMR3GetSInt(PSSMHANDLE pSSM, PRTINT pi);
713VMMR3DECL(int) SSMR3GetGCUInt(PSSMHANDLE pSSM, PRTGCUINT pu);
714VMMR3DECL(int) SSMR3GetGCUIntReg(PSSMHANDLE pSSM, PRTGCUINTREG pu);
715VMMR3DECL(int) SSMR3GetGCPhys32(PSSMHANDLE pSSM, PRTGCPHYS32 pGCPhys);
716VMMR3DECL(int) SSMR3GetGCPhys64(PSSMHANDLE pSSM, PRTGCPHYS64 pGCPhys);
717VMMR3DECL(int) SSMR3GetGCPhys(PSSMHANDLE pSSM, PRTGCPHYS pGCPhys);
718VMMR3DECL(int) SSMR3GetGCPtr(PSSMHANDLE pSSM, PRTGCPTR pGCPtr);
719VMMR3DECL(int) SSMR3GetGCUIntPtr(PSSMHANDLE pSSM, PRTGCUINTPTR pGCPtr);
720VMMR3DECL(int) SSMR3GetRCPtr(PSSMHANDLE pSSM, PRTRCPTR pRCPtr);
721VMMR3DECL(int) SSMR3GetIOPort(PSSMHANDLE pSSM, PRTIOPORT pIOPort);
722VMMR3DECL(int) SSMR3GetSel(PSSMHANDLE pSSM, PRTSEL pSel);
723VMMR3DECL(int) SSMR3GetMem(PSSMHANDLE pSSM, void *pv, size_t cb);
724VMMR3DECL(int) SSMR3GetStrZ(PSSMHANDLE pSSM, char *psz, size_t cbMax);
725VMMR3DECL(int) SSMR3GetStrZEx(PSSMHANDLE pSSM, char *psz, size_t cbMax, size_t *pcbStr);
726VMMR3DECL(int) SSMR3GetTimer(PSSMHANDLE pSSM, PTMTIMER pTimer);
727VMMR3DECL(int) SSMR3Skip(PSSMHANDLE pSSM, size_t cb);
728VMMR3DECL(int) SSMR3SkipToEndOfUnit(PSSMHANDLE pSSM);
729
730/** @} */
731
732/** @} */
733#endif /* IN_RING3 */
734
735
736/** @} */
737
738RT_C_DECLS_END
739
740#endif
741
Note: See TracBrowser for help on using the repository browser.

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