VirtualBox

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

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

ssm changes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 26.5 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 phase. */
63#define SSM_PHASE_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 uPhase The phase.
157 * @thread Any.
158 */
159typedef DECLCALLBACK(int) FNSSMDEVLIVEEXEC(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPhase);
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 true if done, false if there is more that needs to be saved first.
170 * @param pDevIns Device instance of the device which registered the data unit.
171 * @param pSSM SSM operation handle.
172 * @thread Any.
173 */
174typedef DECLCALLBACK(int) FNSSMDEVLIVEVOTE(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
175/** Pointer to a FNSSMDEVLIVEVOTE() function. */
176typedef FNSSMDEVLIVEVOTE *PFNSSMDEVLIVEVOTE;
177
178/**
179 * Prepare state save operation.
180 *
181 * @returns VBox status code.
182 * @param pDevIns Device instance of the device which registered the data unit.
183 * @param pSSM SSM operation handle.
184 */
185typedef DECLCALLBACK(int) FNSSMDEVSAVEPREP(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
186/** Pointer to a FNSSMDEVSAVEPREP() function. */
187typedef FNSSMDEVSAVEPREP *PFNSSMDEVSAVEPREP;
188
189/**
190 * Execute state save operation.
191 *
192 * @returns VBox status code.
193 * @param pDevIns Device instance of the device which registered the data unit.
194 * @param pSSM SSM operation handle.
195 */
196typedef DECLCALLBACK(int) FNSSMDEVSAVEEXEC(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
197/** Pointer to a FNSSMDEVSAVEEXEC() function. */
198typedef FNSSMDEVSAVEEXEC *PFNSSMDEVSAVEEXEC;
199
200/**
201 * Done state save operation.
202 *
203 * @returns VBox status code.
204 * @param pDevIns Device instance of the device which registered the data unit.
205 * @param pSSM SSM operation handle.
206 */
207typedef DECLCALLBACK(int) FNSSMDEVSAVEDONE(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
208/** Pointer to a FNSSMDEVSAVEDONE() function. */
209typedef FNSSMDEVSAVEDONE *PFNSSMDEVSAVEDONE;
210
211/**
212 * Prepare state load operation.
213 *
214 * @returns VBox status code.
215 * @param pDevIns Device instance of the device which registered the data unit.
216 * @param pSSM SSM operation handle.
217 */
218typedef DECLCALLBACK(int) FNSSMDEVLOADPREP(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
219/** Pointer to a FNSSMDEVLOADPREP() function. */
220typedef FNSSMDEVLOADPREP *PFNSSMDEVLOADPREP;
221
222/**
223 * Execute state load operation.
224 *
225 * @returns VBox status code.
226 * @param pDevIns Device instance of the device which registered the data unit.
227 * @param pSSM SSM operation handle.
228 * @param uVersion Data layout version.
229 * @param uPhase The phase. This is always SSM_PHASE_FINAL for units
230 * that doesn't specify a pfnSaveLive callback.
231 */
232typedef DECLCALLBACK(int) FNSSMDEVLOADEXEC(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
233/** Pointer to a FNSSMDEVLOADEXEC() function. */
234typedef FNSSMDEVLOADEXEC *PFNSSMDEVLOADEXEC;
235
236/**
237 * Done state load operation.
238 *
239 * @returns VBox load code.
240 * @param pDevIns Device instance of the device which registered the data unit.
241 * @param pSSM SSM operation handle.
242 */
243typedef DECLCALLBACK(int) FNSSMDEVLOADDONE(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
244/** Pointer to a FNSSMDEVLOADDONE() function. */
245typedef FNSSMDEVLOADDONE *PFNSSMDEVLOADDONE;
246
247/** @} */
248
249
250/** The PDM Driver callback variants.
251 * @{
252 */
253
254/**
255 * Prepare state live save operation.
256 *
257 * @returns VBox status code.
258 * @param pDrvIns Driver instance of the device which registered the
259 * data unit.
260 * @param pSSM SSM operation handle.
261 * @thread Any.
262 */
263typedef DECLCALLBACK(int) FNSSMDRVLIVEPREP(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
264/** Pointer to a FNSSMDRVLIVEPREP() function. */
265typedef FNSSMDRVLIVEPREP *PFNSSMDRVLIVEPREP;
266
267/**
268 * Execute state live save operation.
269 *
270 * This will be called repeatedly until all units vote that the live phase has
271 * been concluded.
272 *
273 * @returns VBox status code.
274 * @param pDrvIns Driver instance of the device which registered the
275 * data unit.
276 * @param pSSM SSM operation handle.
277 * @param uPhase The phase.
278 * @thread Any.
279 */
280typedef DECLCALLBACK(int) FNSSMDRVLIVEEXEC(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uPhase);
281/** Pointer to a FNSSMDRVLIVEEXEC() function. */
282typedef FNSSMDRVLIVEEXEC *PFNSSMDRVLIVEEXEC;
283
284/**
285 * Vote on whether the live part of the saving has been concluded.
286 *
287 * The vote stops once a unit has vetoed the decision, so don't rely upon this
288 * being called every time.
289 *
290 * @returns true if done, false if there is more that needs to be saved first.
291 * @param pDrvIns Driver instance of the device which registered the
292 * data unit.
293 * @param pSSM SSM operation handle.
294 * @thread Any.
295 */
296typedef DECLCALLBACK(int) FNSSMDRVLIVEVOTE(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
297/** Pointer to a FNSSMDRVLIVEVOTE() function. */
298typedef FNSSMDRVLIVEVOTE *PFNSSMDRVLIVEVOTE;
299
300
301/**
302 * Prepare state save operation.
303 *
304 * @returns VBox status code.
305 * @param pDrvIns Driver instance of the driver which registered the data unit.
306 * @param pSSM SSM operation handle.
307 */
308typedef DECLCALLBACK(int) FNSSMDRVSAVEPREP(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
309/** Pointer to a FNSSMDRVSAVEPREP() function. */
310typedef FNSSMDRVSAVEPREP *PFNSSMDRVSAVEPREP;
311
312/**
313 * Execute state save operation.
314 *
315 * @returns VBox status code.
316 * @param pDrvIns Driver instance of the driver which registered the data unit.
317 * @param pSSM SSM operation handle.
318 */
319typedef DECLCALLBACK(int) FNSSMDRVSAVEEXEC(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
320/** Pointer to a FNSSMDRVSAVEEXEC() function. */
321typedef FNSSMDRVSAVEEXEC *PFNSSMDRVSAVEEXEC;
322
323/**
324 * Done state save operation.
325 *
326 * @returns VBox status code.
327 * @param pDrvIns Driver instance of the driver which registered the data unit.
328 * @param pSSM SSM operation handle.
329 */
330typedef DECLCALLBACK(int) FNSSMDRVSAVEDONE(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
331/** Pointer to a FNSSMDRVSAVEDONE() function. */
332typedef FNSSMDRVSAVEDONE *PFNSSMDRVSAVEDONE;
333
334/**
335 * Prepare state load operation.
336 *
337 * @returns VBox status code.
338 * @param pDrvIns Driver instance of the driver which registered the data unit.
339 * @param pSSM SSM operation handle.
340 */
341typedef DECLCALLBACK(int) FNSSMDRVLOADPREP(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
342/** Pointer to a FNSSMDRVLOADPREP() function. */
343typedef FNSSMDRVLOADPREP *PFNSSMDRVLOADPREP;
344
345/**
346 * Execute state load operation.
347 *
348 * @returns VBox status code.
349 * @param pDrvIns Driver instance of the driver which registered the data unit.
350 * @param pSSM SSM operation handle.
351 * @param uVersion Data layout version.
352 * @param uPhase The phase. This is always SSM_PHASE_FINAL for units
353 * that doesn't specify a pfnSaveLive callback.
354 */
355typedef DECLCALLBACK(int) FNSSMDRVLOADEXEC(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
356/** Pointer to a FNSSMDRVLOADEXEC() function. */
357typedef FNSSMDRVLOADEXEC *PFNSSMDRVLOADEXEC;
358
359/**
360 * Done state load operation.
361 *
362 * @returns VBox load code.
363 * @param pDrvIns Driver instance of the driver which registered the data unit.
364 * @param pSSM SSM operation handle.
365 */
366typedef DECLCALLBACK(int) FNSSMDRVLOADDONE(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
367/** Pointer to a FNSSMDRVLOADDONE() function. */
368typedef FNSSMDRVLOADDONE *PFNSSMDRVLOADDONE;
369
370/** @} */
371
372
373/** The internal callback variants.
374 * @{
375 */
376
377
378/**
379 * Prepare state live save operation.
380 *
381 * @returns VBox status code.
382 * @param pVM VM Handle.
383 * @param pSSM SSM operation handle.
384 * @thread Any.
385 */
386typedef DECLCALLBACK(int) FNSSMINTLIVEPREP(PVM pVM, PSSMHANDLE pSSM);
387/** Pointer to a FNSSMINTLIVEPREP() function. */
388typedef FNSSMINTLIVEPREP *PFNSSMINTLIVEPREP;
389
390/**
391 * Execute state live save operation.
392 *
393 * This will be called repeatedly until all units vote that the live phase has
394 * been concluded.
395 *
396 * @returns VBox status code.
397 * @param pVM VM Handle.
398 * @param pSSM SSM operation handle.
399 * @param uPhase The phase.
400 * @thread Any.
401 */
402typedef DECLCALLBACK(int) FNSSMINTLIVEEXEC(PVM pVM, PSSMHANDLE pSSM, uint32_t uPhase);
403/** Pointer to a FNSSMINTLIVEEXEC() function. */
404typedef FNSSMINTLIVEEXEC *PFNSSMINTLIVEEXEC;
405
406/**
407 * Vote on whether the live part of the saving has been concluded.
408 *
409 * The vote stops once a unit has vetoed the decision, so don't rely upon this
410 * being called every time.
411 *
412 * @returns true if done, false if there is more that needs to be saved first.
413 * @param pVM VM Handle.
414 * @param pSSM SSM operation handle.
415 * @thread Any.
416 */
417typedef DECLCALLBACK(bool) FNSSMINTLIVEVOTE(PVM pVM, PSSMHANDLE pSSM);
418/** Pointer to a FNSSMINTLIVEVOTE() function. */
419typedef FNSSMINTLIVEVOTE *PFNSSMINTLIVEVOTE;
420
421/**
422 * Prepare state save operation.
423 *
424 * @returns VBox status code.
425 * @param pVM VM Handle.
426 * @param pSSM SSM operation handle.
427 */
428typedef DECLCALLBACK(int) FNSSMINTSAVEPREP(PVM pVM, PSSMHANDLE pSSM);
429/** Pointer to a FNSSMINTSAVEPREP() function. */
430typedef FNSSMINTSAVEPREP *PFNSSMINTSAVEPREP;
431
432/**
433 * Execute state save operation.
434 *
435 * @returns VBox status code.
436 * @param pVM VM Handle.
437 * @param pSSM SSM operation handle.
438 */
439typedef DECLCALLBACK(int) FNSSMINTSAVEEXEC(PVM pVM, PSSMHANDLE pSSM);
440/** Pointer to a FNSSMINTSAVEEXEC() function. */
441typedef FNSSMINTSAVEEXEC *PFNSSMINTSAVEEXEC;
442
443/**
444 * Done state save operation.
445 *
446 * @returns VBox status code.
447 * @param pVM VM Handle.
448 * @param pSSM SSM operation handle.
449 */
450typedef DECLCALLBACK(int) FNSSMINTSAVEDONE(PVM pVM, PSSMHANDLE pSSM);
451/** Pointer to a FNSSMINTSAVEDONE() function. */
452typedef FNSSMINTSAVEDONE *PFNSSMINTSAVEDONE;
453
454/**
455 * Prepare state load operation.
456 *
457 * @returns VBox status code.
458 * @param pVM VM Handle.
459 * @param pSSM SSM operation handle.
460 */
461typedef DECLCALLBACK(int) FNSSMINTLOADPREP(PVM pVM, PSSMHANDLE pSSM);
462/** Pointer to a FNSSMINTLOADPREP() function. */
463typedef FNSSMINTLOADPREP *PFNSSMINTLOADPREP;
464
465/**
466 * Execute state load operation.
467 *
468 * @returns VBox status code.
469 * @param pVM VM Handle.
470 * @param pSSM SSM operation handle.
471 * @param uVersion Data layout version.
472 * @param uPhase The phase. This is always SSM_PHASE_FINAL for units
473 * that doesn't specify a pfnSaveLive callback.
474 */
475typedef DECLCALLBACK(int) FNSSMINTLOADEXEC(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase);
476/** Pointer to a FNSSMINTLOADEXEC() function. */
477typedef FNSSMINTLOADEXEC *PFNSSMINTLOADEXEC;
478
479/**
480 * Done state load operation.
481 *
482 * @returns VBox load code.
483 * @param pVM VM Handle.
484 * @param pSSM SSM operation handle.
485 */
486typedef DECLCALLBACK(int) FNSSMINTLOADDONE(PVM pVM, PSSMHANDLE pSSM);
487/** Pointer to a FNSSMINTLOADDONE() function. */
488typedef FNSSMINTLOADDONE *PFNSSMINTLOADDONE;
489
490/** @} */
491
492
493/** The External callback variants.
494 * @{
495 */
496
497/**
498 * Prepare state live save operation.
499 *
500 * @returns VBox status code.
501 * @param pSSM SSM operation handle.
502 * @param pvUser User argument.
503 * @thread Any.
504 */
505typedef DECLCALLBACK(int) FNSSMEXTLIVEPREP(PSSMHANDLE pSSM, void *pvUser);
506/** Pointer to a FNSSMEXTLIVEPREP() function. */
507typedef FNSSMEXTLIVEPREP *PFNSSMEXTLIVEPREP;
508
509/**
510 * Execute state live save operation.
511 *
512 * This will be called repeatedly until all units vote that the live phase has
513 * been concluded.
514 *
515 * @returns VBox status code.
516 * @param pSSM SSM operation handle.
517 * @param pvUser User argument.
518 * @param uPhase The phase.
519 * @thread Any.
520 */
521typedef DECLCALLBACK(int) FNSSMEXTLIVEEXEC(PSSMHANDLE pSSM, void *pvUser, uint32_t uPhase);
522/** Pointer to a FNSSMEXTLIVEEXEC() function. */
523typedef FNSSMEXTLIVEEXEC *PFNSSMEXTLIVEEXEC;
524
525/**
526 * Vote on whether the live part of the saving has been concluded.
527 *
528 * The vote stops once a unit has vetoed the decision, so don't rely upon this
529 * being called every time.
530 *
531 * @returns true if done, false if there is more that needs to be saved first.
532 * @param pSSM SSM operation handle.
533 * @param pvUser User argument.
534 * @thread Any.
535 */
536typedef DECLCALLBACK(int) FNSSMEXTLIVEVOTE(PSSMHANDLE pSSM, void *pvUser);
537/** Pointer to a FNSSMEXTLIVEVOTE() function. */
538typedef FNSSMEXTLIVEVOTE *PFNSSMEXTLIVEVOTE;
539
540/**
541 * Prepare state save operation.
542 *
543 * @returns VBox status code.
544 * @param pSSM SSM operation handle.
545 * @param pvUser User argument.
546 */
547typedef DECLCALLBACK(int) FNSSMEXTSAVEPREP(PSSMHANDLE pSSM, void *pvUser);
548/** Pointer to a FNSSMEXTSAVEPREP() function. */
549typedef FNSSMEXTSAVEPREP *PFNSSMEXTSAVEPREP;
550
551/**
552 * Execute state save operation.
553 *
554 * @param pSSM SSM operation handle.
555 * @param pvUser User argument.
556 * @author The lack of return code is for legacy reasons.
557 */
558typedef DECLCALLBACK(void) FNSSMEXTSAVEEXEC(PSSMHANDLE pSSM, void *pvUser);
559/** Pointer to a FNSSMEXTSAVEEXEC() function. */
560typedef FNSSMEXTSAVEEXEC *PFNSSMEXTSAVEEXEC;
561
562/**
563 * Done state save operation.
564 *
565 * @returns VBox status code.
566 * @param pSSM SSM operation handle.
567 * @param pvUser User argument.
568 */
569typedef DECLCALLBACK(int) FNSSMEXTSAVEDONE(PSSMHANDLE pSSM, void *pvUser);
570/** Pointer to a FNSSMEXTSAVEDONE() function. */
571typedef FNSSMEXTSAVEDONE *PFNSSMEXTSAVEDONE;
572
573/**
574 * Prepare state load operation.
575 *
576 * @returns VBox status code.
577 * @param pSSM SSM operation handle.
578 * @param pvUser User argument.
579 */
580typedef DECLCALLBACK(int) FNSSMEXTLOADPREP(PSSMHANDLE pSSM, void *pvUser);
581/** Pointer to a FNSSMEXTLOADPREP() function. */
582typedef FNSSMEXTLOADPREP *PFNSSMEXTLOADPREP;
583
584/**
585 * Execute state load operation.
586 *
587 * @returns VBox status code.
588 * @param pSSM SSM operation handle.
589 * @param pvUser User argument.
590 * @param uVersion Data layout version.
591 * @param uPhase The phase. This is always SSM_PHASE_FINAL for units
592 * that doesn't specify a pfnSaveLive callback.
593 * @remark The odd return value is for legacy reasons.
594 */
595typedef DECLCALLBACK(int) FNSSMEXTLOADEXEC(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPhase);
596/** Pointer to a FNSSMEXTLOADEXEC() function. */
597typedef FNSSMEXTLOADEXEC *PFNSSMEXTLOADEXEC;
598
599/**
600 * Done state load operation.
601 *
602 * @returns VBox load code.
603 * @param pSSM SSM operation handle.
604 * @param pvUser User argument.
605 */
606typedef DECLCALLBACK(int) FNSSMEXTLOADDONE(PSSMHANDLE pSSM, void *pvUser);
607/** Pointer to a FNSSMEXTLOADDONE() function. */
608typedef FNSSMEXTLOADDONE *PFNSSMEXTLOADDONE;
609
610/** @} */
611
612
613VMMR3DECL(int) SSMR3RegisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess, const char *pszBefore,
614 PFNSSMDEVLIVEPREP pfnLivePrep, PFNSSMDEVLIVEEXEC pfnLiveExec, PFNSSMDEVLIVEVOTE pfnLiveVote,
615 PFNSSMDEVSAVEPREP pfnSavePrep, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVSAVEDONE pfnSaveDone,
616 PFNSSMDEVLOADPREP pfnLoadPrep, PFNSSMDEVLOADEXEC pfnLoadExec, PFNSSMDEVLOADDONE pfnLoadDone);
617VMMR3DECL(int) SSMR3RegisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
618 PFNSSMDRVLIVEPREP pfnLivePrep, PFNSSMDRVLIVEEXEC pfnLiveExec, PFNSSMDRVLIVEVOTE pfnLiveVote,
619 PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone,
620 PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone);
621VMMR3DECL(int) SSMR3RegisterInternal(PVM pVM, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
622 PFNSSMINTLIVEPREP pfnLivePrep, PFNSSMINTLIVEEXEC pfnLiveExec, PFNSSMINTLIVEVOTE pfnLiveVote,
623 PFNSSMINTSAVEPREP pfnSavePrep, PFNSSMINTSAVEEXEC pfnSaveExec, PFNSSMINTSAVEDONE pfnSaveDone,
624 PFNSSMINTLOADPREP pfnLoadPrep, PFNSSMINTLOADEXEC pfnLoadExec, PFNSSMINTLOADDONE pfnLoadDone);
625VMMR3DECL(int) SSMR3RegisterExternal(PVM pVM, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
626 PFNSSMEXTLIVEPREP pfnLivePrep, PFNSSMEXTLIVEEXEC pfnLiveExec, PFNSSMEXTLIVEVOTE pfnLiveVote,
627 PFNSSMEXTSAVEPREP pfnSavePrep, PFNSSMEXTSAVEEXEC pfnSaveExec, PFNSSMEXTSAVEDONE pfnSaveDone,
628 PFNSSMEXTLOADPREP pfnLoadPrep, PFNSSMEXTLOADEXEC pfnLoadExec, PFNSSMEXTLOADDONE pfnLoadDone, void *pvUser);
629VMMR3DECL(int) SSMR3DeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t uInstance);
630VMMR3DECL(int) SSMR3DeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t uInstance);
631VMMR3DECL(int) SSMR3DeregisterInternal(PVM pVM, const char *pszName);
632VMMR3DECL(int) SSMR3DeregisterExternal(PVM pVM, const char *pszName);
633VMMR3DECL(int) SSMR3Save(PVM pVM, const char *pszFilename, SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvUser);
634VMMR3DECL(int) SSMR3Load(PVM pVM, const char *pszFilename, SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvUser);
635VMMR3DECL(int) SSMR3ValidateFile(const char *pszFilename, bool fChecksumIt);
636VMMR3DECL(int) SSMR3Open(const char *pszFilename, unsigned fFlags, PSSMHANDLE *ppSSM);
637VMMR3DECL(int) SSMR3Close(PSSMHANDLE pSSM);
638VMMR3DECL(int) SSMR3Seek(PSSMHANDLE pSSM, const char *pszUnit, uint32_t iInstance, uint32_t *piVersion);
639VMMR3DECL(int) SSMR3HandleGetStatus(PSSMHANDLE pSSM);
640VMMR3DECL(int) SSMR3HandleSetStatus(PSSMHANDLE pSSM, int iStatus);
641VMMR3DECL(SSMAFTER) SSMR3HandleGetAfter(PSSMHANDLE pSSM);
642VMMR3DECL(uint64_t) SSMR3HandleGetUnitOffset(PSSMHANDLE pSSM);
643VMMR3DECL(int) SSMR3SetGCPtrSize(PSSMHANDLE pSSM, unsigned cbGCPtr);
644
645
646/** Save operations.
647 * @{
648 */
649VMMR3DECL(int) SSMR3PutStruct(PSSMHANDLE pSSM, const void *pvStruct, PCSSMFIELD paFields);
650VMMR3DECL(int) SSMR3PutBool(PSSMHANDLE pSSM, bool fBool);
651VMMR3DECL(int) SSMR3PutU8(PSSMHANDLE pSSM, uint8_t u8);
652VMMR3DECL(int) SSMR3PutS8(PSSMHANDLE pSSM, int8_t i8);
653VMMR3DECL(int) SSMR3PutU16(PSSMHANDLE pSSM, uint16_t u16);
654VMMR3DECL(int) SSMR3PutS16(PSSMHANDLE pSSM, int16_t i16);
655VMMR3DECL(int) SSMR3PutU32(PSSMHANDLE pSSM, uint32_t u32);
656VMMR3DECL(int) SSMR3PutS32(PSSMHANDLE pSSM, int32_t i32);
657VMMR3DECL(int) SSMR3PutU64(PSSMHANDLE pSSM, uint64_t u64);
658VMMR3DECL(int) SSMR3PutS64(PSSMHANDLE pSSM, int64_t i64);
659VMMR3DECL(int) SSMR3PutU128(PSSMHANDLE pSSM, uint128_t u128);
660VMMR3DECL(int) SSMR3PutS128(PSSMHANDLE pSSM, int128_t i128);
661VMMR3DECL(int) SSMR3PutUInt(PSSMHANDLE pSSM, RTUINT u);
662VMMR3DECL(int) SSMR3PutSInt(PSSMHANDLE pSSM, RTINT i);
663VMMR3DECL(int) SSMR3PutGCUInt(PSSMHANDLE pSSM, RTGCUINT u);
664VMMR3DECL(int) SSMR3PutGCUIntReg(PSSMHANDLE pSSM, RTGCUINTREG u);
665VMMR3DECL(int) SSMR3PutGCPhys32(PSSMHANDLE pSSM, RTGCPHYS32 GCPhys);
666VMMR3DECL(int) SSMR3PutGCPhys64(PSSMHANDLE pSSM, RTGCPHYS64 GCPhys);
667VMMR3DECL(int) SSMR3PutGCPhys(PSSMHANDLE pSSM, RTGCPHYS GCPhys);
668VMMR3DECL(int) SSMR3PutGCPtr(PSSMHANDLE pSSM, RTGCPTR GCPtr);
669VMMR3DECL(int) SSMR3PutGCUIntPtr(PSSMHANDLE pSSM, RTGCUINTPTR GCPtr);
670VMMR3DECL(int) SSMR3PutRCPtr(PSSMHANDLE pSSM, RTRCPTR RCPtr);
671VMMR3DECL(int) SSMR3PutIOPort(PSSMHANDLE pSSM, RTIOPORT IOPort);
672VMMR3DECL(int) SSMR3PutSel(PSSMHANDLE pSSM, RTSEL Sel);
673VMMR3DECL(int) SSMR3PutMem(PSSMHANDLE pSSM, const void *pv, size_t cb);
674VMMR3DECL(int) SSMR3PutStrZ(PSSMHANDLE pSSM, const char *psz);
675/** @} */
676
677
678
679/** Load operations.
680 * @{
681 */
682VMMR3DECL(int) SSMR3GetStruct(PSSMHANDLE pSSM, void *pvStruct, PCSSMFIELD paFields);
683VMMR3DECL(int) SSMR3GetBool(PSSMHANDLE pSSM, bool *pfBool);
684VMMR3DECL(int) SSMR3GetU8(PSSMHANDLE pSSM, uint8_t *pu8);
685VMMR3DECL(int) SSMR3GetS8(PSSMHANDLE pSSM, int8_t *pi8);
686VMMR3DECL(int) SSMR3GetU16(PSSMHANDLE pSSM, uint16_t *pu16);
687VMMR3DECL(int) SSMR3GetS16(PSSMHANDLE pSSM, int16_t *pi16);
688VMMR3DECL(int) SSMR3GetU32(PSSMHANDLE pSSM, uint32_t *pu32);
689VMMR3DECL(int) SSMR3GetS32(PSSMHANDLE pSSM, int32_t *pi32);
690VMMR3DECL(int) SSMR3GetU64(PSSMHANDLE pSSM, uint64_t *pu64);
691VMMR3DECL(int) SSMR3GetS64(PSSMHANDLE pSSM, int64_t *pi64);
692VMMR3DECL(int) SSMR3GetU128(PSSMHANDLE pSSM, uint128_t *pu128);
693VMMR3DECL(int) SSMR3GetS128(PSSMHANDLE pSSM, int128_t *pi128);
694VMMR3DECL(int) SSMR3GetUInt(PSSMHANDLE pSSM, PRTUINT pu);
695VMMR3DECL(int) SSMR3GetSInt(PSSMHANDLE pSSM, PRTINT pi);
696VMMR3DECL(int) SSMR3GetGCUInt(PSSMHANDLE pSSM, PRTGCUINT pu);
697VMMR3DECL(int) SSMR3GetGCUIntReg(PSSMHANDLE pSSM, PRTGCUINTREG pu);
698VMMR3DECL(int) SSMR3GetGCPhys32(PSSMHANDLE pSSM, PRTGCPHYS32 pGCPhys);
699VMMR3DECL(int) SSMR3GetGCPhys64(PSSMHANDLE pSSM, PRTGCPHYS64 pGCPhys);
700VMMR3DECL(int) SSMR3GetGCPhys(PSSMHANDLE pSSM, PRTGCPHYS pGCPhys);
701VMMR3DECL(int) SSMR3GetGCPtr(PSSMHANDLE pSSM, PRTGCPTR pGCPtr);
702VMMR3DECL(int) SSMR3GetGCUIntPtr(PSSMHANDLE pSSM, PRTGCUINTPTR pGCPtr);
703VMMR3DECL(int) SSMR3GetRCPtr(PSSMHANDLE pSSM, PRTRCPTR pRCPtr);
704VMMR3DECL(int) SSMR3GetIOPort(PSSMHANDLE pSSM, PRTIOPORT pIOPort);
705VMMR3DECL(int) SSMR3GetSel(PSSMHANDLE pSSM, PRTSEL pSel);
706VMMR3DECL(int) SSMR3GetMem(PSSMHANDLE pSSM, void *pv, size_t cb);
707VMMR3DECL(int) SSMR3GetStrZ(PSSMHANDLE pSSM, char *psz, size_t cbMax);
708VMMR3DECL(int) SSMR3GetStrZEx(PSSMHANDLE pSSM, char *psz, size_t cbMax, size_t *pcbStr);
709VMMR3DECL(int) SSMR3GetTimer(PSSMHANDLE pSSM, PTMTIMER pTimer);
710VMMR3DECL(int) SSMR3Skip(PSSMHANDLE pSSM, size_t cb);
711VMMR3DECL(int) SSMR3SkipToEndOfUnit(PSSMHANDLE pSSM);
712
713/** @} */
714
715/** @} */
716#endif /* IN_RING3 */
717
718
719/** @} */
720
721RT_C_DECLS_END
722
723#endif
724
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