Skip to contentSkip to conversation

ARM: Misc ARM big-endian bug fixes

PATCH In review Fabien Chouteau 3 participants 8 messages Mar 19, 2013 – Mar 20, 2013

lore
Share & tools
lore
#0 lore raw

v2 cover ARM: Misc ARM big-endian bug fixes

v2:
- I drop the the CPSR.E/SCTLR.E/SCTLR.IE patch. The issue is still too complex for me to submit a good patch.

- Fix the GDB byte order for 64bits registers

Fabien Chouteau (3):
QAPI: Add ARMEB target-type
Add default config for armeb-softmmu
target-arm: Fix VFP register byte order in GDB remote

 default-configs/armeb-softmmu.mak |    3 +++
 qapi-schema.json                  |    9 +++++----
 target-arm/helper.c               |   23 ++++++++++++++++-------
 3 files changed, 24 insertions(+), 11 deletions(-)
 create mode 100644 default-configs/armeb-softmmu.mak
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/3 QAPI: Add ARMEB target-type

---
 qapi-schema.json |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
qapi-schema.json +5 -4
index 28b070f..0615715 100644
@@ -2993,10 +2993,11 @@
 # Since: 1.2.0
 ##
 { 'enum': 'TargetType',
-  'data': [ 'alpha', 'arm', 'cris', 'i386', 'lm32', 'm68k', 'microblazeel',
-            'microblaze', 'mips64el', 'mips64', 'mipsel', 'mips', 'or32',
-            'ppc64', 'ppcemb', 'ppc', 's390x', 'sh4eb', 'sh4', 'sparc64',
-            'sparc', 'unicore32', 'x86_64', 'xtensaeb', 'xtensa' ] }
+  'data': [ 'alpha', 'arm', 'armeb','cris', 'i386', 'lm32', 'm68k',
+            'microblazeel', 'microblaze', 'mips64el', 'mips64', 'mipsel',
+            'mips', 'or32', 'ppc64', 'ppcemb', 'ppc', 's390x', 'sh4eb',
+            'sh4', 'sparc64', 'sparc', 'unicore32', 'x86_64', 'xtensaeb',
+            'xtensa' ] }
 
 ##
 # @TargetInfo:
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 2/3 Add default config for armeb-softmmu

In reply to Fabien Chouteau

Just create one that includes arm-softmmu.mak.

---
 default-configs/armeb-softmmu.mak |    3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 default-configs/armeb-softmmu.mak
default-configs/armeb-softmmu.mak new file +3 -0
new file mode 100644
index 0000000..17670c0
@@ -0,0 +1,3 @@
+# Default configuration for armeb-softmmu
+
+include arm-softmmu.mak
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH v2 3/3 target-arm: Fix VFP register byte order in GDB remote

In reply to Fabien Chouteau
Quoted 1 line

From GDB Remote Serial Protocol doc:

"The bytes with the register are transmitted in target byte order."

---
 target-arm/helper.c |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
target-arm/helper.c +16 -7
index e97e1a5..1ba25e1 100644
@@ -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;
         }
     }
Signature · 1 line
1.7.9.5
#4 lore raw
In reply to Fabien Chouteau
Quoted 9 lines · Fabien Chouteau

v2:
- I drop the the CPSR.E/SCTLR.E/SCTLR.IE patch. The issue is still too complex for me to submit a good patch.

- Fix the GDB byte order for 64bits registers

Fabien Chouteau (3):
QAPI: Add ARMEB target-type
Add default config for armeb-softmmu

Hi Fabien. I'm afraid I don't want to take these two unless they come attached to an actual cpu and board model that use them. Otherwise they're really just half-a-feature, I think.

(As an aside, perhaps we should generate the list in qapi-schema.json automatically rather than hardcoding every target name? dunno)

Quoted 1 line

target-arm: Fix VFP register byte order in GDB remote

This one could go in (assuming it passes code review, I haven't looked too closely yet), because it's just fixing generic bigendian support.

thanks
-- PMM

#5 lore raw
Quoted 2 lines · Peter Maydell

(As an aside, perhaps we should generate the list in qapi-schema.json automatically rather than hardcoding every target name? dunno)

Definitely. It took me quite a while to find this when updating my spu target emulator a while back.

r~

#6 lore raw
In reply to Peter Maydell
Quoted 7 lines · Peter Maydell
Quoted 6 lines · Fabien Chouteau

v2:
- I drop the the CPSR.E/SCTLR.E/SCTLR.IE patch. The issue is still too complex for me to submit a good patch.

- Fix the GDB byte order for 64bits registers

Quoted 8 lines
Quoted 3 lines

Fabien Chouteau (3):
QAPI: Add ARMEB target-type
Add default config for armeb-softmmu

Hi Fabien. I'm afraid I don't want to take these two unless they come attached to an actual cpu and board model that use them. Otherwise they're really just half-a-feature, I think.

Well these patches are very small, but I think it can help people to get started. I submitted them because I thought it was a regression to not be able to build qemu-system-armeb.

Regards,

Signature · 1 line
Fabien Chouteau
#7 lore raw
Quoted 6 lines · Fabien Chouteau
Quoted 5 lines · Peter Maydell
Quoted 3 lines · Fabien Chouteau

Fabien Chouteau (3):
QAPI: Add ARMEB target-type
Add default config for armeb-softmmu

Quoted 8 lines
Quoted 4 lines

Hi Fabien. I'm afraid I don't want to take these two unless they come attached to an actual cpu and board model that use them. Otherwise they're really just half-a-feature, I think.

Well these patches are very small, but I think it can help people to get started. I submitted them because I thought it was a regression to not be able to build qemu-system-armeb.

No, we deliberately don't build qemu-system-armeb because we don't have any implemented machines which are big-endian ARM. When the first machine is added to QEMU the patch set adding that support should turn on building of qemu-system-armeb (which would then support just that one machine type).

thanks
-- PMM