From: Fabien Chouteau <chouteau@adacore.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, paul@codesourcery.com, afaerber@suse.de
Subject: [Qemu-devel] [PATCH V2 3/3] target-arm: Fix VFP register byte order in GDB remote
Date: Tue, 19 Mar 2013 12:21:27 +0100 [thread overview]
Message-ID: <1363692087-28432-4-git-send-email-chouteau@adacore.com> (raw)
In-Reply-To: <1363692087-28432-1-git-send-email-chouteau@adacore.com>
>From GDB Remote Serial Protocol doc:
"The bytes with the register are transmitted in target byte order."
Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
---
target-arm/helper.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/target-arm/helper.c b/target-arm/helper.c
index e97e1a5..1ba25e1 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -16,18 +16,22 @@ static int vfp_gdb_get_reg(CPUARMState *env, uint8_t *buf, int reg)
{
int nregs;
- /* VFP data registers are always little-endian. */
nregs = arm_feature(env, ARM_FEATURE_VFP3) ? 32 : 16;
if (reg < nregs) {
- stfq_le_p(buf, env->vfp.regs[reg]);
+ stfq_p(buf, env->vfp.regs[reg]);
return 8;
}
if (arm_feature(env, ARM_FEATURE_NEON)) {
/* Aliases for Q regs. */
nregs += 16;
if (reg < nregs) {
- stfq_le_p(buf, env->vfp.regs[(reg - 32) * 2]);
- stfq_le_p(buf + 8, env->vfp.regs[(reg - 32) * 2 + 1]);
+#ifdef TARGET_WORDS_BIGENDIAN
+ stfq_p(buf, env->vfp.regs[(reg - 32) * 2 + 1]);
+ stfq_p(buf + 8, env->vfp.regs[(reg - 32) * 2]);
+#else
+ stfq_p(buf, env->vfp.regs[(reg - 32) * 2]);
+ stfq_p(buf + 8, env->vfp.regs[(reg - 32) * 2 + 1]);
+#endif /* TARGET_WORDS_BIGENDIAN */
return 16;
}
}
@@ -45,14 +49,19 @@ static int vfp_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg)
nregs = arm_feature(env, ARM_FEATURE_VFP3) ? 32 : 16;
if (reg < nregs) {
- env->vfp.regs[reg] = ldfq_le_p(buf);
+ env->vfp.regs[reg] = ldfq_p(buf);
return 8;
}
if (arm_feature(env, ARM_FEATURE_NEON)) {
nregs += 16;
if (reg < nregs) {
- env->vfp.regs[(reg - 32) * 2] = ldfq_le_p(buf);
- env->vfp.regs[(reg - 32) * 2 + 1] = ldfq_le_p(buf + 8);
+#ifdef TARGET_WORDS_BIGENDIAN
+ env->vfp.regs[(reg - 32) * 2 + 1] = ldfq_p(buf);
+ env->vfp.regs[(reg - 32) * 2] = ldfq_p(buf + 8);
+#else
+ env->vfp.regs[(reg - 32) * 2] = ldfq_p(buf);
+ env->vfp.regs[(reg - 32) * 2 + 1] = ldfq_p(buf + 8);
+#endif /* TARGET_WORDS_BIGENDIAN */
return 16;
}
}
--
1.7.9.5
next prev parent reply other threads:[~2013-03-19 11:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-19 11:21 [Qemu-devel] [PATCH V2 0/3] ARM: Misc ARM big-endian bug fixes Fabien Chouteau
2013-03-19 11:21 ` [Qemu-devel] [PATCH V2 1/3] QAPI: Add ARMEB target-type Fabien Chouteau
2013-03-19 11:21 ` [Qemu-devel] [PATCH V2 2/3] Add default config for armeb-softmmu Fabien Chouteau
2013-03-19 11:21 ` Fabien Chouteau [this message]
2013-03-19 11:30 ` [Qemu-devel] [PATCH V2 0/3] ARM: Misc ARM big-endian bug fixes Peter Maydell
2013-03-19 18:25 ` Richard Henderson
2013-03-20 9:28 ` Fabien Chouteau
2013-03-20 10:53 ` 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=1363692087-28432-4-git-send-email-chouteau@adacore.com \
--to=chouteau@adacore.com \
--cc=afaerber@suse.de \
--cc=paul@codesourcery.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).