Skip to contentSkip to conversation

target-ppc: gdbstub: Add VSX support

PATCH In review Anton Blanchard 2 participants 4 messages Mar 24, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-ppc: gdbstub: Add VSX support

Add the XML and functions to get and set VSX registers.

---
 configure                   |  6 +++---
 gdb-xml/power-vsx.xml       | 44 ++++++++++++++++++++++++++++++++++++++++++++
 target-ppc/translate_init.c | 22 ++++++++++++++++++++++
 3 files changed, 69 insertions(+), 3 deletions(-)
 create mode 100644 gdb-xml/power-vsx.xml
configure +3 -3
index 589798e..235b3d2 100755
@@ -5182,20 +5182,20 @@ case "$target_name" in
   ppc64)
     TARGET_BASE_ARCH=ppc
     TARGET_ABI_DIR=ppc
-    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
+    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
   ;;
   ppc64le)
     TARGET_ARCH=ppc64
     TARGET_BASE_ARCH=ppc
     TARGET_ABI_DIR=ppc
-    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
+    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
   ;;
   ppc64abi32)
     TARGET_ARCH=ppc64
     TARGET_BASE_ARCH=ppc
     TARGET_ABI_DIR=ppc
     echo "TARGET_ABI32=y" >> $config_target_mak
-    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
+    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
   ;;
   sh4|sh4eb)
     TARGET_ARCH=sh4
gdb-xml/power-vsx.xml new file +44 -0

44 lines not on this page · raw message

target-ppc/translate_init.c +22 -0
index d74f4f0..efde425 100644
@@ -8870,6 +8870,24 @@ static int gdb_set_spe_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
     return 0;
 }
 
+static int gdb_get_vsx_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
+{
+    if (n < 32) {
+        stq_p(mem_buf, env->vsr[n]);
+        return 8;
+    }
+    return 0;
+}
+
+static int gdb_set_vsx_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
+{
+    if (n < 32) {
+        env->vsr[n] = ldq_p(mem_buf);
+        return 8;
+    }
+    return 0;
+}
+
 static int ppc_fixup_cpu(PowerPCCPU *cpu)
 {
     CPUPPCState *env = &cpu->env;
@@ -8967,6 +8985,10 @@ static void ppc_cpu_realizefn(DeviceState *dev, Error **errp)
         gdb_register_coprocessor(cs, gdb_get_spe_reg, gdb_set_spe_reg,
                                  34, "power-spe.xml", 0);
     }
+    if (pcc->insns_flags2 & PPC2_VSX) {
+        gdb_register_coprocessor(cs, gdb_get_vsx_reg, gdb_set_vsx_reg,
+                                 32, "power-vsx.xml", 0);
+    }
 
     qemu_init_vcpu(cs);
 
Signature · 1 line
2.1.0
#1 lore raw
Quoted 1 line · Anton Blanchard

Add the XML and functions to get and set VSX registers.

Awesome, thanks. Have you verified that this works for LE as well as BE guests?

Alex

#2 lore raw

Hi Alex,

Quoted 5 lines · Anton Blanchard
Quoted 1 line

Add the XML and functions to get and set VSX registers.

Awesome, thanks. Have you verified that this works for LE as well as BE guests?

Unfortunately all our XML gdbstub routines have endian issues (FPU, Altivec and now VMX). I only caught that the other day.

I can work on reusing maybe_bswap_register() from gdbstub.c.

Anton

#3 lore raw
Quoted 5 lines · Anton Blanchard

Hi Alex,

Quoted 3 lines · Anton Blanchard
Quoted 1 line

Add the XML and functions to get and set VSX registers.

Quoted 7 lines
Quoted 2 lines

Awesome, thanks. Have you verified that this works for LE as well as BE guests?

Unfortunately all our XML gdbstub routines have endian issues (FPU, Altivec and now VMX). I only caught that the other day.

I can work on reusing maybe_bswap_register() from gdbstub.c.

Ouch. So I think we should fix the endianness issues for 2.3 (which is in rc right now), but enable VMX for 2.4 since it's really a new feature.

Would you mind to work on and send at least the endian fixes reasonably soon, so that we can still get them into the release?

Thanks a lot,

Alex