From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
Juan Quintela <quintela@redhat.com>,
patches@linaro.org
Subject: [Qemu-devel] [PATCH 3/3] target-arm: Correctly restore FPSCR
Date: Mon, 8 Apr 2013 15:43:50 +0100 [thread overview]
Message-ID: <1365432230-20028-4-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1365432230-20028-1-git-send-email-peter.maydell@linaro.org>
Use the helper functions to save and restore the FPSCR, so that
we correctly propagate rounding mode and flushing behaviour into
the float_status fields. This also allows us to stop saving the
vector length/stride fields separately.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target-arm/machine.c | 48 +++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 41 insertions(+), 7 deletions(-)
diff --git a/target-arm/machine.c b/target-arm/machine.c
index 2dd48d7..4dd057c 100644
--- a/target-arm/machine.c
+++ b/target-arm/machine.c
@@ -9,17 +9,51 @@ static bool vfp_needed(void *opaque)
return arm_feature(env, ARM_FEATURE_VFP);
}
+static int get_fpscr(QEMUFile *f, void *opaque, size_t size)
+{
+ ARMCPU *cpu = opaque;
+ CPUARMState *env = &cpu->env;
+ uint32_t val = qemu_get_be32(f);
+
+ vfp_set_fpscr(env, val);
+ return 0;
+}
+
+static void put_fpscr(QEMUFile *f, void *opaque, size_t size)
+{
+ ARMCPU *cpu = opaque;
+ CPUARMState *env = &cpu->env;
+
+ qemu_put_be32(f, vfp_get_fpscr(env));
+}
+
+static const VMStateInfo vmstate_fpscr = {
+ .name = "fpscr",
+ .get = get_fpscr,
+ .put = put_fpscr,
+};
+
static const VMStateDescription vmstate_vfp = {
.name = "cpu/vfp",
- .version_id = 1,
- .minimum_version_id = 1,
- .minimum_version_id_old = 1,
+ .version_id = 2,
+ .minimum_version_id = 2,
+ .minimum_version_id_old = 2,
.fields = (VMStateField[]) {
VMSTATE_FLOAT64_ARRAY(env.vfp.regs, ARMCPU, 32),
- VMSTATE_UINT32_ARRAY(env.vfp.xregs, ARMCPU, 16),
- /* TODO: Should use proper FPSCR access functions. */
- VMSTATE_INT32(env.vfp.vec_len, ARMCPU),
- VMSTATE_INT32(env.vfp.vec_stride, ARMCPU),
+ /* The xregs array is a little awkward because element 1 (FPSCR)
+ * requires a specific accessor, so we have to split it up in
+ * the vmstate:
+ */
+ VMSTATE_UINT32(env.vfp.xregs[0], ARMCPU),
+ VMSTATE_UINT32_SUB_ARRAY(env.vfp.xregs, ARMCPU, 2, 14),
+ {
+ .name = "fpscr",
+ .version_id = 0,
+ .size = sizeof(uint32_t),
+ .info = &vmstate_fpscr,
+ .flags = VMS_SINGLE,
+ .offset = 0,
+ },
VMSTATE_END_OF_LIST()
}
};
--
1.7.9.5
next prev parent reply other threads:[~2013-04-08 15:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-08 14:43 [Qemu-devel] [PATCH 0/3] target-arm: convert to VMState, fix bugs Peter Maydell
2013-04-08 14:43 ` [Qemu-devel] [PATCH 1/3] target-arm: port ARM CPU save/load to use VMState Peter Maydell
2013-04-08 14:43 ` [Qemu-devel] [PATCH 2/3] target-arm: Add some missing CPU state fields to VMState Peter Maydell
2013-04-08 14:43 ` Peter Maydell [this message]
2013-04-16 17:42 ` [Qemu-devel] [PATCH 0/3] target-arm: convert to VMState, fix bugs Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1365432230-20028-4-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=aliguori@us.ibm.com \
--cc=patches@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).