VirtualBox

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

最後變更 在這個檔案從4172是 4071,由 vboxsync 提交於 18 年 前

Biggest check-in ever. New source code headers for all (C) innotek files.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 35.0 KB
 
1/** @file
2 * SSM - The Save State Manager.
3 */
4
5/*
6 * Copyright (C) 2006-2007 innotek GmbH
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.alldomusa.eu.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 as published by the Free Software Foundation,
12 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13 * distribution. VirtualBox OSE is distributed in the hope that it will
14 * be useful, but WITHOUT ANY WARRANTY of any kind.
15 */
16
17#ifndef ___VBox_ssm_h
18#define ___VBox_ssm_h
19
20#include <VBox/cdefs.h>
21#include <VBox/types.h>
22#include <VBox/tm.h>
23#include <VBox/vmapi.h>
24
25__BEGIN_DECLS
26
27/** @defgroup grp_ssm The Saved State Manager API
28 * @{
29 */
30
31#ifdef IN_RING3
32/** @defgroup grp_ssm_r3 The SSM Host Context Ring-3 API
33 * @{
34 */
35
36
37/**
38 * What to do after the save/load operation.
39 */
40typedef enum SSMAFTER
41{
42 /** Will resume the loaded state. */
43 SSMAFTER_RESUME = 1,
44 /** Will destroy the VM after saving. */
45 SSMAFTER_DESTROY,
46 /** Will continue execution after saving the VM. */
47 SSMAFTER_CONTINUE,
48 /** The file was opened using SSMR3Open() and we have no idea what the plan is. */
49 SSMAFTER_OPENED
50} SSMAFTER;
51
52
53/**
54 * A structure field description.
55 */
56typedef struct SSMFIELD
57{
58 /** Field offset into the structure. */
59 uint32_t off;
60 /** The size of the field. */
61 uint32_t cb;
62} SSMFIELD;
63/** Pointer to a structure field description. */
64typedef SSMFIELD *PSSMFIELD;
65/** Pointer to a const structure field description. */
66typedef const SSMFIELD *PCSSMFIELD;
67
68/** Emit a SSMFIELD array entry. */
69#define SSMFIELD_ENTRY(Type, Field) { RT_OFFSETOF(Type, Field), RT_SIZEOFMEMB(Type, Field) }
70/** Emit the terminating entry of a SSMFIELD array. */
71#define SSMFIELD_ENTRY_TERM() { UINT32_MAX, UINT32_MAX }
72
73
74
75/** The PDM Device callback variants.
76 * @{
77 */
78
79/**
80 * Prepare state save operation.
81 *
82 * @returns VBox status code.
83 * @param pDevIns Device instance of the device which registered the data unit.
84 * @param pSSM SSM operation handle.
85 */
86typedef DECLCALLBACK(int) FNSSMDEVSAVEPREP(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
87/** Pointer to a FNSSMDEVSAVEPREP() function. */
88typedef FNSSMDEVSAVEPREP *PFNSSMDEVSAVEPREP;
89
90/**
91 * Execute state save operation.
92 *
93 * @returns VBox status code.
94 * @param pDevIns Device instance of the device which registered the data unit.
95 * @param pSSM SSM operation handle.
96 */
97typedef DECLCALLBACK(int) FNSSMDEVSAVEEXEC(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
98/** Pointer to a FNSSMDEVSAVEEXEC() function. */
99typedef FNSSMDEVSAVEEXEC *PFNSSMDEVSAVEEXEC;
100
101/**
102 * Done state save operation.
103 *
104 * @returns VBox status code.
105 * @param pDevIns Device instance of the device which registered the data unit.
106 * @param pSSM SSM operation handle.
107 */
108typedef DECLCALLBACK(int) FNSSMDEVSAVEDONE(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
109/** Pointer to a FNSSMDEVSAVEDONE() function. */
110typedef FNSSMDEVSAVEDONE *PFNSSMDEVSAVEDONE;
111
112/**
113 * Prepare state load operation.
114 *
115 * @returns VBox status code.
116 * @param pDevIns Device instance of the device which registered the data unit.
117 * @param pSSM SSM operation handle.
118 */
119typedef DECLCALLBACK(int) FNSSMDEVLOADPREP(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
120/** Pointer to a FNSSMDEVLOADPREP() function. */
121typedef FNSSMDEVLOADPREP *PFNSSMDEVLOADPREP;
122
123/**
124 * Execute state load operation.
125 *
126 * @returns VBox status code.
127 * @param pDevIns Device instance of the device which registered the data unit.
128 * @param pSSM SSM operation handle.
129 * @param u32Version Data layout version.
130 */
131typedef DECLCALLBACK(int) FNSSMDEVLOADEXEC(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version);
132/** Pointer to a FNSSMDEVLOADEXEC() function. */
133typedef FNSSMDEVLOADEXEC *PFNSSMDEVLOADEXEC;
134
135/**
136 * Done state load operation.
137 *
138 * @returns VBox load code.
139 * @param pDevIns Device instance of the device which registered the data unit.
140 * @param pSSM SSM operation handle.
141 */
142typedef DECLCALLBACK(int) FNSSMDEVLOADDONE(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
143/** Pointer to a FNSSMDEVLOADDONE() function. */
144typedef FNSSMDEVLOADDONE *PFNSSMDEVLOADDONE;
145
146/** @} */
147
148
149/** The PDM Driver callback variants.
150 * @{
151 */
152
153/**
154 * Prepare state save operation.
155 *
156 * @returns VBox status code.
157 * @param pDrvIns Driver instance of the driver which registered the data unit.
158 * @param pSSM SSM operation handle.
159 */
160typedef DECLCALLBACK(int) FNSSMDRVSAVEPREP(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
161/** Pointer to a FNSSMDRVSAVEPREP() function. */
162typedef FNSSMDRVSAVEPREP *PFNSSMDRVSAVEPREP;
163
164/**
165 * Execute state save operation.
166 *
167 * @returns VBox status code.
168 * @param pDrvIns Driver instance of the driver which registered the data unit.
169 * @param pSSM SSM operation handle.
170 */
171typedef DECLCALLBACK(int) FNSSMDRVSAVEEXEC(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
172/** Pointer to a FNSSMDRVSAVEEXEC() function. */
173typedef FNSSMDRVSAVEEXEC *PFNSSMDRVSAVEEXEC;
174
175/**
176 * Done state save operation.
177 *
178 * @returns VBox status code.
179 * @param pDrvIns Driver instance of the driver which registered the data unit.
180 * @param pSSM SSM operation handle.
181 */
182typedef DECLCALLBACK(int) FNSSMDRVSAVEDONE(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
183/** Pointer to a FNSSMDRVSAVEDONE() function. */
184typedef FNSSMDRVSAVEDONE *PFNSSMDRVSAVEDONE;
185
186/**
187 * Prepare state load operation.
188 *
189 * @returns VBox status code.
190 * @param pDrvIns Driver instance of the driver which registered the data unit.
191 * @param pSSM SSM operation handle.
192 */
193typedef DECLCALLBACK(int) FNSSMDRVLOADPREP(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
194/** Pointer to a FNSSMDRVLOADPREP() function. */
195typedef FNSSMDRVLOADPREP *PFNSSMDRVLOADPREP;
196
197/**
198 * Execute state load operation.
199 *
200 * @returns VBox status code.
201 * @param pDrvIns Driver instance of the driver which registered the data unit.
202 * @param pSSM SSM operation handle.
203 * @param u32Version Data layout version.
204 */
205typedef DECLCALLBACK(int) FNSSMDRVLOADEXEC(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t u32Version);
206/** Pointer to a FNSSMDRVLOADEXEC() function. */
207typedef FNSSMDRVLOADEXEC *PFNSSMDRVLOADEXEC;
208
209/**
210 * Done state load operation.
211 *
212 * @returns VBox load code.
213 * @param pDrvIns Driver instance of the driver which registered the data unit.
214 * @param pSSM SSM operation handle.
215 */
216typedef DECLCALLBACK(int) FNSSMDRVLOADDONE(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
217/** Pointer to a FNSSMDRVLOADDONE() function. */
218typedef FNSSMDRVLOADDONE *PFNSSMDRVLOADDONE;
219
220/** @} */
221
222
223/** The internal callback variants.
224 * @{
225 */
226
227/**
228 * Prepare state save operation.
229 *
230 * @returns VBox status code.
231 * @param pVM VM Handle.
232 * @param pSSM SSM operation handle.
233 */
234typedef DECLCALLBACK(int) FNSSMINTSAVEPREP(PVM pVM, PSSMHANDLE pSSM);
235/** Pointer to a FNSSMINTSAVEPREP() function. */
236typedef FNSSMINTSAVEPREP *PFNSSMINTSAVEPREP;
237
238/**
239 * Execute state save operation.
240 *
241 * @returns VBox status code.
242 * @param pVM VM Handle.
243 * @param pSSM SSM operation handle.
244 */
245typedef DECLCALLBACK(int) FNSSMINTSAVEEXEC(PVM pVM, PSSMHANDLE pSSM);
246/** Pointer to a FNSSMINTSAVEEXEC() function. */
247typedef FNSSMINTSAVEEXEC *PFNSSMINTSAVEEXEC;
248
249/**
250 * Done state save operation.
251 *
252 * @returns VBox status code.
253 * @param pVM VM Handle.
254 * @param pSSM SSM operation handle.
255 */
256typedef DECLCALLBACK(int) FNSSMINTSAVEDONE(PVM pVM, PSSMHANDLE pSSM);
257/** Pointer to a FNSSMINTSAVEDONE() function. */
258typedef FNSSMINTSAVEDONE *PFNSSMINTSAVEDONE;
259
260/**
261 * Prepare state load operation.
262 *
263 * @returns VBox status code.
264 * @param pVM VM Handle.
265 * @param pSSM SSM operation handle.
266 */
267typedef DECLCALLBACK(int) FNSSMINTLOADPREP(PVM pVM, PSSMHANDLE pSSM);
268/** Pointer to a FNSSMINTLOADPREP() function. */
269typedef FNSSMINTLOADPREP *PFNSSMINTLOADPREP;
270
271/**
272 * Execute state load operation.
273 *
274 * @returns VBox status code.
275 * @param pVM VM Handle.
276 * @param pSSM SSM operation handle.
277 * @param u32Version Data layout version.
278 */
279typedef DECLCALLBACK(int) FNSSMINTLOADEXEC(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
280/** Pointer to a FNSSMINTLOADEXEC() function. */
281typedef FNSSMINTLOADEXEC *PFNSSMINTLOADEXEC;
282
283/**
284 * Done state load operation.
285 *
286 * @returns VBox load code.
287 * @param pVM VM Handle.
288 * @param pSSM SSM operation handle.
289 */
290typedef DECLCALLBACK(int) FNSSMINTLOADDONE(PVM pVM, PSSMHANDLE pSSM);
291/** Pointer to a FNSSMINTLOADDONE() function. */
292typedef FNSSMINTLOADDONE *PFNSSMINTLOADDONE;
293
294/** @} */
295
296
297/** The External callback variants.
298 * @{
299 */
300
301/**
302 * Prepare state save operation.
303 *
304 * @returns VBox status code.
305 * @param pSSM SSM operation handle.
306 * @param pvUser User argument.
307 */
308typedef DECLCALLBACK(int) FNSSMEXTSAVEPREP(PSSMHANDLE pSSM, void *pvUser);
309/** Pointer to a FNSSMEXTSAVEPREP() function. */
310typedef FNSSMEXTSAVEPREP *PFNSSMEXTSAVEPREP;
311
312/**
313 * Execute state save operation.
314 *
315 * @param pSSM SSM operation handle.
316 * @param pvUser User argument.
317 * @author The lack of return code is for legacy reasons.
318 */
319typedef DECLCALLBACK(void) FNSSMEXTSAVEEXEC(PSSMHANDLE pSSM, void *pvUser);
320/** Pointer to a FNSSMEXTSAVEEXEC() function. */
321typedef FNSSMEXTSAVEEXEC *PFNSSMEXTSAVEEXEC;
322
323/**
324 * Done state save operation.
325 *
326 * @returns VBox status code.
327 * @param pSSM SSM operation handle.
328 * @param pvUser User argument.
329 */
330typedef DECLCALLBACK(int) FNSSMEXTSAVEDONE(PSSMHANDLE pSSM, void *pvUser);
331/** Pointer to a FNSSMEXTSAVEDONE() function. */
332typedef FNSSMEXTSAVEDONE *PFNSSMEXTSAVEDONE;
333
334/**
335 * Prepare state load operation.
336 *
337 * @returns VBox status code.
338 * @param pSSM SSM operation handle.
339 * @param pvUser User argument.
340 */
341typedef DECLCALLBACK(int) FNSSMEXTLOADPREP(PSSMHANDLE pSSM, void *pvUser);
342/** Pointer to a FNSSMEXTLOADPREP() function. */
343typedef FNSSMEXTLOADPREP *PFNSSMEXTLOADPREP;
344
345/**
346 * Execute state load operation.
347 *
348 * @returns 0 on success.
349 * @returns Not 0 on failure.
350 * @param pSSM SSM operation handle.
351 * @param pvUser User argument.
352 * @param u32Version Data layout version.
353 * @remark The odd return value is for legacy reasons.
354 */
355typedef DECLCALLBACK(int) FNSSMEXTLOADEXEC(PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version);
356/** Pointer to a FNSSMEXTLOADEXEC() function. */
357typedef FNSSMEXTLOADEXEC *PFNSSMEXTLOADEXEC;
358
359/**
360 * Done state load operation.
361 *
362 * @returns VBox load code.
363 * @param pSSM SSM operation handle.
364 * @param pvUser User argument.
365 */
366typedef DECLCALLBACK(int) FNSSMEXTLOADDONE(PSSMHANDLE pSSM, void *pvUser);
367/** Pointer to a FNSSMEXTLOADDONE() function. */
368typedef FNSSMEXTLOADDONE *PFNSSMEXTLOADDONE;
369
370/** @} */
371
372
373
374/**
375 * Register a PDM Devices data unit.
376 *
377 * @returns VBox status.
378 * @param pVM The VM handle.
379 * @param pDevIns Device instance.
380 * @param pszName Data unit name.
381 * @param u32Instance The instance identifier of the data unit.
382 * This must together with the name be unique.
383 * @param u32Version Data layout version number.
384 * @param cbGuess The approximate amount of data in the unit.
385 * Only for progress indicators.
386 * @param pfnSavePrep Prepare save callback, optional.
387 * @param pfnSaveExec Execute save callback, optional.
388 * @param pfnSaveDone Done save callback, optional.
389 * @param pfnLoadPrep Prepare load callback, optional.
390 * @param pfnLoadExec Execute load callback, optional.
391 * @param pfnLoadDone Done load callback, optional.
392 */
393SSMR3DECL(int) SSMR3Register(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
394 PFNSSMDEVSAVEPREP pfnSavePrep, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVSAVEDONE pfnSaveDone,
395 PFNSSMDEVLOADPREP pfnLoadPrep, PFNSSMDEVLOADEXEC pfnLoadExec, PFNSSMDEVLOADDONE pfnLoadDone);
396
397/**
398 * Register a PDM driver data unit.
399 *
400 * @returns VBox status.
401 * @param pVM The VM handle.
402 * @param pDrvIns Driver instance.
403 * @param pszName Data unit name.
404 * @param u32Instance The instance identifier of the data unit.
405 * This must together with the name be unique.
406 * @param u32Version Data layout version number.
407 * @param cbGuess The approximate amount of data in the unit.
408 * Only for progress indicators.
409 * @param pfnSavePrep Prepare save callback, optional.
410 * @param pfnSaveExec Execute save callback, optional.
411 * @param pfnSaveDone Done save callback, optional.
412 * @param pfnLoadPrep Prepare load callback, optional.
413 * @param pfnLoadExec Execute load callback, optional.
414 * @param pfnLoadDone Done load callback, optional.
415 */
416SSMR3DECL(int) SSMR3RegisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
417 PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone,
418 PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone);
419
420/**
421 * Register a internal data unit.
422 *
423 * @returns VBox status.
424 * @param pVM The VM handle.
425 * @param pszName Data unit name.
426 * @param u32Instance The instance identifier of the data unit.
427 * This must together with the name be unique.
428 * @param u32Version Data layout version number.
429 * @param cbGuess The approximate amount of data in the unit.
430 * Only for progress indicators.
431 * @param pfnSavePrep Prepare save callback, optional.
432 * @param pfnSaveExec Execute save callback, optional.
433 * @param pfnSaveDone Done save callback, optional.
434 * @param pfnLoadPrep Prepare load callback, optional.
435 * @param pfnLoadExec Execute load callback, optional.
436 * @param pfnLoadDone Done load callback, optional.
437 */
438SSMR3DECL(int) SSMR3RegisterInternal(PVM pVM, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
439 PFNSSMINTSAVEPREP pfnSavePrep, PFNSSMINTSAVEEXEC pfnSaveExec, PFNSSMINTSAVEDONE pfnSaveDone,
440 PFNSSMINTLOADPREP pfnLoadPrep, PFNSSMINTLOADEXEC pfnLoadExec, PFNSSMINTLOADDONE pfnLoadDone);
441
442/**
443 * Register a unit.
444 *
445 * @returns VBox status.
446 * @param pVM The VM handle.
447 * @param pszName Data unit name.
448 * @param u32Instance The instance identifier of the data unit.
449 * This must together with the name be unique.
450 * @param u32Version Data layout version number.
451 * @param cbGuess The approximate amount of data in the unit.
452 * Only for progress indicators.
453 * @param pfnSavePrep Prepare save callback, optional.
454 * @param pfnSaveExec Execute save callback, optional.
455 * @param pfnSaveDone Done save callback, optional.
456 * @param pfnLoadPrep Prepare load callback, optional.
457 * @param pfnLoadExec Execute load callback, optional.
458 * @param pfnLoadDone Done load callback, optional.
459 * @param pvUser User argument.
460 */
461SSMR3DECL(int) SSMR3RegisterExternal(PVM pVM, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
462 PFNSSMEXTSAVEPREP pfnSavePrep, PFNSSMEXTSAVEEXEC pfnSaveExec, PFNSSMEXTSAVEDONE pfnSaveDone,
463 PFNSSMEXTLOADPREP pfnLoadPrep, PFNSSMEXTLOADEXEC pfnLoadExec, PFNSSMEXTLOADDONE pfnLoadDone, void *pvUser);
464
465/**
466 * Deregister one or more PDM Device data units.
467 *
468 * @returns VBox status.
469 * @param pVM The VM handle.
470 * @param pDevIns Device instance.
471 * @param pszName Data unit name.
472 * Use NULL to deregister all data units for that device instance.
473 * @param u32Instance The instance identifier of the data unit.
474 * This must together with the name be unique. Ignored if pszName is NULL.
475 * @remark Only for dynmaic data units and dynamic unloaded modules.
476 */
477SSMR3DECL(int) SSMR3Deregister(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t u32Instance);
478
479/**
480 * Deregister one or more PDM Driver data units.
481 *
482 * @returns VBox status.
483 * @param pVM The VM handle.
484 * @param pDrvIns Driver instance.
485 * @param pszName Data unit name.
486 * Use NULL to deregister all data units for that driver instance.
487 * @param u32Instance The instance identifier of the data unit.
488 * This must together with the name be unique. Ignored if pszName is NULL.
489 * @remark Only for dynmaic data units and dynamic unloaded modules.
490 */
491SSMR3DECL(int) SSMR3DeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance);
492
493/**
494 * Deregister a internal data unit.
495 *
496 * @returns VBox status.
497 * @param pVM The VM handle.
498 * @param pszName Data unit name.
499 * @remark Only for dynmaic data units.
500 */
501SSMR3DECL(int) SSMR3DeregisterInternal(PVM pVM, const char *pszName);
502
503/**
504 * Deregister an external data unit.
505 *
506 * @returns VBox status.
507 * @param pVM The VM handle.
508 * @param pszName Data unit name.
509 * @remark Only for dynmaic data units.
510 */
511SSMR3DECL(int) SSMR3DeregisterExternal(PVM pVM, const char *pszName);
512
513/**
514 * Start VM save operation.
515 *
516 * The caller must be the emulation thread!
517 *
518 * @returns VBox status.
519 * @param pVM The VM handle.
520 * @param pszFilename Name of the file to save the state in.
521 * @param enmAfter What is planned after a successful save operation.
522 * @param pfnProgress Progress callback. Optional.
523 * @param pvUser User argument for the progress callback.
524 */
525SSMR3DECL(int) SSMR3Save(PVM pVM, const char *pszFilename, SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvUser);
526
527/**
528 * Load VM save operation.
529 *
530 * The caller must be the emulation thread!
531 *
532 * @returns VBox status.
533 * @param pVM The VM handle.
534 * @param pszFilename Name of the file to save the state in.
535 * @param enmAfter What is planned after a successful save operation.
536 * @param pfnProgress Progress callback. Optional.
537 * @param pvUser User argument for the progress callback.
538 */
539SSMR3DECL(int) SSMR3Load(PVM pVM, const char *pszFilename, SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvUser);
540
541/**
542 * Validates a file as a validate SSM saved state.
543 *
544 * This will only verify the file format, the format and content of individual
545 * data units are not inspected.
546 *
547 * @returns VINF_SUCCESS if valid.
548 * @returns VBox status code on other failures.
549 * @param pszFilename The path to the file to validate.
550 */
551SSMR3DECL(int) SSMR3ValidateFile(const char *pszFilename);
552
553/**
554 * Opens a saved state file for reading.
555 *
556 * @returns VBox status code.
557 * @param pszFilename The path to the saved state file.
558 * @param fFlags Open flags. Reserved, must be 0.
559 * @param ppSSM Where to store the SSM handle.
560 */
561SSMR3DECL(int) SSMR3Open(const char *pszFilename, unsigned fFlags, PSSMHANDLE *ppSSM);
562
563/**
564 * Closes a saved state file opened by SSMR3Open().
565 *
566 * @returns VBox status code.
567 * @param pSSM The SSM handle returned by SSMR3Open().
568 */
569SSMR3DECL(int) SSMR3Close(PSSMHANDLE pSSM);
570
571/**
572 * Seeks to a specific data unit.
573 *
574 * After seeking it's possible to use the getters to on
575 * that data unit.
576 *
577 * @returns VBox status code.
578 * @returns VERR_SSM_UNIT_NOT_FOUND if the unit+instance wasn't found.
579 * @param pSSM The SSM handle returned by SSMR3Open().
580 * @param pszUnit The name of the data unit.
581 * @param iInstance The instance number.
582 * @param piVersion Where to store the version number. (Optional)
583 */
584SSMR3DECL(int) SSMR3Seek(PSSMHANDLE pSSM, const char *pszUnit, uint32_t iInstance, uint32_t *piVersion);
585
586
587/** Save operations.
588 * @{
589 */
590
591/**
592 * Puts a structure.
593 *
594 * @returns VBox status code.
595 * @param pSSM The saved state handle.
596 * @param pvStruct The structure address.
597 * @param paFields The array of structure fields descriptions.
598 * The array must be terminated by a SSMFIELD_ENTRY_TERM().
599 */
600SSMR3DECL(int) SSMR3PutStruct(PSSMHANDLE pSSM, const void *pvStruct, PCSSMFIELD paFields);
601
602/**
603 * Saves a boolean item to the current data unit.
604 *
605 * @returns VBox status.
606 * @param pSSM SSM operation handle.
607 * @param fBool Item to save.
608 */
609SSMR3DECL(int) SSMR3PutBool(PSSMHANDLE pSSM, bool fBool);
610
611/**
612 * Saves a 8-bit unsigned integer item to the current data unit.
613 *
614 * @returns VBox status.
615 * @param pSSM SSM operation handle.
616 * @param u8 Item to save.
617 */
618SSMR3DECL(int) SSMR3PutU8(PSSMHANDLE pSSM, uint8_t u8);
619
620/**
621 * Saves a 8-bit signed integer item to the current data unit.
622 *
623 * @returns VBox status.
624 * @param pSSM SSM operation handle.
625 * @param i8 Item to save.
626 */
627SSMR3DECL(int) SSMR3PutS8(PSSMHANDLE pSSM, int8_t i8);
628
629/**
630 * Saves a 16-bit unsigned integer item to the current data unit.
631 *
632 * @returns VBox status.
633 * @param pSSM SSM operation handle.
634 * @param u16 Item to save.
635 */
636SSMR3DECL(int) SSMR3PutU16(PSSMHANDLE pSSM, uint16_t u16);
637
638/**
639 * Saves a 16-bit signed integer item to the current data unit.
640 *
641 * @returns VBox status.
642 * @param pSSM SSM operation handle.
643 * @param i16 Item to save.
644 */
645SSMR3DECL(int) SSMR3PutS16(PSSMHANDLE pSSM, int16_t i16);
646
647/**
648 * Saves a 32-bit unsigned integer item to the current data unit.
649 *
650 * @returns VBox status.
651 * @param pSSM SSM operation handle.
652 * @param u32 Item to save.
653 */
654SSMR3DECL(int) SSMR3PutU32(PSSMHANDLE pSSM, uint32_t u32);
655
656/**
657 * Saves a 32-bit signed integer item to the current data unit.
658 *
659 * @returns VBox status.
660 * @param pSSM SSM operation handle.
661 * @param i32 Item to save.
662 */
663SSMR3DECL(int) SSMR3PutS32(PSSMHANDLE pSSM, int32_t i32);
664
665/**
666 * Saves a 64-bit unsigned integer item to the current data unit.
667 *
668 * @returns VBox status.
669 * @param pSSM SSM operation handle.
670 * @param u64 Item to save.
671 */
672SSMR3DECL(int) SSMR3PutU64(PSSMHANDLE pSSM, uint64_t u64);
673
674/**
675 * Saves a 64-bit signed integer item to the current data unit.
676 *
677 * @returns VBox status.
678 * @param pSSM SSM operation handle.
679 * @param i64 Item to save.
680 */
681SSMR3DECL(int) SSMR3PutS64(PSSMHANDLE pSSM, int64_t i64);
682
683/**
684 * Saves a 128-bit unsigned integer item to the current data unit.
685 *
686 * @returns VBox status.
687 * @param pSSM SSM operation handle.
688 * @param u128 Item to save.
689 */
690SSMR3DECL(int) SSMR3PutU128(PSSMHANDLE pSSM, uint128_t u128);
691
692/**
693 * Saves a 128-bit signed integer item to the current data unit.
694 *
695 * @returns VBox status.
696 * @param pSSM SSM operation handle.
697 * @param i128 Item to save.
698 */
699SSMR3DECL(int) SSMR3PutS128(PSSMHANDLE pSSM, int128_t i128);
700
701/**
702 * Saves a VBox unsigned integer item to the current data unit.
703 *
704 * @returns VBox status.
705 * @param pSSM SSM operation handle.
706 * @param u Item to save.
707 */
708SSMR3DECL(int) SSMR3PutUInt(PSSMHANDLE pSSM, RTUINT u);
709
710/**
711 * Saves a VBox signed integer item to the current data unit.
712 *
713 * @returns VBox status.
714 * @param pSSM SSM operation handle.
715 * @param i Item to save.
716 */
717SSMR3DECL(int) SSMR3PutSInt(PSSMHANDLE pSSM, RTINT i);
718
719/**
720 * Saves a GC natural unsigned integer item to the current data unit.
721 *
722 * @returns VBox status.
723 * @param pSSM SSM operation handle.
724 * @param u Item to save.
725 */
726SSMR3DECL(int) SSMR3PutGCUInt(PSSMHANDLE pSSM, RTGCUINT u);
727
728/**
729 * Saves a GC natural signed integer item to the current data unit.
730 *
731 * @returns VBox status.
732 * @param pSSM SSM operation handle.
733 * @param i Item to save.
734 */
735SSMR3DECL(int) SSMR3PutGCSInt(PSSMHANDLE pSSM, RTGCINT i);
736
737/**
738 * Saves a GC physical address item to the current data unit.
739 *
740 * @returns VBox status.
741 * @param pSSM SSM operation handle.
742 * @param GCPhys The item to save
743 */
744SSMR3DECL(int) SSMR3PutGCPhys(PSSMHANDLE pSSM, RTGCPHYS GCPhys);
745
746/**
747 * Saves a GC virtual address item to the current data unit.
748 *
749 * @returns VBox status.
750 * @param pSSM SSM operation handle.
751 * @param GCPtr The item to save.
752 */
753SSMR3DECL(int) SSMR3PutGCPtr(PSSMHANDLE pSSM, RTGCPTR GCPtr);
754
755/**
756 * Saves a GC virtual address (represented as an unsigned integer) item to the current data unit.
757 *
758 * @returns VBox status.
759 * @param pSSM SSM operation handle.
760 * @param GCPtr The item to save.
761 */
762SSMR3DECL(int) SSMR3PutGCUIntPtr(PSSMHANDLE pSSM, RTGCUINTPTR GCPtr);
763
764/**
765 * Saves a HC natural unsigned integer item to the current data unit.
766 *
767 * @returns VBox status.
768 * @param pSSM SSM operation handle.
769 * @param u Item to save.
770 */
771SSMR3DECL(int) SSMR3PutHCUInt(PSSMHANDLE pSSM, RTHCUINT u);
772
773/**
774 * Saves a HC natural signed integer item to the current data unit.
775 *
776 * @returns VBox status.
777 * @param pSSM SSM operation handle.
778 * @param i Item to save.
779 */
780SSMR3DECL(int) SSMR3PutHCSInt(PSSMHANDLE pSSM, RTHCINT i);
781
782/**
783 * Saves a I/O port address item to the current data unit.
784 *
785 * @returns VBox status.
786 * @param pSSM SSM operation handle.
787 * @param IOPort The item to save.
788 */
789SSMR3DECL(int) SSMR3PutIOPort(PSSMHANDLE pSSM, RTIOPORT IOPort);
790
791/**
792 * Saves a selector item to the current data unit.
793 *
794 * @returns VBox status.
795 * @param pSSM SSM operation handle.
796 * @param Sel The item to save.
797 */
798SSMR3DECL(int) SSMR3PutSel(PSSMHANDLE pSSM, RTSEL Sel);
799
800/**
801 * Saves a memory item to the current data unit.
802 *
803 * @returns VBox status.
804 * @param pSSM SSM operation handle.
805 * @param pv Item to save.
806 * @param cb Size of the item.
807 */
808SSMR3DECL(int) SSMR3PutMem(PSSMHANDLE pSSM, const void *pv, size_t cb);
809
810/**
811 * Saves a zero terminated string item to the current data unit.
812 *
813 * @returns VBox status.
814 * @param pSSM SSM operation handle.
815 * @param psz Item to save.
816 */
817SSMR3DECL(int) SSMR3PutStrZ(PSSMHANDLE pSSM, const char *psz);
818
819/** @} */
820
821
822
823/** Load operations.
824 * @{
825 */
826
827/**
828 * Gets a structure.
829 *
830 * @returns VBox status code.
831 * @param pSSM The saved state handle.
832 * @param pvStruct The structure address.
833 * @param paFields The array of structure fields descriptions.
834 * The array must be terminated by a SSMFIELD_ENTRY_TERM().
835 */
836SSMR3DECL(int) SSMR3GetStruct(PSSMHANDLE pSSM, void *pvStruct, PCSSMFIELD paFields);
837
838/**
839 * Loads a boolean item from the current data unit.
840 *
841 * @returns VBox status.
842 * @param pSSM SSM operation handle.
843 * @param pfBool Where to store the item.
844 */
845SSMR3DECL(int) SSMR3GetBool(PSSMHANDLE pSSM, bool *pfBool);
846
847/**
848 * Loads a 8-bit unsigned integer item from the current data unit.
849 *
850 * @returns VBox status.
851 * @param pSSM SSM operation handle.
852 * @param pu8 Where to store the item.
853 */
854SSMR3DECL(int) SSMR3GetU8(PSSMHANDLE pSSM, uint8_t *pu8);
855
856/**
857 * Loads a 8-bit signed integer item from the current data unit.
858 *
859 * @returns VBox status.
860 * @param pSSM SSM operation handle.
861 * @param pi8 Where to store the item.
862 */
863SSMR3DECL(int) SSMR3GetS8(PSSMHANDLE pSSM, int8_t *pi8);
864
865/**
866 * Loads a 16-bit unsigned integer item from the current data unit.
867 *
868 * @returns VBox status.
869 * @param pSSM SSM operation handle.
870 * @param pu16 Where to store the item.
871 */
872SSMR3DECL(int) SSMR3GetU16(PSSMHANDLE pSSM, uint16_t *pu16);
873
874/**
875 * Loads a 16-bit signed integer item from the current data unit.
876 *
877 * @returns VBox status.
878 * @param pSSM SSM operation handle.
879 * @param pi16 Where to store the item.
880 */
881SSMR3DECL(int) SSMR3GetS16(PSSMHANDLE pSSM, int16_t *pi16);
882
883/**
884 * Loads a 32-bit unsigned integer item from the current data unit.
885 *
886 * @returns VBox status.
887 * @param pSSM SSM operation handle.
888 * @param pu32 Where to store the item.
889 */
890SSMR3DECL(int) SSMR3GetU32(PSSMHANDLE pSSM, uint32_t *pu32);
891
892/**
893 * Loads a 32-bit signed integer item from the current data unit.
894 *
895 * @returns VBox status.
896 * @param pSSM SSM operation handle.
897 * @param pi32 Where to store the item.
898 */
899SSMR3DECL(int) SSMR3GetS32(PSSMHANDLE pSSM, int32_t *pi32);
900
901/**
902 * Loads a 64-bit unsigned integer item from the current data unit.
903 *
904 * @returns VBox status.
905 * @param pSSM SSM operation handle.
906 * @param pu64 Where to store the item.
907 */
908SSMR3DECL(int) SSMR3GetU64(PSSMHANDLE pSSM, uint64_t *pu64);
909
910/**
911 * Loads a 64-bit signed integer item from the current data unit.
912 *
913 * @returns VBox status.
914 * @param pSSM SSM operation handle.
915 * @param pi64 Where to store the item.
916 */
917SSMR3DECL(int) SSMR3GetS64(PSSMHANDLE pSSM, int64_t *pi64);
918
919/**
920 * Loads a 128-bit unsigned integer item from the current data unit.
921 *
922 * @returns VBox status.
923 * @param pSSM SSM operation handle.
924 * @param pu128 Where to store the item.
925 */
926SSMR3DECL(int) SSMR3GetU128(PSSMHANDLE pSSM, uint128_t *pu128);
927
928/**
929 * Loads a 128-bit signed integer item from the current data unit.
930 *
931 * @returns VBox status.
932 * @param pSSM SSM operation handle.
933 * @param pi128 Where to store the item.
934 */
935SSMR3DECL(int) SSMR3GetS128(PSSMHANDLE pSSM, int128_t *pi128);
936
937/**
938 * Loads a VBox unsigned integer item from the current data unit.
939 *
940 * @returns VBox status.
941 * @param pSSM SSM operation handle.
942 * @param pu Where to store the integer.
943 */
944SSMR3DECL(int) SSMR3GetUInt(PSSMHANDLE pSSM, PRTUINT pu);
945
946/**
947 * Loads a VBox signed integer item from the current data unit.
948 *
949 * @returns VBox status.
950 * @param pSSM SSM operation handle.
951 * @param pi Where to store the integer.
952 */
953SSMR3DECL(int) SSMR3GetSInt(PSSMHANDLE pSSM, PRTINT pi);
954
955/**
956 * Loads a GC natural unsigned integer item from the current data unit.
957 *
958 * @returns VBox status.
959 * @param pSSM SSM operation handle.
960 * @param pu Where to store the integer.
961 */
962SSMR3DECL(int) SSMR3GetGCUInt(PSSMHANDLE pSSM, PRTGCUINT pu);
963
964/**
965 * Loads a GC natural signed integer item from the current data unit.
966 *
967 * @returns VBox status.
968 * @param pSSM SSM operation handle.
969 * @param pi Where to store the integer.
970 */
971SSMR3DECL(int) SSMR3GetGCSInt(PSSMHANDLE pSSM, PRTGCINT pi);
972
973/**
974 * Loads a GC physical address item from the current data unit.
975 *
976 * @returns VBox status.
977 * @param pSSM SSM operation handle.
978 * @param pGCPhys Where to store the GC physical address.
979 */
980SSMR3DECL(int) SSMR3GetGCPhys(PSSMHANDLE pSSM, PRTGCPHYS pGCPhys);
981
982/**
983 * Loads a GC virtual address item from the current data unit.
984 *
985 * @returns VBox status.
986 * @param pSSM SSM operation handle.
987 * @param pGCPtr Where to store the GC virtual address.
988 */
989SSMR3DECL(int) SSMR3GetGCPtr(PSSMHANDLE pSSM, PRTGCPTR pGCPtr);
990
991/**
992 * Loads a GC virtual address (represented as unsigned integer) item from the current data unit.
993 *
994 * @returns VBox status.
995 * @param pSSM SSM operation handle.
996 * @param pGCPtr Where to store the GC virtual address.
997 */
998SSMR3DECL(int) SSMR3GetGCUIntPtr(PSSMHANDLE pSSM, PRTGCUINTPTR pGCPtr);
999
1000/**
1001 * Loads a I/O port address item from the current data unit.
1002 *
1003 * @returns VBox status.
1004 * @param pSSM SSM operation handle.
1005 * @param pIOPort Where to store the I/O port address.
1006 */
1007SSMR3DECL(int) SSMR3GetIOPort(PSSMHANDLE pSSM, PRTIOPORT pIOPort);
1008
1009/**
1010 * Loads a HC natural unsigned integer item from the current data unit.
1011 *
1012 * @returns VBox status.
1013 * @param pSSM SSM operation handle.
1014 * @param pu Where to store the integer.
1015 */
1016SSMR3DECL(int) SSMR3GetHCUInt(PSSMHANDLE pSSM, PRTHCUINT pu);
1017
1018/**
1019 * Loads a HC natural signed integer item from the current data unit.
1020 *
1021 * @returns VBox status.
1022 * @param pSSM SSM operation handle.
1023 * @param pi Where to store the integer.
1024 */
1025SSMR3DECL(int) SSMR3GetHCSInt(PSSMHANDLE pSSM, PRTHCINT pi);
1026
1027/**
1028 * Loads a selector item from the current data unit.
1029 *
1030 * @returns VBox status.
1031 * @param pSSM SSM operation handle.
1032 * @param pSel Where to store the selector.
1033 */
1034SSMR3DECL(int) SSMR3GetSel(PSSMHANDLE pSSM, PRTSEL pSel);
1035
1036/**
1037 * Loads a memory item from the current data unit.
1038 *
1039 * @returns VBox status.
1040 * @param pSSM SSM operation handle.
1041 * @param pv Where to store the item.
1042 * @param cb Size of the item.
1043 */
1044SSMR3DECL(int) SSMR3GetMem(PSSMHANDLE pSSM, void *pv, size_t cb);
1045
1046/**
1047 * Loads a string item from the current data unit.
1048 *
1049 * @returns VBox status.
1050 * @param pSSM SSM operation handle.
1051 * @param psz Where to store the item.
1052 * @param cbMax Max size of the item (including '\\0').
1053 */
1054SSMR3DECL(int) SSMR3GetStrZ(PSSMHANDLE pSSM, char *psz, size_t cbMax);
1055
1056/**
1057 * Loads a string item from the current data unit.
1058 *
1059 * @returns VBox status.
1060 * @param pSSM SSM operation handle.
1061 * @param psz Where to store the item.
1062 * @param cbMax Max size of the item (including '\\0').
1063 * @param pcbStr The length of the loaded string excluding the '\\0'. (optional)
1064 */
1065SSMR3DECL(int) SSMR3GetStrZEx(PSSMHANDLE pSSM, char *psz, size_t cbMax, size_t *pcbStr);
1066
1067/**
1068 * Loads a timer item from the current data unit.
1069 *
1070 * @returns VBox status.
1071 * @param pSSM SSM operation handle.
1072 * @param PTMTIMER Where to store the item.
1073 */
1074SSMR3DECL(int) SSMR3GetTimer(PSSMHANDLE pSSM, PTMTIMER pTimer);
1075
1076/** @} */
1077
1078
1079
1080/**
1081 * Query what the VBox status code of the operation is.
1082 *
1083 * This can be used for putting and getting a batch of values
1084 * without bother checking the result till all the calls have
1085 * been made.
1086 *
1087 * @returns VBox status code.
1088 * @param pSSM SSM operation handle.
1089 */
1090SSMR3DECL(int) SSMR3HandleGetStatus(PSSMHANDLE pSSM);
1091
1092/**
1093 * Fail the load operation.
1094 *
1095 * This is mainly intended for sub item loaders (like timers) which
1096 * return code isn't necessarily heeded by the caller but is important
1097 * to SSM.
1098 *
1099 * @returns SSMAFTER enum value.
1100 * @param pSSM SSM operation handle.
1101 * @param iStatus Failure status code. This MUST be a VERR_*.
1102 */
1103SSMR3DECL(int) SSMR3HandleSetStatus(PSSMHANDLE pSSM, int iStatus);
1104
1105/**
1106 * Query what to do after this operation.
1107 *
1108 * @returns SSMAFTER enum value.
1109 * @param pSSM SSM operation handle.
1110 */
1111SSMR3DECL(int) SSMR3HandleGetAfter(PSSMHANDLE pSSM);
1112
1113
1114#endif /* IN_RING3 */
1115
1116
1117/** @} */
1118
1119__END_DECLS
1120
1121#endif
1122
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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