1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#ifndef QEMU_VMSTATE_H
28#define QEMU_VMSTATE_H
29
30#include "hw/vmstate-if.h"
31
32typedef struct VMStateInfo VMStateInfo;
33typedef struct VMStateField VMStateField;
34
35
36
37
38
39
40
41
42struct VMStateInfo {
43 const char *name;
44 int (*get)(QEMUFile *f, void *pv, size_t size, const VMStateField *field);
45 int (*put)(QEMUFile *f, void *pv, size_t size, const VMStateField *field,
46 JSONWriter *vmdesc);
47};
48
49enum VMStateFlags {
50
51 VMS_SINGLE = 0x001,
52
53
54
55
56
57
58
59
60 VMS_POINTER = 0x002,
61
62
63
64
65
66
67
68
69
70 VMS_ARRAY = 0x004,
71
72
73
74
75
76 VMS_STRUCT = 0x008,
77
78
79
80
81
82
83 VMS_VARRAY_INT32 = 0x010,
84
85
86 VMS_BUFFER = 0x020,
87
88
89
90
91
92 VMS_ARRAY_OF_POINTER = 0x040,
93
94
95
96
97
98
99 VMS_VARRAY_UINT16 = 0x080,
100
101
102
103
104
105
106
107 VMS_VBUFFER = 0x100,
108
109
110
111
112
113 VMS_MULTIPLY = 0x200,
114
115
116
117
118
119
120 VMS_VARRAY_UINT8 = 0x400,
121
122
123
124
125
126
127 VMS_VARRAY_UINT32 = 0x800,
128
129
130
131 VMS_MUST_EXIST = 0x1000,
132
133
134
135
136
137
138 VMS_ALLOC = 0x2000,
139
140
141
142
143
144 VMS_MULTIPLY_ELEMENTS = 0x4000,
145
146
147
148
149 VMS_VSTRUCT = 0x8000,
150};
151
152typedef enum {
153 MIG_PRI_DEFAULT = 0,
154 MIG_PRI_IOMMU,
155 MIG_PRI_PCI_BUS,
156 MIG_PRI_GICV3_ITS,
157 MIG_PRI_GICV3,
158 MIG_PRI_MAX,
159} MigrationPriority;
160
161struct VMStateField {
162 const char *name;
163 const char *err_hint;
164 size_t offset;
165 size_t size;
166 size_t start;
167 int num;
168 size_t num_offset;
169 size_t size_offset;
170 const VMStateInfo *info;
171 enum VMStateFlags flags;
172 const VMStateDescription *vmsd;
173 int version_id;
174 int struct_version_id;
175 bool (*field_exists)(void *opaque, int version_id);
176};
177
178struct VMStateDescription {
179 const char *name;
180 int unmigratable;
181 int version_id;
182 int minimum_version_id;
183 int minimum_version_id_old;
184 MigrationPriority priority;
185 LoadStateHandler *load_state_old;
186 int (*pre_load)(void *opaque);
187 int (*post_load)(void *opaque, int version_id);
188 int (*pre_save)(void *opaque);
189 int (*post_save)(void *opaque);
190 bool (*needed)(void *opaque);
191 bool (*dev_unplug_pending)(void *opaque);
192
193 const VMStateField *fields;
194 const VMStateDescription **subsections;
195};
196
197extern const VMStateDescription vmstate_dummy;
198
199extern const VMStateInfo vmstate_info_bool;
200
201extern const VMStateInfo vmstate_info_int8;
202extern const VMStateInfo vmstate_info_int16;
203extern const VMStateInfo vmstate_info_int32;
204extern const VMStateInfo vmstate_info_int64;
205
206extern const VMStateInfo vmstate_info_uint8_equal;
207extern const VMStateInfo vmstate_info_uint16_equal;
208extern const VMStateInfo vmstate_info_int32_equal;
209extern const VMStateInfo vmstate_info_uint32_equal;
210extern const VMStateInfo vmstate_info_uint64_equal;
211extern const VMStateInfo vmstate_info_int32_le;
212
213extern const VMStateInfo vmstate_info_uint8;
214extern const VMStateInfo vmstate_info_uint16;
215extern const VMStateInfo vmstate_info_uint32;
216extern const VMStateInfo vmstate_info_uint64;
217
218
219#define VMS_NULLPTR_MARKER (0x30U)
220extern const VMStateInfo vmstate_info_nullptr;
221
222extern const VMStateInfo vmstate_info_cpudouble;
223
224extern const VMStateInfo vmstate_info_timer;
225extern const VMStateInfo vmstate_info_buffer;
226extern const VMStateInfo vmstate_info_unused_buffer;
227extern const VMStateInfo vmstate_info_tmp;
228extern const VMStateInfo vmstate_info_bitmap;
229extern const VMStateInfo vmstate_info_qtailq;
230extern const VMStateInfo vmstate_info_gtree;
231extern const VMStateInfo vmstate_info_qlist;
232
233#define type_check_2darray(t1,t2,n,m) ((t1(*)[n][m])0 - (t2*)0)
234
235
236
237
238#define type_check_array(t1,t2,n) ((t1(*)[n])0 - (t2*)0)
239#define type_check_pointer(t1,t2) ((t1**)0 - (t2*)0)
240
241
242
243
244
245#define typeof_elt_of_field(type, field) typeof(((type *)0)->field[0])
246
247#define type_check_varray(t1, t2, f) \
248 (type_check(t1, typeof_elt_of_field(t2, f)) \
249 + QEMU_BUILD_BUG_ON_ZERO(!QEMU_IS_ARRAY(((t2 *)0)->f)))
250
251#define vmstate_offset_value(_state, _field, _type) \
252 (offsetof(_state, _field) + \
253 type_check(_type, typeof_field(_state, _field)))
254
255#define vmstate_offset_pointer(_state, _field, _type) \
256 (offsetof(_state, _field) + \
257 type_check_pointer(_type, typeof_field(_state, _field)))
258
259#define vmstate_offset_array(_state, _field, _type, _num) \
260 (offsetof(_state, _field) + \
261 type_check_array(_type, typeof_field(_state, _field), _num))
262
263#define vmstate_offset_2darray(_state, _field, _type, _n1, _n2) \
264 (offsetof(_state, _field) + \
265 type_check_2darray(_type, typeof_field(_state, _field), _n1, _n2))
266
267#define vmstate_offset_sub_array(_state, _field, _type, _start) \
268 vmstate_offset_value(_state, _field[_start], _type)
269
270#define vmstate_offset_buffer(_state, _field) \
271 vmstate_offset_array(_state, _field, uint8_t, \
272 sizeof(typeof_field(_state, _field)))
273
274#define vmstate_offset_varray(_state, _field, _type) \
275 (offsetof(_state, _field) + \
276 type_check_varray(_type, _state, _field))
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297#define VMSTATE_SINGLE_TEST(_field, _state, _test, _version, _info, _type) { \
298 .name = (stringify(_field)), \
299 .version_id = (_version), \
300 .field_exists = (_test), \
301 .size = sizeof(_type), \
302 .info = &(_info), \
303 .flags = VMS_SINGLE, \
304 .offset = vmstate_offset_value(_state, _field, _type), \
305}
306
307#define VMSTATE_SINGLE_FULL(_field, _state, _test, _version, _info, \
308 _type, _err_hint) { \
309 .name = (stringify(_field)), \
310 .err_hint = (_err_hint), \
311 .version_id = (_version), \
312 .field_exists = (_test), \
313 .size = sizeof(_type), \
314 .info = &(_info), \
315 .flags = VMS_SINGLE, \
316 .offset = vmstate_offset_value(_state, _field, _type), \
317}
318
319
320#define VMSTATE_VALIDATE(_name, _test) { \
321 .name = (_name), \
322 .field_exists = (_test), \
323 .flags = VMS_ARRAY | VMS_MUST_EXIST, \
324 .num = 0, \
325}
326
327#define VMSTATE_POINTER(_field, _state, _version, _info, _type) { \
328 .name = (stringify(_field)), \
329 .version_id = (_version), \
330 .info = &(_info), \
331 .size = sizeof(_type), \
332 .flags = VMS_SINGLE|VMS_POINTER, \
333 .offset = vmstate_offset_value(_state, _field, _type), \
334}
335
336#define VMSTATE_POINTER_TEST(_field, _state, _test, _info, _type) { \
337 .name = (stringify(_field)), \
338 .info = &(_info), \
339 .field_exists = (_test), \
340 .size = sizeof(_type), \
341 .flags = VMS_SINGLE|VMS_POINTER, \
342 .offset = vmstate_offset_value(_state, _field, _type), \
343}
344
345#define VMSTATE_ARRAY(_field, _state, _num, _version, _info, _type) {\
346 .name = (stringify(_field)), \
347 .version_id = (_version), \
348 .num = (_num), \
349 .info = &(_info), \
350 .size = sizeof(_type), \
351 .flags = VMS_ARRAY, \
352 .offset = vmstate_offset_array(_state, _field, _type, _num), \
353}
354
355#define VMSTATE_2DARRAY(_field, _state, _n1, _n2, _version, _info, _type) { \
356 .name = (stringify(_field)), \
357 .version_id = (_version), \
358 .num = (_n1) * (_n2), \
359 .info = &(_info), \
360 .size = sizeof(_type), \
361 .flags = VMS_ARRAY, \
362 .offset = vmstate_offset_2darray(_state, _field, _type, _n1, _n2), \
363}
364
365#define VMSTATE_VARRAY_MULTIPLY(_field, _state, _field_num, _multiply, _info, _type) { \
366 .name = (stringify(_field)), \
367 .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\
368 .num = (_multiply), \
369 .info = &(_info), \
370 .size = sizeof(_type), \
371 .flags = VMS_VARRAY_UINT32|VMS_MULTIPLY_ELEMENTS, \
372 .offset = vmstate_offset_varray(_state, _field, _type), \
373}
374
375#define VMSTATE_ARRAY_TEST(_field, _state, _num, _test, _info, _type) {\
376 .name = (stringify(_field)), \
377 .field_exists = (_test), \
378 .num = (_num), \
379 .info = &(_info), \
380 .size = sizeof(_type), \
381 .flags = VMS_ARRAY, \
382 .offset = vmstate_offset_array(_state, _field, _type, _num),\
383}
384
385#define VMSTATE_SUB_ARRAY(_field, _state, _start, _num, _version, _info, _type) { \
386 .name = (stringify(_field)), \
387 .version_id = (_version), \
388 .num = (_num), \
389 .info = &(_info), \
390 .size = sizeof(_type), \
391 .flags = VMS_ARRAY, \
392 .offset = vmstate_offset_sub_array(_state, _field, _type, _start), \
393}
394
395#define VMSTATE_ARRAY_INT32_UNSAFE(_field, _state, _field_num, _info, _type) {\
396 .name = (stringify(_field)), \
397 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
398 .info = &(_info), \
399 .size = sizeof(_type), \
400 .flags = VMS_VARRAY_INT32, \
401 .offset = vmstate_offset_varray(_state, _field, _type), \
402}
403
404#define VMSTATE_VARRAY_INT32(_field, _state, _field_num, _version, _info, _type) {\
405 .name = (stringify(_field)), \
406 .version_id = (_version), \
407 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
408 .info = &(_info), \
409 .size = sizeof(_type), \
410 .flags = VMS_VARRAY_INT32|VMS_POINTER, \
411 .offset = vmstate_offset_pointer(_state, _field, _type), \
412}
413
414#define VMSTATE_VARRAY_UINT32(_field, _state, _field_num, _version, _info, _type) {\
415 .name = (stringify(_field)), \
416 .version_id = (_version), \
417 .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\
418 .info = &(_info), \
419 .size = sizeof(_type), \
420 .flags = VMS_VARRAY_UINT32|VMS_POINTER, \
421 .offset = vmstate_offset_pointer(_state, _field, _type), \
422}
423
424#define VMSTATE_VARRAY_UINT32_ALLOC(_field, _state, _field_num, _version, _info, _type) {\
425 .name = (stringify(_field)), \
426 .version_id = (_version), \
427 .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\
428 .info = &(_info), \
429 .size = sizeof(_type), \
430 .flags = VMS_VARRAY_UINT32|VMS_POINTER|VMS_ALLOC, \
431 .offset = vmstate_offset_pointer(_state, _field, _type), \
432}
433
434#define VMSTATE_VARRAY_UINT16_ALLOC(_field, _state, _field_num, _version, _info, _type) {\
435 .name = (stringify(_field)), \
436 .version_id = (_version), \
437 .num_offset = vmstate_offset_value(_state, _field_num, uint16_t),\
438 .info = &(_info), \
439 .size = sizeof(_type), \
440 .flags = VMS_VARRAY_UINT16 | VMS_POINTER | VMS_ALLOC, \
441 .offset = vmstate_offset_pointer(_state, _field, _type), \
442}
443
444#define VMSTATE_VARRAY_UINT16_UNSAFE(_field, _state, _field_num, _version, _info, _type) {\
445 .name = (stringify(_field)), \
446 .version_id = (_version), \
447 .num_offset = vmstate_offset_value(_state, _field_num, uint16_t),\
448 .info = &(_info), \
449 .size = sizeof(_type), \
450 .flags = VMS_VARRAY_UINT16, \
451 .offset = vmstate_offset_varray(_state, _field, _type), \
452}
453
454#define VMSTATE_VSTRUCT_TEST(_field, _state, _test, _version, _vmsd, _type, _struct_version) { \
455 .name = (stringify(_field)), \
456 .version_id = (_version), \
457 .struct_version_id = (_struct_version), \
458 .field_exists = (_test), \
459 .vmsd = &(_vmsd), \
460 .size = sizeof(_type), \
461 .flags = VMS_VSTRUCT, \
462 .offset = vmstate_offset_value(_state, _field, _type), \
463}
464
465#define VMSTATE_STRUCT_TEST(_field, _state, _test, _version, _vmsd, _type) { \
466 .name = (stringify(_field)), \
467 .version_id = (_version), \
468 .field_exists = (_test), \
469 .vmsd = &(_vmsd), \
470 .size = sizeof(_type), \
471 .flags = VMS_STRUCT, \
472 .offset = vmstate_offset_value(_state, _field, _type), \
473}
474
475#define VMSTATE_STRUCT_POINTER_V(_field, _state, _version, _vmsd, _type) { \
476 .name = (stringify(_field)), \
477 .version_id = (_version), \
478 .vmsd = &(_vmsd), \
479 .size = sizeof(_type *), \
480 .flags = VMS_STRUCT|VMS_POINTER, \
481 .offset = vmstate_offset_pointer(_state, _field, _type), \
482}
483
484#define VMSTATE_STRUCT_POINTER_TEST_V(_field, _state, _test, _version, _vmsd, _type) { \
485 .name = (stringify(_field)), \
486 .version_id = (_version), \
487 .field_exists = (_test), \
488 .vmsd = &(_vmsd), \
489 .size = sizeof(_type *), \
490 .flags = VMS_STRUCT|VMS_POINTER, \
491 .offset = vmstate_offset_pointer(_state, _field, _type), \
492}
493
494#define VMSTATE_ARRAY_OF_POINTER(_field, _state, _num, _version, _info, _type) {\
495 .name = (stringify(_field)), \
496 .version_id = (_version), \
497 .num = (_num), \
498 .info = &(_info), \
499 .size = sizeof(_type), \
500 .flags = VMS_ARRAY|VMS_ARRAY_OF_POINTER, \
501 .offset = vmstate_offset_array(_state, _field, _type, _num), \
502}
503
504#define VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(_f, _s, _n, _v, _vmsd, _type) { \
505 .name = (stringify(_f)), \
506 .version_id = (_v), \
507 .num = (_n), \
508 .vmsd = &(_vmsd), \
509 .size = sizeof(_type *), \
510 .flags = VMS_ARRAY|VMS_STRUCT|VMS_ARRAY_OF_POINTER, \
511 .offset = vmstate_offset_array(_s, _f, _type*, _n), \
512}
513
514#define VMSTATE_STRUCT_SUB_ARRAY(_field, _state, _start, _num, _version, _vmsd, _type) { \
515 .name = (stringify(_field)), \
516 .version_id = (_version), \
517 .num = (_num), \
518 .vmsd = &(_vmsd), \
519 .size = sizeof(_type), \
520 .flags = VMS_STRUCT|VMS_ARRAY, \
521 .offset = vmstate_offset_sub_array(_state, _field, _type, _start), \
522}
523
524#define VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, _test, _version, _vmsd, _type) { \
525 .name = (stringify(_field)), \
526 .num = (_num), \
527 .field_exists = (_test), \
528 .version_id = (_version), \
529 .vmsd = &(_vmsd), \
530 .size = sizeof(_type), \
531 .flags = VMS_STRUCT|VMS_ARRAY, \
532 .offset = vmstate_offset_array(_state, _field, _type, _num),\
533}
534
535#define VMSTATE_STRUCT_2DARRAY_TEST(_field, _state, _n1, _n2, _test, \
536 _version, _vmsd, _type) { \
537 .name = (stringify(_field)), \
538 .num = (_n1) * (_n2), \
539 .field_exists = (_test), \
540 .version_id = (_version), \
541 .vmsd = &(_vmsd), \
542 .size = sizeof(_type), \
543 .flags = VMS_STRUCT | VMS_ARRAY, \
544 .offset = vmstate_offset_2darray(_state, _field, _type, \
545 _n1, _n2), \
546}
547
548#define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _version, _vmsd, _type) { \
549 .name = (stringify(_field)), \
550 .num_offset = vmstate_offset_value(_state, _field_num, uint8_t), \
551 .version_id = (_version), \
552 .vmsd = &(_vmsd), \
553 .size = sizeof(_type), \
554 .flags = VMS_STRUCT|VMS_VARRAY_UINT8, \
555 .offset = vmstate_offset_varray(_state, _field, _type), \
556}
557
558
559
560
561#define VMSTATE_STRUCT_VARRAY_POINTER_KNOWN(_field, _state, _num, _version, _vmsd, _type) { \
562 .name = (stringify(_field)), \
563 .num = (_num), \
564 .version_id = (_version), \
565 .vmsd = &(_vmsd), \
566 .size = sizeof(_type), \
567 .flags = VMS_STRUCT|VMS_ARRAY|VMS_POINTER, \
568 .offset = offsetof(_state, _field), \
569}
570
571#define VMSTATE_STRUCT_VARRAY_POINTER_INT32(_field, _state, _field_num, _vmsd, _type) { \
572 .name = (stringify(_field)), \
573 .version_id = 0, \
574 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
575 .size = sizeof(_type), \
576 .vmsd = &(_vmsd), \
577 .flags = VMS_POINTER | VMS_VARRAY_INT32 | VMS_STRUCT, \
578 .offset = vmstate_offset_pointer(_state, _field, _type), \
579}
580
581#define VMSTATE_STRUCT_VARRAY_POINTER_UINT32(_field, _state, _field_num, _vmsd, _type) { \
582 .name = (stringify(_field)), \
583 .version_id = 0, \
584 .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\
585 .size = sizeof(_type), \
586 .vmsd = &(_vmsd), \
587 .flags = VMS_POINTER | VMS_VARRAY_INT32 | VMS_STRUCT, \
588 .offset = vmstate_offset_pointer(_state, _field, _type), \
589}
590
591#define VMSTATE_STRUCT_VARRAY_POINTER_UINT16(_field, _state, _field_num, _vmsd, _type) { \
592 .name = (stringify(_field)), \
593 .version_id = 0, \
594 .num_offset = vmstate_offset_value(_state, _field_num, uint16_t),\
595 .size = sizeof(_type), \
596 .vmsd = &(_vmsd), \
597 .flags = VMS_POINTER | VMS_VARRAY_UINT16 | VMS_STRUCT, \
598 .offset = vmstate_offset_pointer(_state, _field, _type), \
599}
600
601#define VMSTATE_STRUCT_VARRAY_INT32(_field, _state, _field_num, _version, _vmsd, _type) { \
602 .name = (stringify(_field)), \
603 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
604 .version_id = (_version), \
605 .vmsd = &(_vmsd), \
606 .size = sizeof(_type), \
607 .flags = VMS_STRUCT|VMS_VARRAY_INT32, \
608 .offset = vmstate_offset_varray(_state, _field, _type), \
609}
610
611#define VMSTATE_STRUCT_VARRAY_UINT32(_field, _state, _field_num, _version, _vmsd, _type) { \
612 .name = (stringify(_field)), \
613 .num_offset = vmstate_offset_value(_state, _field_num, uint32_t), \
614 .version_id = (_version), \
615 .vmsd = &(_vmsd), \
616 .size = sizeof(_type), \
617 .flags = VMS_STRUCT|VMS_VARRAY_UINT32, \
618 .offset = vmstate_offset_varray(_state, _field, _type), \
619}
620
621#define VMSTATE_STRUCT_VARRAY_ALLOC(_field, _state, _field_num, _version, _vmsd, _type) {\
622 .name = (stringify(_field)), \
623 .version_id = (_version), \
624 .vmsd = &(_vmsd), \
625 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
626 .size = sizeof(_type), \
627 .flags = VMS_STRUCT|VMS_VARRAY_INT32|VMS_ALLOC|VMS_POINTER, \
628 .offset = vmstate_offset_pointer(_state, _field, _type), \
629}
630
631#define VMSTATE_STATIC_BUFFER(_field, _state, _version, _test, _start, _size) { \
632 .name = (stringify(_field)), \
633 .version_id = (_version), \
634 .field_exists = (_test), \
635 .size = (_size - _start), \
636 .info = &vmstate_info_buffer, \
637 .flags = VMS_BUFFER, \
638 .offset = vmstate_offset_buffer(_state, _field) + _start, \
639}
640
641#define VMSTATE_VBUFFER_MULTIPLY(_field, _state, _version, _test, \
642 _field_size, _multiply) { \
643 .name = (stringify(_field)), \
644 .version_id = (_version), \
645 .field_exists = (_test), \
646 .size_offset = vmstate_offset_value(_state, _field_size, uint32_t),\
647 .size = (_multiply), \
648 .info = &vmstate_info_buffer, \
649 .flags = VMS_VBUFFER|VMS_POINTER|VMS_MULTIPLY, \
650 .offset = offsetof(_state, _field), \
651}
652
653#define VMSTATE_VBUFFER(_field, _state, _version, _test, _field_size) { \
654 .name = (stringify(_field)), \
655 .version_id = (_version), \
656 .field_exists = (_test), \
657 .size_offset = vmstate_offset_value(_state, _field_size, int32_t),\
658 .info = &vmstate_info_buffer, \
659 .flags = VMS_VBUFFER|VMS_POINTER, \
660 .offset = offsetof(_state, _field), \
661}
662
663#define VMSTATE_VBUFFER_UINT32(_field, _state, _version, _test, _field_size) { \
664 .name = (stringify(_field)), \
665 .version_id = (_version), \
666 .field_exists = (_test), \
667 .size_offset = vmstate_offset_value(_state, _field_size, uint32_t),\
668 .info = &vmstate_info_buffer, \
669 .flags = VMS_VBUFFER|VMS_POINTER, \
670 .offset = offsetof(_state, _field), \
671}
672
673#define VMSTATE_VBUFFER_ALLOC_UINT32(_field, _state, _version, \
674 _test, _field_size) { \
675 .name = (stringify(_field)), \
676 .version_id = (_version), \
677 .field_exists = (_test), \
678 .size_offset = vmstate_offset_value(_state, _field_size, uint32_t),\
679 .info = &vmstate_info_buffer, \
680 .flags = VMS_VBUFFER|VMS_POINTER|VMS_ALLOC, \
681 .offset = offsetof(_state, _field), \
682}
683
684#define VMSTATE_BUFFER_UNSAFE_INFO_TEST(_field, _state, _test, _version, _info, _size) { \
685 .name = (stringify(_field)), \
686 .version_id = (_version), \
687 .field_exists = (_test), \
688 .size = (_size), \
689 .info = &(_info), \
690 .flags = VMS_BUFFER, \
691 .offset = offsetof(_state, _field), \
692}
693
694#define VMSTATE_BUFFER_POINTER_UNSAFE(_field, _state, _version, _size) { \
695 .name = (stringify(_field)), \
696 .version_id = (_version), \
697 .size = (_size), \
698 .info = &vmstate_info_buffer, \
699 .flags = VMS_BUFFER|VMS_POINTER, \
700 .offset = offsetof(_state, _field), \
701}
702
703
704
705
706
707
708
709
710
711#define VMSTATE_WITH_TMP(_state, _tmp_type, _vmsd) { \
712 .name = "tmp", \
713 .size = sizeof(_tmp_type) + \
714 QEMU_BUILD_BUG_ON_ZERO(offsetof(_tmp_type, parent) != 0) + \
715 type_check_pointer(_state, \
716 typeof_field(_tmp_type, parent)), \
717 .vmsd = &(_vmsd), \
718 .info = &vmstate_info_tmp, \
719}
720
721#define VMSTATE_UNUSED_BUFFER(_test, _version, _size) { \
722 .name = "unused", \
723 .field_exists = (_test), \
724 .version_id = (_version), \
725 .size = (_size), \
726 .info = &vmstate_info_unused_buffer, \
727 .flags = VMS_BUFFER, \
728}
729
730
731#define VMSTATE_UNUSED_VARRAY_UINT32(_state, _test, _version, _field_num, _size) {\
732 .name = "unused", \
733 .field_exists = (_test), \
734 .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\
735 .version_id = (_version), \
736 .size = (_size), \
737 .info = &vmstate_info_unused_buffer, \
738 .flags = VMS_VARRAY_UINT32 | VMS_BUFFER, \
739}
740
741
742
743
744#define VMSTATE_BITMAP(_field, _state, _version, _field_size) { \
745 .name = (stringify(_field)), \
746 .version_id = (_version), \
747 .size_offset = vmstate_offset_value(_state, _field_size, int32_t),\
748 .info = &vmstate_info_bitmap, \
749 .flags = VMS_VBUFFER|VMS_POINTER, \
750 .offset = offsetof(_state, _field), \
751}
752
753
754
755
756
757
758
759
760
761#define VMSTATE_QTAILQ_V(_field, _state, _version, _vmsd, _type, _next) \
762{ \
763 .name = (stringify(_field)), \
764 .version_id = (_version), \
765 .vmsd = &(_vmsd), \
766 .size = sizeof(_type), \
767 .info = &vmstate_info_qtailq, \
768 .offset = offsetof(_state, _field), \
769 .start = offsetof(_type, _next), \
770}
771
772
773
774
775
776
777
778
779
780
781#define VMSTATE_GTREE_V(_field, _state, _version, _vmsd, \
782 _key_type, _val_type) \
783{ \
784 .name = (stringify(_field)), \
785 .version_id = (_version), \
786 .vmsd = (_vmsd), \
787 .info = &vmstate_info_gtree, \
788 .start = sizeof(_key_type), \
789 .size = sizeof(_val_type), \
790 .offset = offsetof(_state, _field), \
791}
792
793
794
795
796
797
798
799
800#define VMSTATE_GTREE_DIRECT_KEY_V(_field, _state, _version, _vmsd, _val_type) \
801{ \
802 .name = (stringify(_field)), \
803 .version_id = (_version), \
804 .vmsd = (_vmsd), \
805 .info = &vmstate_info_gtree, \
806 .start = 0, \
807 .size = sizeof(_val_type), \
808 .offset = offsetof(_state, _field), \
809}
810
811
812
813
814
815
816
817
818
819
820#define VMSTATE_QLIST_V(_field, _state, _version, _vmsd, _type, _next) \
821{ \
822 .name = (stringify(_field)), \
823 .version_id = (_version), \
824 .vmsd = &(_vmsd), \
825 .size = sizeof(_type), \
826 .info = &vmstate_info_qlist, \
827 .offset = offsetof(_state, _field), \
828 .start = offsetof(_type, _next), \
829}
830
831
832
833
834
835
836
837
838#define VMSTATE_SINGLE(_field, _state, _version, _info, _type) \
839 VMSTATE_SINGLE_TEST(_field, _state, NULL, _version, _info, _type)
840
841#define VMSTATE_VSTRUCT(_field, _state, _vmsd, _type, _struct_version)\
842 VMSTATE_VSTRUCT_TEST(_field, _state, NULL, 0, _vmsd, _type, _struct_version)
843
844#define VMSTATE_VSTRUCT_V(_field, _state, _version, _vmsd, _type, _struct_version) \
845 VMSTATE_VSTRUCT_TEST(_field, _state, NULL, _version, _vmsd, _type, \
846 _struct_version)
847
848#define VMSTATE_STRUCT(_field, _state, _version, _vmsd, _type) \
849 VMSTATE_STRUCT_TEST(_field, _state, NULL, _version, _vmsd, _type)
850
851#define VMSTATE_STRUCT_POINTER(_field, _state, _vmsd, _type) \
852 VMSTATE_STRUCT_POINTER_V(_field, _state, 0, _vmsd, _type)
853
854#define VMSTATE_STRUCT_POINTER_TEST(_field, _state, _test, _vmsd, _type) \
855 VMSTATE_STRUCT_POINTER_TEST_V(_field, _state, _test, 0, _vmsd, _type)
856
857#define VMSTATE_STRUCT_ARRAY(_field, _state, _num, _version, _vmsd, _type) \
858 VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, NULL, _version, \
859 _vmsd, _type)
860
861#define VMSTATE_STRUCT_2DARRAY(_field, _state, _n1, _n2, _version, \
862 _vmsd, _type) \
863 VMSTATE_STRUCT_2DARRAY_TEST(_field, _state, _n1, _n2, NULL, \
864 _version, _vmsd, _type)
865
866#define VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, _info, _size) \
867 VMSTATE_BUFFER_UNSAFE_INFO_TEST(_field, _state, NULL, _version, _info, \
868 _size)
869
870#define VMSTATE_BOOL_V(_f, _s, _v) \
871 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_bool, bool)
872
873#define VMSTATE_INT8_V(_f, _s, _v) \
874 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int8, int8_t)
875#define VMSTATE_INT16_V(_f, _s, _v) \
876 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int16, int16_t)
877#define VMSTATE_INT32_V(_f, _s, _v) \
878 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int32, int32_t)
879#define VMSTATE_INT64_V(_f, _s, _v) \
880 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int64, int64_t)
881
882#define VMSTATE_UINT8_V(_f, _s, _v) \
883 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint8, uint8_t)
884#define VMSTATE_UINT16_V(_f, _s, _v) \
885 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16, uint16_t)
886#define VMSTATE_UINT32_V(_f, _s, _v) \
887 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint32, uint32_t)
888#define VMSTATE_UINT64_V(_f, _s, _v) \
889 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint64, uint64_t)
890
891#ifdef CONFIG_LINUX
892
893#define VMSTATE_U8_V(_f, _s, _v) \
894 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint8, __u8)
895#define VMSTATE_U16_V(_f, _s, _v) \
896 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16, __u16)
897#define VMSTATE_U32_V(_f, _s, _v) \
898 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint32, __u32)
899#define VMSTATE_U64_V(_f, _s, _v) \
900 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint64, __u64)
901
902#endif
903
904#define VMSTATE_BOOL(_f, _s) \
905 VMSTATE_BOOL_V(_f, _s, 0)
906
907#define VMSTATE_INT8(_f, _s) \
908 VMSTATE_INT8_V(_f, _s, 0)
909#define VMSTATE_INT16(_f, _s) \
910 VMSTATE_INT16_V(_f, _s, 0)
911#define VMSTATE_INT32(_f, _s) \
912 VMSTATE_INT32_V(_f, _s, 0)
913#define VMSTATE_INT64(_f, _s) \
914 VMSTATE_INT64_V(_f, _s, 0)
915
916#define VMSTATE_UINT8(_f, _s) \
917 VMSTATE_UINT8_V(_f, _s, 0)
918#define VMSTATE_UINT16(_f, _s) \
919 VMSTATE_UINT16_V(_f, _s, 0)
920#define VMSTATE_UINT32(_f, _s) \
921 VMSTATE_UINT32_V(_f, _s, 0)
922#define VMSTATE_UINT64(_f, _s) \
923 VMSTATE_UINT64_V(_f, _s, 0)
924
925#ifdef CONFIG_LINUX
926
927#define VMSTATE_U8(_f, _s) \
928 VMSTATE_U8_V(_f, _s, 0)
929#define VMSTATE_U16(_f, _s) \
930 VMSTATE_U16_V(_f, _s, 0)
931#define VMSTATE_U32(_f, _s) \
932 VMSTATE_U32_V(_f, _s, 0)
933#define VMSTATE_U64(_f, _s) \
934 VMSTATE_U64_V(_f, _s, 0)
935
936#endif
937
938#define VMSTATE_UINT8_EQUAL(_f, _s, _err_hint) \
939 VMSTATE_SINGLE_FULL(_f, _s, 0, 0, \
940 vmstate_info_uint8_equal, uint8_t, _err_hint)
941
942#define VMSTATE_UINT16_EQUAL(_f, _s, _err_hint) \
943 VMSTATE_SINGLE_FULL(_f, _s, 0, 0, \
944 vmstate_info_uint16_equal, uint16_t, _err_hint)
945
946#define VMSTATE_UINT16_EQUAL_V(_f, _s, _v, _err_hint) \
947 VMSTATE_SINGLE_FULL(_f, _s, 0, _v, \
948 vmstate_info_uint16_equal, uint16_t, _err_hint)
949
950#define VMSTATE_INT32_EQUAL(_f, _s, _err_hint) \
951 VMSTATE_SINGLE_FULL(_f, _s, 0, 0, \
952 vmstate_info_int32_equal, int32_t, _err_hint)
953
954#define VMSTATE_UINT32_EQUAL_V(_f, _s, _v, _err_hint) \
955 VMSTATE_SINGLE_FULL(_f, _s, 0, _v, \
956 vmstate_info_uint32_equal, uint32_t, _err_hint)
957
958#define VMSTATE_UINT32_EQUAL(_f, _s, _err_hint) \
959 VMSTATE_UINT32_EQUAL_V(_f, _s, 0, _err_hint)
960
961#define VMSTATE_UINT64_EQUAL_V(_f, _s, _v, _err_hint) \
962 VMSTATE_SINGLE_FULL(_f, _s, 0, _v, \
963 vmstate_info_uint64_equal, uint64_t, _err_hint)
964
965#define VMSTATE_UINT64_EQUAL(_f, _s, _err_hint) \
966 VMSTATE_UINT64_EQUAL_V(_f, _s, 0, _err_hint)
967
968#define VMSTATE_INT32_POSITIVE_LE(_f, _s) \
969 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
970
971#define VMSTATE_BOOL_TEST(_f, _s, _t) \
972 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_bool, bool)
973
974#define VMSTATE_INT8_TEST(_f, _s, _t) \
975 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int8, int8_t)
976
977#define VMSTATE_INT16_TEST(_f, _s, _t) \
978 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int16, int16_t)
979
980#define VMSTATE_INT32_TEST(_f, _s, _t) \
981 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int32, int32_t)
982
983#define VMSTATE_INT64_TEST(_f, _s, _t) \
984 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int64, int64_t)
985
986#define VMSTATE_UINT8_TEST(_f, _s, _t) \
987 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint8, uint8_t)
988
989#define VMSTATE_UINT16_TEST(_f, _s, _t) \
990 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint16, uint16_t)
991
992#define VMSTATE_UINT32_TEST(_f, _s, _t) \
993 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint32, uint32_t)
994
995#define VMSTATE_UINT64_TEST(_f, _s, _t) \
996 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint64, uint64_t)
997
998
999#define VMSTATE_TIMER_PTR_TEST(_f, _s, _test) \
1000 VMSTATE_POINTER_TEST(_f, _s, _test, vmstate_info_timer, QEMUTimer *)
1001
1002#define VMSTATE_TIMER_PTR_V(_f, _s, _v) \
1003 VMSTATE_POINTER(_f, _s, _v, vmstate_info_timer, QEMUTimer *)
1004
1005#define VMSTATE_TIMER_PTR(_f, _s) \
1006 VMSTATE_TIMER_PTR_V(_f, _s, 0)
1007
1008#define VMSTATE_TIMER_PTR_ARRAY(_f, _s, _n) \
1009 VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer *)
1010
1011#define VMSTATE_TIMER_TEST(_f, _s, _test) \
1012 VMSTATE_SINGLE_TEST(_f, _s, _test, 0, vmstate_info_timer, QEMUTimer)
1013
1014#define VMSTATE_TIMER_V(_f, _s, _v) \
1015 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_timer, QEMUTimer)
1016
1017#define VMSTATE_TIMER(_f, _s) \
1018 VMSTATE_TIMER_V(_f, _s, 0)
1019
1020#define VMSTATE_TIMER_ARRAY(_f, _s, _n) \
1021 VMSTATE_ARRAY(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer)
1022
1023#define VMSTATE_BOOL_ARRAY_V(_f, _s, _n, _v) \
1024 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_bool, bool)
1025
1026#define VMSTATE_BOOL_ARRAY(_f, _s, _n) \
1027 VMSTATE_BOOL_ARRAY_V(_f, _s, _n, 0)
1028
1029#define VMSTATE_BOOL_SUB_ARRAY(_f, _s, _start, _num) \
1030 VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_bool, bool)
1031
1032#define VMSTATE_UINT16_ARRAY_V(_f, _s, _n, _v) \
1033 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint16, uint16_t)
1034
1035#define VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, _v) \
1036 VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint16, uint16_t)
1037
1038#define VMSTATE_UINT16_ARRAY(_f, _s, _n) \
1039 VMSTATE_UINT16_ARRAY_V(_f, _s, _n, 0)
1040
1041#define VMSTATE_UINT16_SUB_ARRAY(_f, _s, _start, _num) \
1042 VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint16, uint16_t)
1043
1044#define VMSTATE_UINT16_2DARRAY(_f, _s, _n1, _n2) \
1045 VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, 0)
1046
1047#define VMSTATE_UINT8_2DARRAY_V(_f, _s, _n1, _n2, _v) \
1048 VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint8, uint8_t)
1049
1050#define VMSTATE_UINT8_ARRAY_V(_f, _s, _n, _v) \
1051 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint8, uint8_t)
1052
1053#define VMSTATE_UINT8_ARRAY(_f, _s, _n) \
1054 VMSTATE_UINT8_ARRAY_V(_f, _s, _n, 0)
1055
1056#define VMSTATE_UINT8_SUB_ARRAY(_f, _s, _start, _num) \
1057 VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint8, uint8_t)
1058
1059#define VMSTATE_UINT8_2DARRAY(_f, _s, _n1, _n2) \
1060 VMSTATE_UINT8_2DARRAY_V(_f, _s, _n1, _n2, 0)
1061
1062#define VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v) \
1063 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint32, uint32_t)
1064
1065#define VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, _v) \
1066 VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint32, uint32_t)
1067
1068#define VMSTATE_UINT32_ARRAY(_f, _s, _n) \
1069 VMSTATE_UINT32_ARRAY_V(_f, _s, _n, 0)
1070
1071#define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num) \
1072 VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t)
1073
1074#define VMSTATE_UINT32_2DARRAY(_f, _s, _n1, _n2) \
1075 VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, 0)
1076
1077#define VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v) \
1078 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint64, uint64_t)
1079
1080#define VMSTATE_UINT64_ARRAY(_f, _s, _n) \
1081 VMSTATE_UINT64_ARRAY_V(_f, _s, _n, 0)
1082
1083#define VMSTATE_UINT64_SUB_ARRAY(_f, _s, _start, _num) \
1084 VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint64, uint64_t)
1085
1086#define VMSTATE_UINT64_2DARRAY(_f, _s, _n1, _n2) \
1087 VMSTATE_UINT64_2DARRAY_V(_f, _s, _n1, _n2, 0)
1088
1089#define VMSTATE_UINT64_2DARRAY_V(_f, _s, _n1, _n2, _v) \
1090 VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint64, uint64_t)
1091
1092#define VMSTATE_INT16_ARRAY_V(_f, _s, _n, _v) \
1093 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int16, int16_t)
1094
1095#define VMSTATE_INT16_ARRAY(_f, _s, _n) \
1096 VMSTATE_INT16_ARRAY_V(_f, _s, _n, 0)
1097
1098#define VMSTATE_INT32_ARRAY_V(_f, _s, _n, _v) \
1099 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int32, int32_t)
1100
1101#define VMSTATE_INT32_ARRAY(_f, _s, _n) \
1102 VMSTATE_INT32_ARRAY_V(_f, _s, _n, 0)
1103
1104#define VMSTATE_INT64_ARRAY_V(_f, _s, _n, _v) \
1105 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int64, int64_t)
1106
1107#define VMSTATE_INT64_ARRAY(_f, _s, _n) \
1108 VMSTATE_INT64_ARRAY_V(_f, _s, _n, 0)
1109
1110#define VMSTATE_CPUDOUBLE_ARRAY_V(_f, _s, _n, _v) \
1111 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_cpudouble, CPU_DoubleU)
1112
1113#define VMSTATE_CPUDOUBLE_ARRAY(_f, _s, _n) \
1114 VMSTATE_CPUDOUBLE_ARRAY_V(_f, _s, _n, 0)
1115
1116#define VMSTATE_BUFFER_V(_f, _s, _v) \
1117 VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))
1118
1119#define VMSTATE_BUFFER(_f, _s) \
1120 VMSTATE_BUFFER_V(_f, _s, 0)
1121
1122#define VMSTATE_PARTIAL_BUFFER(_f, _s, _size) \
1123 VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, 0, _size)
1124
1125#define VMSTATE_BUFFER_START_MIDDLE_V(_f, _s, _start, _v) \
1126 VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, _start, sizeof(typeof_field(_s, _f)))
1127
1128#define VMSTATE_BUFFER_START_MIDDLE(_f, _s, _start) \
1129 VMSTATE_BUFFER_START_MIDDLE_V(_f, _s, _start, 0)
1130
1131#define VMSTATE_PARTIAL_VBUFFER(_f, _s, _size) \
1132 VMSTATE_VBUFFER(_f, _s, 0, NULL, _size)
1133
1134#define VMSTATE_PARTIAL_VBUFFER_UINT32(_f, _s, _size) \
1135 VMSTATE_VBUFFER_UINT32(_f, _s, 0, NULL, _size)
1136
1137#define VMSTATE_BUFFER_TEST(_f, _s, _test) \
1138 VMSTATE_STATIC_BUFFER(_f, _s, 0, _test, 0, sizeof(typeof_field(_s, _f)))
1139
1140#define VMSTATE_BUFFER_UNSAFE(_field, _state, _version, _size) \
1141 VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, vmstate_info_buffer, _size)
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157#define VMSTATE_UNUSED_V(_v, _size) \
1158 VMSTATE_UNUSED_BUFFER(NULL, _v, _size)
1159
1160#define VMSTATE_UNUSED(_size) \
1161 VMSTATE_UNUSED_V(0, _size)
1162
1163#define VMSTATE_UNUSED_TEST(_test, _size) \
1164 VMSTATE_UNUSED_BUFFER(_test, 0, _size)
1165
1166#define VMSTATE_END_OF_LIST() \
1167 {}
1168
1169int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
1170 void *opaque, int version_id);
1171int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
1172 void *opaque, JSONWriter *vmdesc);
1173int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd,
1174 void *opaque, JSONWriter *vmdesc,
1175 int version_id);
1176
1177bool vmstate_save_needed(const VMStateDescription *vmsd, void *opaque);
1178
1179#define VMSTATE_INSTANCE_ID_ANY -1
1180
1181
1182int vmstate_register_with_alias_id(VMStateIf *obj, uint32_t instance_id,
1183 const VMStateDescription *vmsd,
1184 void *base, int alias_id,
1185 int required_for_version,
1186 Error **errp);
1187
1188
1189static inline int vmstate_register(VMStateIf *obj, int instance_id,
1190 const VMStateDescription *vmsd,
1191 void *opaque)
1192{
1193 return vmstate_register_with_alias_id(obj, instance_id, vmsd,
1194 opaque, -1, 0, NULL);
1195}
1196
1197void vmstate_unregister(VMStateIf *obj, const VMStateDescription *vmsd,
1198 void *opaque);
1199
1200void vmstate_register_ram(struct MemoryRegion *memory, DeviceState *dev);
1201void vmstate_unregister_ram(struct MemoryRegion *memory, DeviceState *dev);
1202void vmstate_register_ram_global(struct MemoryRegion *memory);
1203
1204bool vmstate_check_only_migratable(const VMStateDescription *vmsd);
1205
1206#endif
1207