From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46011) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOmHu-0007sZ-54 for qemu-devel@nongnu.org; Mon, 10 Aug 2015 08:34:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZOmHp-0005Ek-Kx for qemu-devel@nongnu.org; Mon, 10 Aug 2015 08:34:46 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOmHp-0005Aj-DP for qemu-devel@nongnu.org; Mon, 10 Aug 2015 08:34:41 -0400 From: Peter Maydell Date: Mon, 10 Aug 2015 13:34:29 +0100 Message-Id: <1439210072-11028-2-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1439210072-11028-1-git-send-email-peter.maydell@linaro.org> References: <1439210072-11028-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 1/4] vmstate: introduce CPU_DoubleU arrays List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Blue Swirl , Mark Cave-Ayland , =?UTF-8?q?Andreas=20F=C3=A4rber?= , patches@linaro.org From: Juan Quintela Add vmstate support for migrating arrays of CPU_DoubleU via VMSTATE_CPUDOUBLE_ARRAY. Signed-off-by: Juan Quintela [PMM: rebased, since files have all moved since 2012; added VMSTATE_CPUDOUBLE_ARRAY_V for consistency with FLOAT64] Signed-off-by: Peter Maydell --- include/migration/vmstate.h | 7 +++++++ migration/vmstate.c | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 2e5a97d..a234d44 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -154,6 +154,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; @@ -769,6 +770,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))) diff --git a/migration/vmstate.c b/migration/vmstate.c index e8ccf22..f70fe59 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -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) -- 1.9.1