Skip to content

Commit

Permalink
vmstate: introduce CPU_DoubleU arrays
Browse files Browse the repository at this point in the history
Add vmstate support for migrating arrays of CPU_DoubleU via
VMSTATE_CPUDOUBLE_ARRAY.

Signed-off-by: Juan Quintela <quintela@redhat.com>
[PMM: rebased, since files have all moved since 2012;
 added VMSTATE_CPUDOUBLE_ARRAY_V for consistency with FLOAT64]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  • Loading branch information
Juan Quintela authored and mcayland committed Jan 16, 2016
1 parent 5a57acb commit 5517474
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/migration/vmstate.h
Expand Up @@ -156,6 +156,7 @@ extern const VMStateInfo vmstate_info_uint32;
extern const VMStateInfo vmstate_info_uint64;

extern const VMStateInfo vmstate_info_float64;
extern const VMStateInfo vmstate_info_cpudouble;

extern const VMStateInfo vmstate_info_timer;
extern const VMStateInfo vmstate_info_buffer;
Expand Down Expand Up @@ -781,6 +782,12 @@ extern const VMStateInfo vmstate_info_bitmap;
#define VMSTATE_FLOAT64_ARRAY(_f, _s, _n) \
VMSTATE_FLOAT64_ARRAY_V(_f, _s, _n, 0)

#define VMSTATE_CPUDOUBLE_ARRAY_V(_f, _s, _n, _v) \
VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_cpudouble, CPU_DoubleU)

#define VMSTATE_CPUDOUBLE_ARRAY(_f, _s, _n) \
VMSTATE_CPUDOUBLE_ARRAY_V(_f, _s, _n, 0)

#define VMSTATE_BUFFER_V(_f, _s, _v) \
VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))

Expand Down
23 changes: 23 additions & 0 deletions migration/vmstate.c
Expand Up @@ -794,6 +794,29 @@ const VMStateInfo vmstate_info_float64 = {
.put = put_float64,
};

/* CPU_DoubleU type */

static int get_cpudouble(QEMUFile *f, void *pv, size_t size)
{
CPU_DoubleU *v = pv;
qemu_get_be32s(f, &v->l.upper);
qemu_get_be32s(f, &v->l.lower);
return 0;
}

static void put_cpudouble(QEMUFile *f, void *pv, size_t size)
{
CPU_DoubleU *v = pv;
qemu_put_be32s(f, &v->l.upper);
qemu_put_be32s(f, &v->l.lower);
}

const VMStateInfo vmstate_info_cpudouble = {
.name = "CPU_Double_U",
.get = get_cpudouble,
.put = put_cpudouble,
};

/* uint8_t buffers */

static int get_buffer(QEMUFile *f, void *pv, size_t size)
Expand Down

0 comments on commit 5517474

Please sign in to comment.