render / rpms / qemu

Forked from rpms/qemu 10 months ago
Clone

Blame 0017-target-ppc-gdbstub-fix-spe-registers-for-little-endi.patch

7d975d
From: Greg Kurz <gkurz@linux.vnet.ibm.com>
7d975d
Date: Fri, 15 Jan 2016 16:00:44 +0100
7d975d
Subject: [PATCH] target-ppc: gdbstub: fix spe registers for little-endian
7d975d
 guests
7d975d
7d975d
Let's reuse the ppc_maybe_bswap_register() helper, like we already do
7d975d
with the general registers.
7d975d
7d975d
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
7d975d
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7d975d
(cherry picked from commit 95f5b540abd964ac3bc9c63434d07681a5a175eb)
7d975d
---
7d975d
 target-ppc/translate_init.c | 11 ++++++++++-
7d975d
 1 file changed, 10 insertions(+), 1 deletion(-)
7d975d
7d975d
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
7d975d
index 80d53e4..5ea168c 100644
7d975d
--- a/target-ppc/translate_init.c
7d975d
+++ b/target-ppc/translate_init.c
7d975d
@@ -8849,6 +8849,7 @@ static int gdb_get_spe_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
7d975d
     if (n < 32) {
7d975d
 #if defined(TARGET_PPC64)
7d975d
         stl_p(mem_buf, env->gpr[n] >> 32);
7d975d
+        ppc_maybe_bswap_register(env, mem_buf, 4);
7d975d
 #else
7d975d
         stl_p(mem_buf, env->gprh[n]);
7d975d
 #endif
7d975d
@@ -8856,10 +8857,12 @@ static int gdb_get_spe_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
7d975d
     }
7d975d
     if (n == 32) {
7d975d
         stq_p(mem_buf, env->spe_acc);
7d975d
+        ppc_maybe_bswap_register(env, mem_buf, 8);
7d975d
         return 8;
7d975d
     }
7d975d
     if (n == 33) {
7d975d
         stl_p(mem_buf, env->spe_fscr);
7d975d
+        ppc_maybe_bswap_register(env, mem_buf, 4);
7d975d
         return 4;
7d975d
     }
7d975d
     return 0;
7d975d
@@ -8870,7 +8873,11 @@ static int gdb_set_spe_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
7d975d
     if (n < 32) {
7d975d
 #if defined(TARGET_PPC64)
7d975d
         target_ulong lo = (uint32_t)env->gpr[n];
7d975d
-        target_ulong hi = (target_ulong)ldl_p(mem_buf) << 32;
7d975d
+        target_ulong hi;
7d975d
+
7d975d
+        ppc_maybe_bswap_register(env, mem_buf, 4);
7d975d
+
7d975d
+        hi = (target_ulong)ldl_p(mem_buf) << 32;
7d975d
         env->gpr[n] = lo | hi;
7d975d
 #else
7d975d
         env->gprh[n] = ldl_p(mem_buf);
7d975d
@@ -8878,10 +8885,12 @@ static int gdb_set_spe_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
7d975d
         return 4;
7d975d
     }
7d975d
     if (n == 32) {
7d975d
+        ppc_maybe_bswap_register(env, mem_buf, 8);
7d975d
         env->spe_acc = ldq_p(mem_buf);
7d975d
         return 8;
7d975d
     }
7d975d
     if (n == 33) {
7d975d
+        ppc_maybe_bswap_register(env, mem_buf, 4);
7d975d
         env->spe_fscr = ldl_p(mem_buf);
7d975d
         return 4;
7d975d
     }