VirtualBox

source: vbox/trunk/src/VBox/VMM/SSMInternal.h@ 22309

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

SSMInternal.h: A few of extra members for the new code.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.9 KB
Line 
1/* $Id: SSMInternal.h 21798 2009-07-25 23:24:30Z vboxsync $ */
2/** @file
3 * SSM - Internal header file.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#ifndef ___SSMInternal_h
23#define ___SSMInternal_h
24
25#include <VBox/cdefs.h>
26#include <VBox/types.h>
27#include <VBox/ssm.h>
28
29RT_C_DECLS_BEGIN
30
31/** @defgroup grp_ssm_int Internals
32 * @ingroup grp_ssm
33 * @internal
34 * @{
35 */
36
37
38/**
39 * Data unit callback type.
40 */
41typedef enum SSMUNITTYPE
42{
43 /** PDM Device . */
44 SSMUNITTYPE_DEV = 1,
45 /** PDM Driver. */
46 SSMUNITTYPE_DRV,
47 /** VM Internal. */
48 SSMUNITTYPE_INTERNAL,
49 /** External Wrapper. */
50 SSMUNITTYPE_EXTERNAL
51} SSMUNITTYPE;
52
53/** Pointer to a data unit descriptor. */
54typedef struct SSMUNIT *PSSMUNIT;
55
56/**
57 * Data unit descriptor.
58 */
59typedef struct SSMUNIT
60{
61 /** Pointer ot the next one in the list. */
62 PSSMUNIT pNext;
63
64 /** Called in this save/load operation.
65 * The flag is used to determin whether there is need for a call to
66 * done or not. */
67 bool fCalled;
68 /** Callback interface type. */
69 SSMUNITTYPE enmType;
70 /** Type specific data. */
71 union
72 {
73 /** SSMUNITTYPE_DEV. */
74 struct
75 {
76 /** Prepare save. */
77 PFNSSMDEVSAVEPREP pfnSavePrep;
78 /** Execute save. */
79 PFNSSMDEVSAVEEXEC pfnSaveExec;
80 /** Done save. */
81 PFNSSMDEVSAVEDONE pfnSaveDone;
82 /** Prepare load. */
83 PFNSSMDEVLOADPREP pfnLoadPrep;
84 /** Execute load. */
85 PFNSSMDEVLOADEXEC pfnLoadExec;
86 /** Done load. */
87 PFNSSMDEVLOADDONE pfnLoadDone;
88 /** Device instance. */
89 PPDMDEVINS pDevIns;
90 } Dev;
91
92 /** SSMUNITTYPE_DRV. */
93 struct
94 {
95 /** Prepare save. */
96 PFNSSMDRVSAVEPREP pfnSavePrep;
97 /** Execute save. */
98 PFNSSMDRVSAVEEXEC pfnSaveExec;
99 /** Done save. */
100 PFNSSMDRVSAVEDONE pfnSaveDone;
101 /** Prepare load. */
102 PFNSSMDRVLOADPREP pfnLoadPrep;
103 /** Execute load. */
104 PFNSSMDRVLOADEXEC pfnLoadExec;
105 /** Done load. */
106 PFNSSMDRVLOADDONE pfnLoadDone;
107 /** Driver instance. */
108 PPDMDRVINS pDrvIns;
109 } Drv;
110
111 /** SSMUNITTYPE_INTERNAL. */
112 struct
113 {
114 /** Prepare save. */
115 PFNSSMINTSAVEPREP pfnSavePrep;
116 /** Execute save. */
117 PFNSSMINTSAVEEXEC pfnSaveExec;
118 /** Done save. */
119 PFNSSMINTSAVEDONE pfnSaveDone;
120 /** Prepare load. */
121 PFNSSMINTLOADPREP pfnLoadPrep;
122 /** Execute load. */
123 PFNSSMINTLOADEXEC pfnLoadExec;
124 /** Done load. */
125 PFNSSMINTLOADDONE pfnLoadDone;
126 } Internal;
127
128 /** SSMUNITTYPE_EXTERNAL. */
129 struct
130 {
131 /** Prepare save. */
132 PFNSSMEXTSAVEPREP pfnSavePrep;
133 /** Execute save. */
134 PFNSSMEXTSAVEEXEC pfnSaveExec;
135 /** Done save. */
136 PFNSSMEXTSAVEDONE pfnSaveDone;
137 /** Prepare load. */
138 PFNSSMEXTLOADPREP pfnLoadPrep;
139 /** Execute load. */
140 PFNSSMEXTLOADEXEC pfnLoadExec;
141 /** Done load. */
142 PFNSSMEXTLOADDONE pfnLoadDone;
143 /** User data. */
144 void *pvUser;
145 } External;
146
147 struct
148 {
149 /** Prepare save. */
150 PFNRT pfnSavePrep;
151 /** Execute save. */
152 PFNRT pfnSaveExec;
153 /** Done save. */
154 PFNRT pfnSaveDone;
155 /** Prepare load. */
156 PFNRT pfnLoadPrep;
157 /** Execute load. */
158 PFNRT pfnLoadExec;
159 /** Done load. */
160 PFNRT pfnLoadDone;
161 /** User data. */
162 void *pvKey;
163 } Common;
164 } u;
165 /** Data layout version. */
166 uint32_t u32Version;
167 /** Instance number. */
168 uint32_t u32Instance;
169 /** The offset of the final data unit.
170 * This is used for constructing the directory. */
171 RTFOFF offStream;
172 /** The guessed size of the data unit - used only for progress indication. */
173 size_t cbGuess;
174 /** Name size. (bytes) */
175 size_t cchName;
176 /** Name of this unit. (extends beyond the defined size) */
177 char szName[1];
178} SSMUNIT;
179
180AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSavePrep, u.Dev.pfnSavePrep);
181AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveExec, u.Dev.pfnSaveExec);
182AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveDone, u.Dev.pfnSaveDone);
183AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadPrep, u.Dev.pfnLoadPrep);
184AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadExec, u.Dev.pfnLoadExec);
185AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadDone, u.Dev.pfnLoadDone);
186AssertCompile2MemberOffsets(SSMUNIT, u.Common.pvKey, u.Dev.pDevIns);
187
188AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSavePrep, u.Drv.pfnSavePrep);
189AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveExec, u.Drv.pfnSaveExec);
190AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveDone, u.Drv.pfnSaveDone);
191AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadPrep, u.Drv.pfnLoadPrep);
192AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadExec, u.Drv.pfnLoadExec);
193AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadDone, u.Drv.pfnLoadDone);
194AssertCompile2MemberOffsets(SSMUNIT, u.Common.pvKey, u.Drv.pDrvIns);
195
196AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSavePrep, u.Internal.pfnSavePrep);
197AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveExec, u.Internal.pfnSaveExec);
198AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveDone, u.Internal.pfnSaveDone);
199AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadPrep, u.Internal.pfnLoadPrep);
200AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadExec, u.Internal.pfnLoadExec);
201AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadDone, u.Internal.pfnLoadDone);
202
203AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSavePrep, u.External.pfnSavePrep);
204AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveExec, u.External.pfnSaveExec);
205AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveDone, u.External.pfnSaveDone);
206AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadPrep, u.External.pfnLoadPrep);
207AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadExec, u.External.pfnLoadExec);
208AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadDone, u.External.pfnLoadDone);
209AssertCompile2MemberOffsets(SSMUNIT, u.Common.pvKey, u.External.pvUser);
210
211
212/**
213 * SSM VM Instance data.
214 * Changes to this must checked against the padding of the cfgm union in VM!
215 *
216 * @todo Move this to UVM.
217 */
218typedef struct SSM
219{
220 /** FIFO of data entity descriptors. */
221 R3PTRTYPE(PSSMUNIT) pHead;
222 /** The number of register units. */
223 uint32_t cUnits;
224 /** For lazy init. */
225 bool fInitialized;
226} SSM;
227/** Pointer to SSM VM instance data. */
228typedef SSM *PSSM;
229
230
231
232/** @} */
233
234RT_C_DECLS_END
235
236#endif /* !___SSMInternal_h */
237
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