From patchwork Fri May 4 10:54:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 156896 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1AE9FB6FAB for ; Fri, 4 May 2012 22:29:07 +1000 (EST) Received: from localhost ([::1]:38805 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQGCY-0007XZ-TW for incoming@patchwork.ozlabs.org; Fri, 04 May 2012 06:57:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQGAa-0004AI-51 for qemu-devel@nongnu.org; Fri, 04 May 2012 06:55:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SQGAR-00044p-6D for qemu-devel@nongnu.org; Fri, 04 May 2012 06:55:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27537) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQGAQ-00044K-U4 for qemu-devel@nongnu.org; Fri, 04 May 2012 06:55:19 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q44AtHod006459 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 4 May 2012 06:55:17 -0400 Received: from trasno.mitica (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q44At31Z021362; Fri, 4 May 2012 06:55:16 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Fri, 4 May 2012 12:54:36 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 09/35] vmstate: introduce float64 arrays X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela --- savevm.c | 25 +++++++++++++++++++++++++ vmstate.h | 4 ++++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/savevm.c b/savevm.c index a22278e..da8f234 100644 --- a/savevm.c +++ b/savevm.c @@ -1107,6 +1107,31 @@ const VMStateInfo vmstate_info_float32 = { .put = put_float32, }; +/* 64 bit float */ + +static int get_float64(QEMUFile *f, void *pv, size_t size) +{ + float64 *v = pv; + uint64_t u; + qemu_get_be64s(f, &u); + *v = make_float64(u); + return 0; +} + +static void put_float64(QEMUFile *f, void *pv, size_t size) +{ + float64 *v = pv; + uint64_t u; + u = float64_val(*v); + qemu_put_be64s(f, &u); +} + +const VMStateInfo vmstate_info_float64 = { + .name = "float64", + .get = get_float64, + .put = put_float64, +}; + /* timers */ static int get_timer(QEMUFile *f, void *pv, size_t size) diff --git a/vmstate.h b/vmstate.h index 135c5aa..d3fb88c 100644 --- a/vmstate.h +++ b/vmstate.h @@ -131,6 +131,7 @@ extern const VMStateInfo vmstate_info_uint32; extern const VMStateInfo vmstate_info_uint64; extern const VMStateInfo vmstate_info_float32; +extern const VMStateInfo vmstate_info_float64; extern const VMStateInfo vmstate_info_timer; extern const VMStateInfo vmstate_info_buffer; @@ -564,6 +565,9 @@ extern const VMStateDescription vmstate_cpu; #define VMSTATE_FLOAT32_ARRAY(_f, _s, _n) \ VMSTATE_ARRAY(_f, _s, _n, 0, vmstate_info_float32, float32) +#define VMSTATE_FLOAT64_ARRAY(_f, _s, _n) \ + VMSTATE_ARRAY(_f, _s, _n, 0, vmstate_info_float64, float64) + #define VMSTATE_BUFFER_V(_f, _s, _v) \ VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))