[PATCH v2 1/2] target/arm: Fix big-endian handling of NEON gdb remote debugging

Vacha Bhavsar posted 2 patches 3 months, 3 weeks ago
Maintainers: Peter Maydell <peter.maydell@linaro.org>
[PATCH v2 1/2] target/arm: Fix big-endian handling of NEON gdb remote debugging
Posted by Vacha Bhavsar 3 months, 3 weeks ago
This patch adds big endian support for NEON GDB
remote debugging. It replaces the use of ldq_le_p() with the use of ldq_p().
Additionally, it checks the target endianness to ensure the most significant
bits are always in second element.

Signed-off-by: Vacha Bhavsar <vacha.bhavsar@oss.qualcomm.com>
---
Changes since v1:
- corrected styling error in if-else block
- corrected commit message to no longer refer to patch "series" notion

 target/arm/gdbstub64.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/target/arm/gdbstub64.c b/target/arm/gdbstub64.c
index 64ee9b3b56..c9d8012907 100644
--- a/target/arm/gdbstub64.c
+++ b/target/arm/gdbstub64.c
@@ -115,8 +115,15 @@ int aarch64_gdb_set_fpu_reg(CPUState *cs, uint8_t *buf, int reg)
         /* 128 bit FP register */
         {
             uint64_t *q = aa64_vfp_qreg(env, reg);
-            q[0] = ldq_le_p(buf);
-            q[1] = ldq_le_p(buf + 8);
+
+            if (target_big_endian()){
+                q[1] = ldq_p(buf);
+                q[0] = ldq_p(buf + 8);
+            } else{
+                q[0] = ldq_p(buf);
+                q[1] = ldq_p(buf + 8);
+            }
+
             return 16;
         }
     case 32:
-- 
2.34.1