From patchwork Mon Aug 10 12:34:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 52227 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 56FC02152A for ; Mon, 10 Aug 2015 12:34:39 +0000 (UTC) Received: by labd1 with SMTP id d1sf17127278lab.0 for ; Mon, 10 Aug 2015 05:34:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=YYUUQ/OsuBBWiBcCfWd3cJlYtd8o5pzpVZJFc1U0J8E=; b=bryWzvokXAmW5f5MmwPYPE+L3JC0Zqaw65Tf+C7h7EgAaaz+8L8yQF5kh1pu4Q30PA GsnGbCAvkddXPxMshpUiTDOYJqDJ0NcY12JNuSNb8ge1YRbIfT5UfDZhJ9/QM/TamLMZ d7a9DjuzVM9Nsa7J9bnsyfRcSe4k7J4tIvApjW1pFPBJlw3NFdVYYCy0xhbAk2tV6C2j 0oKhcumWBA/UTN0MQQZLbYg8OrH3zpeeL9I+zuH12DlVFw7aI1D/fp4al+XzyST6iVIn LcNoHn/2MeboimQ9LqnapQkd+IupzwXQ7JZdwZY5fABrT7TWimqxoSFv+awvWOZke1lo 1xMg== X-Gm-Message-State: ALoCoQktQ7koeDiYfjNpntz88CBPDtfRpu8VOb7du0aTCdPWWXh1ZeFi4PfPguFkEUHny8dGe7Lq X-Received: by 10.180.216.12 with SMTP id om12mr3651390wic.1.1439210078272; Mon, 10 Aug 2015 05:34:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.136 with SMTP id w8ls665865lal.16.gmail; Mon, 10 Aug 2015 05:34:37 -0700 (PDT) X-Received: by 10.112.12.102 with SMTP id x6mr20077651lbb.80.1439210077854; Mon, 10 Aug 2015 05:34:37 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id r11si13976813lby.31.2015.08.10.05.34.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 05:34:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by lagz9 with SMTP id z9so52658490lag.3 for ; Mon, 10 Aug 2015 05:34:37 -0700 (PDT) X-Received: by 10.152.36.102 with SMTP id p6mr19793225laj.19.1439210077729; Mon, 10 Aug 2015 05:34:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1906837lba; Mon, 10 Aug 2015 05:34:36 -0700 (PDT) X-Received: by 10.140.20.214 with SMTP id 80mr37908274qgj.26.1439210076192; Mon, 10 Aug 2015 05:34:36 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id j3si2345384qkh.62.2015.08.10.05.34.35 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 10 Aug 2015 05:34:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZOmHg-0002sP-9a; Mon, 10 Aug 2015 13:34:32 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Blue Swirl , Mark Cave-Ayland , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [PATCH 1/4] vmstate: introduce CPU_DoubleU arrays Date: Mon, 10 Aug 2015 13:34:29 +0100 Message-Id: <1439210072-11028-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1439210072-11028-1-git-send-email-peter.maydell@linaro.org> References: <1439210072-11028-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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)