2 * QEMU migration/snapshot declarations
4 * Copyright (c) 2009-2011 Red Hat, Inc.
6 * Original author: Juan Quintela <quintela@redhat.com>
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 #ifndef QEMU_VMSTATE_H
27 #define QEMU_VMSTATE_H 1
29 typedef void SaveStateHandler(QEMUFile *f, void *opaque);
30 typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
32 typedef struct SaveVMHandlers {
33 void (*set_params)(const MigrationParams *params, void * opaque);
34 SaveStateHandler *save_state;
35 int (*save_live_setup)(QEMUFile *f, void *opaque);
36 int (*save_live_iterate)(QEMUFile *f, void *opaque);
37 int (*save_live_complete)(QEMUFile *f, void *opaque);
38 void (*cancel)(void *opaque);
39 LoadStateHandler *load_state;
40 bool (*is_active)(void *opaque);
43 int register_savevm(DeviceState *dev,
47 SaveStateHandler *save_state,
48 LoadStateHandler *load_state,
51 int register_savevm_live(DeviceState *dev,
58 void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque);
59 void register_device_unmigratable(DeviceState *dev, const char *idstr,
63 typedef struct VMStateInfo VMStateInfo;
64 typedef struct VMStateDescription VMStateDescription;
68 int (*get)(QEMUFile *f, void *pv, size_t size);
69 void (*put)(QEMUFile *f, void *pv, size_t size);
77 VMS_VARRAY_INT32 = 0x010, /* Array with size in int32_t field*/
78 VMS_BUFFER = 0x020, /* static sized buffer */
79 VMS_ARRAY_OF_POINTER = 0x040,
80 VMS_VARRAY_UINT16 = 0x080, /* Array with size in uint16_t field */
81 VMS_VBUFFER = 0x100, /* Buffer with size in int32_t field */
82 VMS_MULTIPLY = 0x200, /* multiply "size" field by field_size */
83 VMS_VARRAY_UINT8 = 0x400, /* Array with size in uint8_t field*/
84 VMS_VARRAY_UINT32 = 0x800, /* Array with size in uint32_t field*/
95 const VMStateInfo *info;
96 enum VMStateFlags flags;
97 const VMStateDescription *vmsd;
99 bool (*field_exists)(void *opaque, int version_id);
102 typedef struct VMStateSubsection {
103 const VMStateDescription *vmsd;
104 bool (*needed)(void *opaque);
107 struct VMStateDescription {
111 int minimum_version_id;
112 int minimum_version_id_old;
113 LoadStateHandler *load_state_old;
114 int (*pre_load)(void *opaque);
115 int (*post_load)(void *opaque, int version_id);
116 void (*pre_save)(void *opaque);
117 VMStateField *fields;
118 const VMStateSubsection *subsections;
121 extern const VMStateInfo vmstate_info_bool;
123 extern const VMStateInfo vmstate_info_int8;
124 extern const VMStateInfo vmstate_info_int16;
125 extern const VMStateInfo vmstate_info_int32;
126 extern const VMStateInfo vmstate_info_int64;
128 extern const VMStateInfo vmstate_info_uint8_equal;
129 extern const VMStateInfo vmstate_info_uint16_equal;
130 extern const VMStateInfo vmstate_info_int32_equal;
131 extern const VMStateInfo vmstate_info_uint32_equal;
132 extern const VMStateInfo vmstate_info_int32_le;
134 extern const VMStateInfo vmstate_info_uint8;
135 extern const VMStateInfo vmstate_info_uint16;
136 extern const VMStateInfo vmstate_info_uint32;
137 extern const VMStateInfo vmstate_info_uint64;
139 extern const VMStateInfo vmstate_info_timer;
140 extern const VMStateInfo vmstate_info_buffer;
141 extern const VMStateInfo vmstate_info_unused_buffer;
142 extern const VMStateInfo vmstate_info_bitmap;
144 #define type_check_array(t1,t2,n) ((t1(*)[n])0 - (t2*)0)
145 #define type_check_pointer(t1,t2) ((t1**)0 - (t2*)0)
147 #define vmstate_offset_value(_state, _field, _type) \
148 (offsetof(_state, _field) + \
149 type_check(_type, typeof_field(_state, _field)))
151 #define vmstate_offset_pointer(_state, _field, _type) \
152 (offsetof(_state, _field) + \
153 type_check_pointer(_type, typeof_field(_state, _field)))
155 #define vmstate_offset_array(_state, _field, _type, _num) \
156 (offsetof(_state, _field) + \
157 type_check_array(_type, typeof_field(_state, _field), _num))
159 #define vmstate_offset_sub_array(_state, _field, _type, _start) \
160 (offsetof(_state, _field[_start]))
162 #define vmstate_offset_buffer(_state, _field) \
163 vmstate_offset_array(_state, _field, uint8_t, \
164 sizeof(typeof_field(_state, _field)))
166 #define VMSTATE_SINGLE_TEST(_field, _state, _test, _version, _info, _type) { \
167 .name = (stringify(_field)), \
168 .version_id = (_version), \
169 .field_exists = (_test), \
170 .size = sizeof(_type), \
172 .flags = VMS_SINGLE, \
173 .offset = vmstate_offset_value(_state, _field, _type), \
176 #define VMSTATE_POINTER(_field, _state, _version, _info, _type) { \
177 .name = (stringify(_field)), \
178 .version_id = (_version), \
180 .size = sizeof(_type), \
181 .flags = VMS_SINGLE|VMS_POINTER, \
182 .offset = vmstate_offset_value(_state, _field, _type), \
185 #define VMSTATE_POINTER_TEST(_field, _state, _test, _info, _type) { \
186 .name = (stringify(_field)), \
188 .field_exists = (_test), \
189 .size = sizeof(_type), \
190 .flags = VMS_SINGLE|VMS_POINTER, \
191 .offset = vmstate_offset_value(_state, _field, _type), \
194 #define VMSTATE_ARRAY(_field, _state, _num, _version, _info, _type) {\
195 .name = (stringify(_field)), \
196 .version_id = (_version), \
199 .size = sizeof(_type), \
200 .flags = VMS_ARRAY, \
201 .offset = vmstate_offset_array(_state, _field, _type, _num), \
204 #define VMSTATE_ARRAY_TEST(_field, _state, _num, _test, _info, _type) {\
205 .name = (stringify(_field)), \
206 .field_exists = (_test), \
209 .size = sizeof(_type), \
210 .flags = VMS_ARRAY, \
211 .offset = vmstate_offset_array(_state, _field, _type, _num),\
214 #define VMSTATE_SUB_ARRAY(_field, _state, _start, _num, _version, _info, _type) { \
215 .name = (stringify(_field)), \
216 .version_id = (_version), \
219 .size = sizeof(_type), \
220 .flags = VMS_ARRAY, \
221 .offset = vmstate_offset_sub_array(_state, _field, _type, _start), \
224 #define VMSTATE_ARRAY_INT32_UNSAFE(_field, _state, _field_num, _info, _type) {\
225 .name = (stringify(_field)), \
226 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
228 .size = sizeof(_type), \
229 .flags = VMS_VARRAY_INT32, \
230 .offset = offsetof(_state, _field), \
233 #define VMSTATE_VARRAY_INT32(_field, _state, _field_num, _version, _info, _type) {\
234 .name = (stringify(_field)), \
235 .version_id = (_version), \
236 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
238 .size = sizeof(_type), \
239 .flags = VMS_VARRAY_INT32|VMS_POINTER, \
240 .offset = vmstate_offset_pointer(_state, _field, _type), \
243 #define VMSTATE_VARRAY_UINT32(_field, _state, _field_num, _version, _info, _type) {\
244 .name = (stringify(_field)), \
245 .version_id = (_version), \
246 .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\
248 .size = sizeof(_type), \
249 .flags = VMS_VARRAY_UINT32|VMS_POINTER, \
250 .offset = vmstate_offset_pointer(_state, _field, _type), \
253 #define VMSTATE_VARRAY_UINT16_UNSAFE(_field, _state, _field_num, _version, _info, _type) {\
254 .name = (stringify(_field)), \
255 .version_id = (_version), \
256 .num_offset = vmstate_offset_value(_state, _field_num, uint16_t),\
258 .size = sizeof(_type), \
259 .flags = VMS_VARRAY_UINT16, \
260 .offset = offsetof(_state, _field), \
263 #define VMSTATE_STRUCT_TEST(_field, _state, _test, _version, _vmsd, _type) { \
264 .name = (stringify(_field)), \
265 .version_id = (_version), \
266 .field_exists = (_test), \
268 .size = sizeof(_type), \
269 .flags = VMS_STRUCT, \
270 .offset = vmstate_offset_value(_state, _field, _type), \
273 #define VMSTATE_STRUCT_POINTER_TEST(_field, _state, _test, _vmsd, _type) { \
274 .name = (stringify(_field)), \
275 .field_exists = (_test), \
277 .size = sizeof(_type), \
278 .flags = VMS_STRUCT|VMS_POINTER, \
279 .offset = vmstate_offset_value(_state, _field, _type), \
282 #define VMSTATE_ARRAY_OF_POINTER(_field, _state, _num, _version, _info, _type) {\
283 .name = (stringify(_field)), \
284 .version_id = (_version), \
287 .size = sizeof(_type), \
288 .flags = VMS_ARRAY|VMS_ARRAY_OF_POINTER, \
289 .offset = vmstate_offset_array(_state, _field, _type, _num), \
292 #define VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, _test, _version, _vmsd, _type) { \
293 .name = (stringify(_field)), \
295 .field_exists = (_test), \
296 .version_id = (_version), \
298 .size = sizeof(_type), \
299 .flags = VMS_STRUCT|VMS_ARRAY, \
300 .offset = vmstate_offset_array(_state, _field, _type, _num),\
303 #define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _version, _vmsd, _type) { \
304 .name = (stringify(_field)), \
305 .num_offset = vmstate_offset_value(_state, _field_num, uint8_t), \
306 .version_id = (_version), \
308 .size = sizeof(_type), \
309 .flags = VMS_STRUCT|VMS_VARRAY_UINT8, \
310 .offset = offsetof(_state, _field), \
313 #define VMSTATE_STRUCT_VARRAY_POINTER_INT32(_field, _state, _field_num, _vmsd, _type) { \
314 .name = (stringify(_field)), \
316 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
317 .size = sizeof(_type), \
319 .flags = VMS_POINTER | VMS_VARRAY_INT32 | VMS_STRUCT, \
320 .offset = vmstate_offset_pointer(_state, _field, _type), \
323 #define VMSTATE_STRUCT_VARRAY_POINTER_UINT16(_field, _state, _field_num, _vmsd, _type) { \
324 .name = (stringify(_field)), \
326 .num_offset = vmstate_offset_value(_state, _field_num, uint16_t),\
327 .size = sizeof(_type), \
329 .flags = VMS_POINTER | VMS_VARRAY_UINT16 | VMS_STRUCT, \
330 .offset = vmstate_offset_pointer(_state, _field, _type), \
333 #define VMSTATE_STRUCT_VARRAY_INT32(_field, _state, _field_num, _version, _vmsd, _type) { \
334 .name = (stringify(_field)), \
335 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
336 .version_id = (_version), \
338 .size = sizeof(_type), \
339 .flags = VMS_STRUCT|VMS_VARRAY_INT32, \
340 .offset = offsetof(_state, _field), \
343 #define VMSTATE_STRUCT_VARRAY_UINT32(_field, _state, _field_num, _version, _vmsd, _type) { \
344 .name = (stringify(_field)), \
345 .num_offset = vmstate_offset_value(_state, _field_num, uint32_t), \
346 .version_id = (_version), \
348 .size = sizeof(_type), \
349 .flags = VMS_STRUCT|VMS_VARRAY_UINT32, \
350 .offset = offsetof(_state, _field), \
353 #define VMSTATE_STATIC_BUFFER(_field, _state, _version, _test, _start, _size) { \
354 .name = (stringify(_field)), \
355 .version_id = (_version), \
356 .field_exists = (_test), \
357 .size = (_size - _start), \
358 .info = &vmstate_info_buffer, \
359 .flags = VMS_BUFFER, \
360 .offset = vmstate_offset_buffer(_state, _field) + _start, \
363 #define VMSTATE_BUFFER_MULTIPLY(_field, _state, _version, _test, _start, _field_size, _multiply) { \
364 .name = (stringify(_field)), \
365 .version_id = (_version), \
366 .field_exists = (_test), \
367 .size_offset = vmstate_offset_value(_state, _field_size, uint32_t),\
368 .size = (_multiply), \
369 .info = &vmstate_info_buffer, \
370 .flags = VMS_VBUFFER|VMS_MULTIPLY, \
371 .offset = offsetof(_state, _field), \
375 #define VMSTATE_VBUFFER(_field, _state, _version, _test, _start, _field_size) { \
376 .name = (stringify(_field)), \
377 .version_id = (_version), \
378 .field_exists = (_test), \
379 .size_offset = vmstate_offset_value(_state, _field_size, int32_t),\
380 .info = &vmstate_info_buffer, \
381 .flags = VMS_VBUFFER|VMS_POINTER, \
382 .offset = offsetof(_state, _field), \
386 #define VMSTATE_VBUFFER_UINT32(_field, _state, _version, _test, _start, _field_size) { \
387 .name = (stringify(_field)), \
388 .version_id = (_version), \
389 .field_exists = (_test), \
390 .size_offset = vmstate_offset_value(_state, _field_size, uint32_t),\
391 .info = &vmstate_info_buffer, \
392 .flags = VMS_VBUFFER|VMS_POINTER, \
393 .offset = offsetof(_state, _field), \
397 #define VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, _info, _size) { \
398 .name = (stringify(_field)), \
399 .version_id = (_version), \
402 .flags = VMS_BUFFER, \
403 .offset = offsetof(_state, _field), \
406 #define VMSTATE_UNUSED_BUFFER(_test, _version, _size) { \
408 .field_exists = (_test), \
409 .version_id = (_version), \
411 .info = &vmstate_info_unused_buffer, \
412 .flags = VMS_BUFFER, \
415 /* _field_size should be a int32_t field in the _state struct giving the
416 * size of the bitmap _field in bits.
418 #define VMSTATE_BITMAP(_field, _state, _version, _field_size) { \
419 .name = (stringify(_field)), \
420 .version_id = (_version), \
421 .size_offset = vmstate_offset_value(_state, _field_size, int32_t),\
422 .info = &vmstate_info_bitmap, \
423 .flags = VMS_VBUFFER|VMS_POINTER, \
424 .offset = offsetof(_state, _field), \
428 _f_n : num of elements field_name
430 _s : struct state name
434 #define VMSTATE_SINGLE(_field, _state, _version, _info, _type) \
435 VMSTATE_SINGLE_TEST(_field, _state, NULL, _version, _info, _type)
437 #define VMSTATE_STRUCT(_field, _state, _version, _vmsd, _type) \
438 VMSTATE_STRUCT_TEST(_field, _state, NULL, _version, _vmsd, _type)
440 #define VMSTATE_STRUCT_POINTER(_field, _state, _vmsd, _type) \
441 VMSTATE_STRUCT_POINTER_TEST(_field, _state, NULL, _vmsd, _type)
443 #define VMSTATE_STRUCT_ARRAY(_field, _state, _num, _version, _vmsd, _type) \
444 VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, NULL, _version, \
447 #define VMSTATE_BOOL_V(_f, _s, _v) \
448 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_bool, bool)
450 #define VMSTATE_INT8_V(_f, _s, _v) \
451 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int8, int8_t)
452 #define VMSTATE_INT16_V(_f, _s, _v) \
453 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int16, int16_t)
454 #define VMSTATE_INT32_V(_f, _s, _v) \
455 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int32, int32_t)
456 #define VMSTATE_INT64_V(_f, _s, _v) \
457 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int64, int64_t)
459 #define VMSTATE_UINT8_V(_f, _s, _v) \
460 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint8, uint8_t)
461 #define VMSTATE_UINT16_V(_f, _s, _v) \
462 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16, uint16_t)
463 #define VMSTATE_UINT32_V(_f, _s, _v) \
464 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint32, uint32_t)
465 #define VMSTATE_UINT64_V(_f, _s, _v) \
466 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint64, uint64_t)
468 #define VMSTATE_BOOL(_f, _s) \
469 VMSTATE_BOOL_V(_f, _s, 0)
471 #define VMSTATE_INT8(_f, _s) \
472 VMSTATE_INT8_V(_f, _s, 0)
473 #define VMSTATE_INT16(_f, _s) \
474 VMSTATE_INT16_V(_f, _s, 0)
475 #define VMSTATE_INT32(_f, _s) \
476 VMSTATE_INT32_V(_f, _s, 0)
477 #define VMSTATE_INT64(_f, _s) \
478 VMSTATE_INT64_V(_f, _s, 0)
480 #define VMSTATE_UINT8(_f, _s) \
481 VMSTATE_UINT8_V(_f, _s, 0)
482 #define VMSTATE_UINT16(_f, _s) \
483 VMSTATE_UINT16_V(_f, _s, 0)
484 #define VMSTATE_UINT32(_f, _s) \
485 VMSTATE_UINT32_V(_f, _s, 0)
486 #define VMSTATE_UINT64(_f, _s) \
487 VMSTATE_UINT64_V(_f, _s, 0)
489 #define VMSTATE_UINT8_EQUAL(_f, _s) \
490 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint8_equal, uint8_t)
492 #define VMSTATE_UINT16_EQUAL(_f, _s) \
493 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint16_equal, uint16_t)
495 #define VMSTATE_UINT16_EQUAL_V(_f, _s, _v) \
496 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16_equal, uint16_t)
498 #define VMSTATE_INT32_EQUAL(_f, _s) \
499 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_equal, int32_t)
501 #define VMSTATE_UINT32_EQUAL(_f, _s) \
502 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint32_equal, uint32_t)
504 #define VMSTATE_INT32_LE(_f, _s) \
505 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
507 #define VMSTATE_UINT8_TEST(_f, _s, _t) \
508 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint8, uint8_t)
510 #define VMSTATE_UINT16_TEST(_f, _s, _t) \
511 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint16, uint16_t)
513 #define VMSTATE_UINT32_TEST(_f, _s, _t) \
514 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint32, uint32_t)
516 #define VMSTATE_TIMER_TEST(_f, _s, _test) \
517 VMSTATE_POINTER_TEST(_f, _s, _test, vmstate_info_timer, QEMUTimer *)
519 #define VMSTATE_TIMER_V(_f, _s, _v) \
520 VMSTATE_POINTER(_f, _s, _v, vmstate_info_timer, QEMUTimer *)
522 #define VMSTATE_TIMER(_f, _s) \
523 VMSTATE_TIMER_V(_f, _s, 0)
525 #define VMSTATE_TIMER_ARRAY(_f, _s, _n) \
526 VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer *)
528 #define VMSTATE_BOOL_ARRAY_V(_f, _s, _n, _v) \
529 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_bool, bool)
531 #define VMSTATE_BOOL_ARRAY(_f, _s, _n) \
532 VMSTATE_BOOL_ARRAY_V(_f, _s, _n, 0)
534 #define VMSTATE_UINT16_ARRAY_V(_f, _s, _n, _v) \
535 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint16, uint16_t)
537 #define VMSTATE_UINT16_ARRAY(_f, _s, _n) \
538 VMSTATE_UINT16_ARRAY_V(_f, _s, _n, 0)
540 #define VMSTATE_UINT8_ARRAY_V(_f, _s, _n, _v) \
541 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint8, uint8_t)
543 #define VMSTATE_UINT8_ARRAY(_f, _s, _n) \
544 VMSTATE_UINT8_ARRAY_V(_f, _s, _n, 0)
546 #define VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v) \
547 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint32, uint32_t)
549 #define VMSTATE_UINT32_ARRAY(_f, _s, _n) \
550 VMSTATE_UINT32_ARRAY_V(_f, _s, _n, 0)
552 #define VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v) \
553 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint64, uint64_t)
555 #define VMSTATE_UINT64_ARRAY(_f, _s, _n) \
556 VMSTATE_UINT64_ARRAY_V(_f, _s, _n, 0)
558 #define VMSTATE_INT16_ARRAY_V(_f, _s, _n, _v) \
559 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int16, int16_t)
561 #define VMSTATE_INT16_ARRAY(_f, _s, _n) \
562 VMSTATE_INT16_ARRAY_V(_f, _s, _n, 0)
564 #define VMSTATE_INT32_ARRAY_V(_f, _s, _n, _v) \
565 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int32, int32_t)
567 #define VMSTATE_INT32_ARRAY(_f, _s, _n) \
568 VMSTATE_INT32_ARRAY_V(_f, _s, _n, 0)
570 #define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num) \
571 VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t)
573 #define VMSTATE_UINT32_ARRAY(_f, _s, _n) \
574 VMSTATE_UINT32_ARRAY_V(_f, _s, _n, 0)
576 #define VMSTATE_INT64_ARRAY_V(_f, _s, _n, _v) \
577 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int64, int64_t)
579 #define VMSTATE_INT64_ARRAY(_f, _s, _n) \
580 VMSTATE_INT64_ARRAY_V(_f, _s, _n, 0)
582 #define VMSTATE_BUFFER_V(_f, _s, _v) \
583 VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))
585 #define VMSTATE_BUFFER(_f, _s) \
586 VMSTATE_BUFFER_V(_f, _s, 0)
588 #define VMSTATE_PARTIAL_BUFFER(_f, _s, _size) \
589 VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, 0, _size)
591 #define VMSTATE_BUFFER_START_MIDDLE(_f, _s, _start) \
592 VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, _start, sizeof(typeof_field(_s, _f)))
594 #define VMSTATE_PARTIAL_VBUFFER(_f, _s, _size) \
595 VMSTATE_VBUFFER(_f, _s, 0, NULL, 0, _size)
597 #define VMSTATE_PARTIAL_VBUFFER_UINT32(_f, _s, _size) \
598 VMSTATE_VBUFFER_UINT32(_f, _s, 0, NULL, 0, _size)
600 #define VMSTATE_SUB_VBUFFER(_f, _s, _start, _size) \
601 VMSTATE_VBUFFER(_f, _s, 0, NULL, _start, _size)
603 #define VMSTATE_BUFFER_TEST(_f, _s, _test) \
604 VMSTATE_STATIC_BUFFER(_f, _s, 0, _test, 0, sizeof(typeof_field(_s, _f)))
606 #define VMSTATE_BUFFER_UNSAFE(_field, _state, _version, _size) \
607 VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, vmstate_info_buffer, _size)
609 #define VMSTATE_UNUSED_V(_v, _size) \
610 VMSTATE_UNUSED_BUFFER(NULL, _v, _size)
612 #define VMSTATE_UNUSED(_size) \
613 VMSTATE_UNUSED_V(0, _size)
615 #define VMSTATE_UNUSED_TEST(_test, _size) \
616 VMSTATE_UNUSED_BUFFER(_test, 0, _size)
618 #define VMSTATE_END_OF_LIST() \
621 int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
622 void *opaque, int version_id);
623 void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
625 int vmstate_register(DeviceState *dev, int instance_id,
626 const VMStateDescription *vmsd, void *base);
627 int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,
628 const VMStateDescription *vmsd,
629 void *base, int alias_id,
630 int required_for_version);
631 void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd,
635 void vmstate_register_ram(struct MemoryRegion *memory, DeviceState *dev);
636 void vmstate_unregister_ram(struct MemoryRegion *memory, DeviceState *dev);
637 void vmstate_register_ram_global(struct MemoryRegion *memory);