char: use a fixed idx for child muxed chr
[qemu.git] / migration / vmstate.c
blobfc29acf74d74e98b2647995bfcf1e0fd16f25cdf
1 #include "qemu/osdep.h"
2 #include "qemu-common.h"
3 #include "migration/migration.h"
4 #include "migration/qemu-file.h"
5 #include "migration/vmstate.h"
6 #include "qemu/bitops.h"
7 #include "qemu/error-report.h"
8 #include "trace.h"
10 static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
11 void *opaque, QJSON *vmdesc);
12 static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
13 void *opaque);
15 static int vmstate_n_elems(void *opaque, VMStateField *field)
17 int n_elems = 1;
19 if (field->flags & VMS_ARRAY) {
20 n_elems = field->num;
21 } else if (field->flags & VMS_VARRAY_INT32) {
22 n_elems = *(int32_t *)(opaque+field->num_offset);
23 } else if (field->flags & VMS_VARRAY_UINT32) {
24 n_elems = *(uint32_t *)(opaque+field->num_offset);
25 } else if (field->flags & VMS_VARRAY_UINT16) {
26 n_elems = *(uint16_t *)(opaque+field->num_offset);
27 } else if (field->flags & VMS_VARRAY_UINT8) {
28 n_elems = *(uint8_t *)(opaque+field->num_offset);
31 if (field->flags & VMS_MULTIPLY_ELEMENTS) {
32 n_elems *= field->num;
35 trace_vmstate_n_elems(field->name, n_elems);
36 return n_elems;
39 static int vmstate_size(void *opaque, VMStateField *field)
41 int size = field->size;
43 if (field->flags & VMS_VBUFFER) {
44 size = *(int32_t *)(opaque+field->size_offset);
45 if (field->flags & VMS_MULTIPLY) {
46 size *= field->size;
50 return size;
53 static void *vmstate_base_addr(void *opaque, VMStateField *field, bool alloc)
55 void *base_addr = opaque + field->offset;
57 if (field->flags & VMS_POINTER) {
58 if (alloc && (field->flags & VMS_ALLOC)) {
59 gsize size = 0;
60 if (field->flags & VMS_VBUFFER) {
61 size = vmstate_size(opaque, field);
62 } else {
63 int n_elems = vmstate_n_elems(opaque, field);
64 if (n_elems) {
65 size = n_elems * field->size;
68 if (size) {
69 *((void **)base_addr + field->start) = g_malloc(size);
72 base_addr = *(void **)base_addr + field->start;
75 return base_addr;
78 int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
79 void *opaque, int version_id)
81 VMStateField *field = vmsd->fields;
82 int ret = 0;
84 trace_vmstate_load_state(vmsd->name, version_id);
85 if (version_id > vmsd->version_id) {
86 trace_vmstate_load_state_end(vmsd->name, "too new", -EINVAL);
87 return -EINVAL;
89 if (version_id < vmsd->minimum_version_id) {
90 if (vmsd->load_state_old &&
91 version_id >= vmsd->minimum_version_id_old) {
92 ret = vmsd->load_state_old(f, opaque, version_id);
93 trace_vmstate_load_state_end(vmsd->name, "old path", ret);
94 return ret;
96 trace_vmstate_load_state_end(vmsd->name, "too old", -EINVAL);
97 return -EINVAL;
99 if (vmsd->pre_load) {
100 int ret = vmsd->pre_load(opaque);
101 if (ret) {
102 return ret;
105 while (field->name) {
106 trace_vmstate_load_state_field(vmsd->name, field->name);
107 if ((field->field_exists &&
108 field->field_exists(opaque, version_id)) ||
109 (!field->field_exists &&
110 field->version_id <= version_id)) {
111 void *base_addr = vmstate_base_addr(opaque, field, true);
112 int i, n_elems = vmstate_n_elems(opaque, field);
113 int size = vmstate_size(opaque, field);
115 for (i = 0; i < n_elems; i++) {
116 void *addr = base_addr + size * i;
118 if (field->flags & VMS_ARRAY_OF_POINTER) {
119 addr = *(void **)addr;
121 if (field->flags & VMS_STRUCT) {
122 ret = vmstate_load_state(f, field->vmsd, addr,
123 field->vmsd->version_id);
124 } else {
125 ret = field->info->get(f, addr, size);
128 if (ret >= 0) {
129 ret = qemu_file_get_error(f);
131 if (ret < 0) {
132 qemu_file_set_error(f, ret);
133 trace_vmstate_load_field_error(field->name, ret);
134 return ret;
137 } else if (field->flags & VMS_MUST_EXIST) {
138 error_report("Input validation failed: %s/%s",
139 vmsd->name, field->name);
140 return -1;
142 field++;
144 ret = vmstate_subsection_load(f, vmsd, opaque);
145 if (ret != 0) {
146 return ret;
148 if (vmsd->post_load) {
149 ret = vmsd->post_load(opaque, version_id);
151 trace_vmstate_load_state_end(vmsd->name, "end", ret);
152 return ret;
155 static int vmfield_name_num(VMStateField *start, VMStateField *search)
157 VMStateField *field;
158 int found = 0;
160 for (field = start; field->name; field++) {
161 if (!strcmp(field->name, search->name)) {
162 if (field == search) {
163 return found;
165 found++;
169 return -1;
172 static bool vmfield_name_is_unique(VMStateField *start, VMStateField *search)
174 VMStateField *field;
175 int found = 0;
177 for (field = start; field->name; field++) {
178 if (!strcmp(field->name, search->name)) {
179 found++;
180 /* name found more than once, so it's not unique */
181 if (found > 1) {
182 return false;
187 return true;
190 static const char *vmfield_get_type_name(VMStateField *field)
192 const char *type = "unknown";
194 if (field->flags & VMS_STRUCT) {
195 type = "struct";
196 } else if (field->info->name) {
197 type = field->info->name;
200 return type;
203 static bool vmsd_can_compress(VMStateField *field)
205 if (field->field_exists) {
206 /* Dynamically existing fields mess up compression */
207 return false;
210 if (field->flags & VMS_STRUCT) {
211 VMStateField *sfield = field->vmsd->fields;
212 while (sfield->name) {
213 if (!vmsd_can_compress(sfield)) {
214 /* Child elements can't compress, so can't we */
215 return false;
217 sfield++;
220 if (field->vmsd->subsections) {
221 /* Subsections may come and go, better don't compress */
222 return false;
226 return true;
229 static void vmsd_desc_field_start(const VMStateDescription *vmsd, QJSON *vmdesc,
230 VMStateField *field, int i, int max)
232 char *name, *old_name;
233 bool is_array = max > 1;
234 bool can_compress = vmsd_can_compress(field);
236 if (!vmdesc) {
237 return;
240 name = g_strdup(field->name);
242 /* Field name is not unique, need to make it unique */
243 if (!vmfield_name_is_unique(vmsd->fields, field)) {
244 int num = vmfield_name_num(vmsd->fields, field);
245 old_name = name;
246 name = g_strdup_printf("%s[%d]", name, num);
247 g_free(old_name);
250 json_start_object(vmdesc, NULL);
251 json_prop_str(vmdesc, "name", name);
252 if (is_array) {
253 if (can_compress) {
254 json_prop_int(vmdesc, "array_len", max);
255 } else {
256 json_prop_int(vmdesc, "index", i);
259 json_prop_str(vmdesc, "type", vmfield_get_type_name(field));
261 if (field->flags & VMS_STRUCT) {
262 json_start_object(vmdesc, "struct");
265 g_free(name);
268 static void vmsd_desc_field_end(const VMStateDescription *vmsd, QJSON *vmdesc,
269 VMStateField *field, size_t size, int i)
271 if (!vmdesc) {
272 return;
275 if (field->flags & VMS_STRUCT) {
276 /* We printed a struct in between, close its child object */
277 json_end_object(vmdesc);
280 json_prop_int(vmdesc, "size", size);
281 json_end_object(vmdesc);
285 bool vmstate_save_needed(const VMStateDescription *vmsd, void *opaque)
287 if (vmsd->needed && !vmsd->needed(opaque)) {
288 /* optional section not needed */
289 return false;
291 return true;
295 void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
296 void *opaque, QJSON *vmdesc)
298 VMStateField *field = vmsd->fields;
300 if (vmsd->pre_save) {
301 vmsd->pre_save(opaque);
304 if (vmdesc) {
305 json_prop_str(vmdesc, "vmsd_name", vmsd->name);
306 json_prop_int(vmdesc, "version", vmsd->version_id);
307 json_start_array(vmdesc, "fields");
310 while (field->name) {
311 if (!field->field_exists ||
312 field->field_exists(opaque, vmsd->version_id)) {
313 void *base_addr = vmstate_base_addr(opaque, field, false);
314 int i, n_elems = vmstate_n_elems(opaque, field);
315 int size = vmstate_size(opaque, field);
316 int64_t old_offset, written_bytes;
317 QJSON *vmdesc_loop = vmdesc;
319 for (i = 0; i < n_elems; i++) {
320 void *addr = base_addr + size * i;
322 vmsd_desc_field_start(vmsd, vmdesc_loop, field, i, n_elems);
323 old_offset = qemu_ftell_fast(f);
325 if (field->flags & VMS_ARRAY_OF_POINTER) {
326 addr = *(void **)addr;
328 if (field->flags & VMS_STRUCT) {
329 vmstate_save_state(f, field->vmsd, addr, vmdesc_loop);
330 } else {
331 field->info->put(f, addr, size);
334 written_bytes = qemu_ftell_fast(f) - old_offset;
335 vmsd_desc_field_end(vmsd, vmdesc_loop, field, written_bytes, i);
337 /* Compressed arrays only care about the first element */
338 if (vmdesc_loop && vmsd_can_compress(field)) {
339 vmdesc_loop = NULL;
342 } else {
343 if (field->flags & VMS_MUST_EXIST) {
344 error_report("Output state validation failed: %s/%s",
345 vmsd->name, field->name);
346 assert(!(field->flags & VMS_MUST_EXIST));
349 field++;
352 if (vmdesc) {
353 json_end_array(vmdesc);
356 vmstate_subsection_save(f, vmsd, opaque, vmdesc);
359 static const VMStateDescription *
360 vmstate_get_subsection(const VMStateDescription **sub, char *idstr)
362 while (sub && *sub && (*sub)->needed) {
363 if (strcmp(idstr, (*sub)->name) == 0) {
364 return *sub;
366 sub++;
368 return NULL;
371 static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
372 void *opaque)
374 trace_vmstate_subsection_load(vmsd->name);
376 while (qemu_peek_byte(f, 0) == QEMU_VM_SUBSECTION) {
377 char idstr[256], *idstr_ret;
378 int ret;
379 uint8_t version_id, len, size;
380 const VMStateDescription *sub_vmsd;
382 len = qemu_peek_byte(f, 1);
383 if (len < strlen(vmsd->name) + 1) {
384 /* subsection name has be be "section_name/a" */
385 trace_vmstate_subsection_load_bad(vmsd->name, "(short)", "");
386 return 0;
388 size = qemu_peek_buffer(f, (uint8_t **)&idstr_ret, len, 2);
389 if (size != len) {
390 trace_vmstate_subsection_load_bad(vmsd->name, "(peek fail)", "");
391 return 0;
393 memcpy(idstr, idstr_ret, size);
394 idstr[size] = 0;
396 if (strncmp(vmsd->name, idstr, strlen(vmsd->name)) != 0) {
397 trace_vmstate_subsection_load_bad(vmsd->name, idstr, "(prefix)");
398 /* it doesn't have a valid subsection name */
399 return 0;
401 sub_vmsd = vmstate_get_subsection(vmsd->subsections, idstr);
402 if (sub_vmsd == NULL) {
403 trace_vmstate_subsection_load_bad(vmsd->name, idstr, "(lookup)");
404 return -ENOENT;
406 qemu_file_skip(f, 1); /* subsection */
407 qemu_file_skip(f, 1); /* len */
408 qemu_file_skip(f, len); /* idstr */
409 version_id = qemu_get_be32(f);
411 ret = vmstate_load_state(f, sub_vmsd, opaque, version_id);
412 if (ret) {
413 trace_vmstate_subsection_load_bad(vmsd->name, idstr, "(child)");
414 return ret;
418 trace_vmstate_subsection_load_good(vmsd->name);
419 return 0;
422 static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
423 void *opaque, QJSON *vmdesc)
425 const VMStateDescription **sub = vmsd->subsections;
426 bool subsection_found = false;
428 while (sub && *sub && (*sub)->needed) {
429 if ((*sub)->needed(opaque)) {
430 const VMStateDescription *vmsd = *sub;
431 uint8_t len;
433 if (vmdesc) {
434 /* Only create subsection array when we have any */
435 if (!subsection_found) {
436 json_start_array(vmdesc, "subsections");
437 subsection_found = true;
440 json_start_object(vmdesc, NULL);
443 qemu_put_byte(f, QEMU_VM_SUBSECTION);
444 len = strlen(vmsd->name);
445 qemu_put_byte(f, len);
446 qemu_put_buffer(f, (uint8_t *)vmsd->name, len);
447 qemu_put_be32(f, vmsd->version_id);
448 vmstate_save_state(f, vmsd, opaque, vmdesc);
450 if (vmdesc) {
451 json_end_object(vmdesc);
454 sub++;
457 if (vmdesc && subsection_found) {
458 json_end_array(vmdesc);
462 /* bool */
464 static int get_bool(QEMUFile *f, void *pv, size_t size)
466 bool *v = pv;
467 *v = qemu_get_byte(f);
468 return 0;
471 static void put_bool(QEMUFile *f, void *pv, size_t size)
473 bool *v = pv;
474 qemu_put_byte(f, *v);
477 const VMStateInfo vmstate_info_bool = {
478 .name = "bool",
479 .get = get_bool,
480 .put = put_bool,
483 /* 8 bit int */
485 static int get_int8(QEMUFile *f, void *pv, size_t size)
487 int8_t *v = pv;
488 qemu_get_s8s(f, v);
489 return 0;
492 static void put_int8(QEMUFile *f, void *pv, size_t size)
494 int8_t *v = pv;
495 qemu_put_s8s(f, v);
498 const VMStateInfo vmstate_info_int8 = {
499 .name = "int8",
500 .get = get_int8,
501 .put = put_int8,
504 /* 16 bit int */
506 static int get_int16(QEMUFile *f, void *pv, size_t size)
508 int16_t *v = pv;
509 qemu_get_sbe16s(f, v);
510 return 0;
513 static void put_int16(QEMUFile *f, void *pv, size_t size)
515 int16_t *v = pv;
516 qemu_put_sbe16s(f, v);
519 const VMStateInfo vmstate_info_int16 = {
520 .name = "int16",
521 .get = get_int16,
522 .put = put_int16,
525 /* 32 bit int */
527 static int get_int32(QEMUFile *f, void *pv, size_t size)
529 int32_t *v = pv;
530 qemu_get_sbe32s(f, v);
531 return 0;
534 static void put_int32(QEMUFile *f, void *pv, size_t size)
536 int32_t *v = pv;
537 qemu_put_sbe32s(f, v);
540 const VMStateInfo vmstate_info_int32 = {
541 .name = "int32",
542 .get = get_int32,
543 .put = put_int32,
546 /* 32 bit int. See that the received value is the same than the one
547 in the field */
549 static int get_int32_equal(QEMUFile *f, void *pv, size_t size)
551 int32_t *v = pv;
552 int32_t v2;
553 qemu_get_sbe32s(f, &v2);
555 if (*v == v2) {
556 return 0;
558 return -EINVAL;
561 const VMStateInfo vmstate_info_int32_equal = {
562 .name = "int32 equal",
563 .get = get_int32_equal,
564 .put = put_int32,
567 /* 32 bit int. Check that the received value is non-negative
568 * and less than or equal to the one in the field.
571 static int get_int32_le(QEMUFile *f, void *pv, size_t size)
573 int32_t *cur = pv;
574 int32_t loaded;
575 qemu_get_sbe32s(f, &loaded);
577 if (loaded >= 0 && loaded <= *cur) {
578 *cur = loaded;
579 return 0;
581 return -EINVAL;
584 const VMStateInfo vmstate_info_int32_le = {
585 .name = "int32 le",
586 .get = get_int32_le,
587 .put = put_int32,
590 /* 64 bit int */
592 static int get_int64(QEMUFile *f, void *pv, size_t size)
594 int64_t *v = pv;
595 qemu_get_sbe64s(f, v);
596 return 0;
599 static void put_int64(QEMUFile *f, void *pv, size_t size)
601 int64_t *v = pv;
602 qemu_put_sbe64s(f, v);
605 const VMStateInfo vmstate_info_int64 = {
606 .name = "int64",
607 .get = get_int64,
608 .put = put_int64,
611 /* 8 bit unsigned int */
613 static int get_uint8(QEMUFile *f, void *pv, size_t size)
615 uint8_t *v = pv;
616 qemu_get_8s(f, v);
617 return 0;
620 static void put_uint8(QEMUFile *f, void *pv, size_t size)
622 uint8_t *v = pv;
623 qemu_put_8s(f, v);
626 const VMStateInfo vmstate_info_uint8 = {
627 .name = "uint8",
628 .get = get_uint8,
629 .put = put_uint8,
632 /* 16 bit unsigned int */
634 static int get_uint16(QEMUFile *f, void *pv, size_t size)
636 uint16_t *v = pv;
637 qemu_get_be16s(f, v);
638 return 0;
641 static void put_uint16(QEMUFile *f, void *pv, size_t size)
643 uint16_t *v = pv;
644 qemu_put_be16s(f, v);
647 const VMStateInfo vmstate_info_uint16 = {
648 .name = "uint16",
649 .get = get_uint16,
650 .put = put_uint16,
653 /* 32 bit unsigned int */
655 static int get_uint32(QEMUFile *f, void *pv, size_t size)
657 uint32_t *v = pv;
658 qemu_get_be32s(f, v);
659 return 0;
662 static void put_uint32(QEMUFile *f, void *pv, size_t size)
664 uint32_t *v = pv;
665 qemu_put_be32s(f, v);
668 const VMStateInfo vmstate_info_uint32 = {
669 .name = "uint32",
670 .get = get_uint32,
671 .put = put_uint32,
674 /* 32 bit uint. See that the received value is the same than the one
675 in the field */
677 static int get_uint32_equal(QEMUFile *f, void *pv, size_t size)
679 uint32_t *v = pv;
680 uint32_t v2;
681 qemu_get_be32s(f, &v2);
683 if (*v == v2) {
684 return 0;
686 return -EINVAL;
689 const VMStateInfo vmstate_info_uint32_equal = {
690 .name = "uint32 equal",
691 .get = get_uint32_equal,
692 .put = put_uint32,
695 /* 64 bit unsigned int */
697 static int get_uint64(QEMUFile *f, void *pv, size_t size)
699 uint64_t *v = pv;
700 qemu_get_be64s(f, v);
701 return 0;
704 static void put_uint64(QEMUFile *f, void *pv, size_t size)
706 uint64_t *v = pv;
707 qemu_put_be64s(f, v);
710 const VMStateInfo vmstate_info_uint64 = {
711 .name = "uint64",
712 .get = get_uint64,
713 .put = put_uint64,
716 /* 64 bit unsigned int. See that the received value is the same than the one
717 in the field */
719 static int get_uint64_equal(QEMUFile *f, void *pv, size_t size)
721 uint64_t *v = pv;
722 uint64_t v2;
723 qemu_get_be64s(f, &v2);
725 if (*v == v2) {
726 return 0;
728 return -EINVAL;
731 const VMStateInfo vmstate_info_uint64_equal = {
732 .name = "int64 equal",
733 .get = get_uint64_equal,
734 .put = put_uint64,
737 /* 8 bit int. See that the received value is the same than the one
738 in the field */
740 static int get_uint8_equal(QEMUFile *f, void *pv, size_t size)
742 uint8_t *v = pv;
743 uint8_t v2;
744 qemu_get_8s(f, &v2);
746 if (*v == v2) {
747 return 0;
749 return -EINVAL;
752 const VMStateInfo vmstate_info_uint8_equal = {
753 .name = "uint8 equal",
754 .get = get_uint8_equal,
755 .put = put_uint8,
758 /* 16 bit unsigned int int. See that the received value is the same than the one
759 in the field */
761 static int get_uint16_equal(QEMUFile *f, void *pv, size_t size)
763 uint16_t *v = pv;
764 uint16_t v2;
765 qemu_get_be16s(f, &v2);
767 if (*v == v2) {
768 return 0;
770 return -EINVAL;
773 const VMStateInfo vmstate_info_uint16_equal = {
774 .name = "uint16 equal",
775 .get = get_uint16_equal,
776 .put = put_uint16,
779 /* floating point */
781 static int get_float64(QEMUFile *f, void *pv, size_t size)
783 float64 *v = pv;
785 *v = make_float64(qemu_get_be64(f));
786 return 0;
789 static void put_float64(QEMUFile *f, void *pv, size_t size)
791 uint64_t *v = pv;
793 qemu_put_be64(f, float64_val(*v));
796 const VMStateInfo vmstate_info_float64 = {
797 .name = "float64",
798 .get = get_float64,
799 .put = put_float64,
802 /* CPU_DoubleU type */
804 static int get_cpudouble(QEMUFile *f, void *pv, size_t size)
806 CPU_DoubleU *v = pv;
807 qemu_get_be32s(f, &v->l.upper);
808 qemu_get_be32s(f, &v->l.lower);
809 return 0;
812 static void put_cpudouble(QEMUFile *f, void *pv, size_t size)
814 CPU_DoubleU *v = pv;
815 qemu_put_be32s(f, &v->l.upper);
816 qemu_put_be32s(f, &v->l.lower);
819 const VMStateInfo vmstate_info_cpudouble = {
820 .name = "CPU_Double_U",
821 .get = get_cpudouble,
822 .put = put_cpudouble,
825 /* uint8_t buffers */
827 static int get_buffer(QEMUFile *f, void *pv, size_t size)
829 uint8_t *v = pv;
830 qemu_get_buffer(f, v, size);
831 return 0;
834 static void put_buffer(QEMUFile *f, void *pv, size_t size)
836 uint8_t *v = pv;
837 qemu_put_buffer(f, v, size);
840 const VMStateInfo vmstate_info_buffer = {
841 .name = "buffer",
842 .get = get_buffer,
843 .put = put_buffer,
846 /* unused buffers: space that was used for some fields that are
847 not useful anymore */
849 static int get_unused_buffer(QEMUFile *f, void *pv, size_t size)
851 uint8_t buf[1024];
852 int block_len;
854 while (size > 0) {
855 block_len = MIN(sizeof(buf), size);
856 size -= block_len;
857 qemu_get_buffer(f, buf, block_len);
859 return 0;
862 static void put_unused_buffer(QEMUFile *f, void *pv, size_t size)
864 static const uint8_t buf[1024];
865 int block_len;
867 while (size > 0) {
868 block_len = MIN(sizeof(buf), size);
869 size -= block_len;
870 qemu_put_buffer(f, buf, block_len);
874 const VMStateInfo vmstate_info_unused_buffer = {
875 .name = "unused_buffer",
876 .get = get_unused_buffer,
877 .put = put_unused_buffer,
880 /* bitmaps (as defined by bitmap.h). Note that size here is the size
881 * of the bitmap in bits. The on-the-wire format of a bitmap is 64
882 * bit words with the bits in big endian order. The in-memory format
883 * is an array of 'unsigned long', which may be either 32 or 64 bits.
885 /* This is the number of 64 bit words sent over the wire */
886 #define BITS_TO_U64S(nr) DIV_ROUND_UP(nr, 64)
887 static int get_bitmap(QEMUFile *f, void *pv, size_t size)
889 unsigned long *bmp = pv;
890 int i, idx = 0;
891 for (i = 0; i < BITS_TO_U64S(size); i++) {
892 uint64_t w = qemu_get_be64(f);
893 bmp[idx++] = w;
894 if (sizeof(unsigned long) == 4 && idx < BITS_TO_LONGS(size)) {
895 bmp[idx++] = w >> 32;
898 return 0;
901 static void put_bitmap(QEMUFile *f, void *pv, size_t size)
903 unsigned long *bmp = pv;
904 int i, idx = 0;
905 for (i = 0; i < BITS_TO_U64S(size); i++) {
906 uint64_t w = bmp[idx++];
907 if (sizeof(unsigned long) == 4 && idx < BITS_TO_LONGS(size)) {
908 w |= ((uint64_t)bmp[idx++]) << 32;
910 qemu_put_be64(f, w);
914 const VMStateInfo vmstate_info_bitmap = {
915 .name = "bitmap",
916 .get = get_bitmap,
917 .put = put_bitmap,