[11/17,PowerPC] Add gdbserver support for TAR

Message ID 20180713135226.2321-12-pedromfc@linux.ibm.com
State New
Headers show
Series
  • GDB support for more powerpc registers on linux
Related show

Commit Message

Pedro Franco de Carvalho July 13, 2018, 1:52 p.m.
This patch extends suport for the Target Address Register to the
powerpc linux gdbserver stub.

gdb/gdbserver/ChangeLog:
YYYY-MM-DD  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>

	* linux-ppc-tdesc-init.h (enum ppc_linux_tdesc)
	<PPC_TDESC_ISA207_VSX>: New enum value.
	(init_registers_powerpc_isa207_vsx32l): Declare.
	(init_registers_powerpc_isa207_vsx64l): Declare.
	* linux-ppc-low.c (ppc_fill_tarregset): New function.
	(ppc_store_tarregset): New function.
	(ppc_regsets): Add entry for the TAR regset.
	(ppc_arch_setup): Set isa207 in features struct when needed. Set
	size for the TAR regsets.
	(ppc_get_ipa_tdesc_idx): Return PPC_TDESC_ISA207_VSX.
	(initialize_low_arch): Call init_registers_powerpc_isa207_vsx32l
	and init_registers_powerpc_isa207_vsx64l.
	* linux-ppc-ipa.c (get_ipa_tdesc): Handle PPC_TDESC_ISA207_VSX.
	(initialize_low_tracepoint): Call
	init_registers_powerpc_isa207_vsx32l and
	init_registers_powerpc_isa207_vsx64l.
---
 gdb/gdbserver/linux-ppc-ipa.c        |  6 ++++++
 gdb/gdbserver/linux-ppc-low.c        | 37 +++++++++++++++++++++++++++++++++++-
 gdb/gdbserver/linux-ppc-tdesc-init.h |  7 +++++++
 3 files changed, 49 insertions(+), 1 deletion(-)

-- 
2.13.6

Patch

diff --git a/gdb/gdbserver/linux-ppc-ipa.c b/gdb/gdbserver/linux-ppc-ipa.c
index c8b4c3b2da..b543dceba5 100644
--- a/gdb/gdbserver/linux-ppc-ipa.c
+++ b/gdb/gdbserver/linux-ppc-ipa.c
@@ -193,6 +193,8 @@  get_ipa_tdesc (int idx)
       return tdesc_powerpc_isa205_vsx64l;
     case PPC_TDESC_ISA205_PPR_DSCR_VSX:
       return tdesc_powerpc_isa205_ppr_dscr_vsx64l;
+    case PPC_TDESC_ISA207_VSX:
+      return tdesc_powerpc_isa207_vsx64l;
 #else
     case PPC_TDESC_BASE:
       return tdesc_powerpc_32l;
@@ -210,6 +212,8 @@  get_ipa_tdesc (int idx)
       return tdesc_powerpc_isa205_vsx32l;
     case PPC_TDESC_ISA205_PPR_DSCR_VSX:
       return tdesc_powerpc_isa205_ppr_dscr_vsx32l;
+    case PPC_TDESC_ISA207_VSX:
+      return tdesc_powerpc_isa207_vsx32l;
     case PPC_TDESC_E500:
       return tdesc_powerpc_e500l;
 #endif
@@ -239,6 +243,7 @@  initialize_low_tracepoint (void)
   init_registers_powerpc_isa205_altivec64l ();
   init_registers_powerpc_isa205_vsx64l ();
   init_registers_powerpc_isa205_ppr_dscr_vsx64l ();
+  init_registers_powerpc_isa207_vsx64l ();
 #else
   init_registers_powerpc_32l ();
   init_registers_powerpc_altivec32l ();
@@ -248,6 +253,7 @@  initialize_low_tracepoint (void)
   init_registers_powerpc_isa205_altivec32l ();
   init_registers_powerpc_isa205_vsx32l ();
   init_registers_powerpc_isa205_ppr_dscr_vsx32l ();
+  init_registers_powerpc_isa207_vsx32l ();
   init_registers_powerpc_e500l ();
 #endif
 }
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
index 502ce674fc..6c27368a36 100644
--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -510,6 +510,22 @@  ppc_store_dscrregset (struct regcache *regcache, const void *buf)
 }
 
 static void
+ppc_fill_tarregset (struct regcache *regcache, void *buf)
+{
+  char *tar = (char *) buf;
+
+  collect_register_by_name (regcache, "tar", tar);
+}
+
+static void
+ppc_store_tarregset (struct regcache *regcache, const void *buf)
+{
+  const char *tar = (const char *) buf;
+
+  supply_register_by_name (regcache, "tar", tar);
+}
+
+static void
 ppc_fill_vsxregset (struct regcache *regcache, void *buf)
 {
   int i, base;
@@ -622,6 +638,8 @@  static struct regset_info ppc_regsets[] = {
      fetch them every time, but still fall back to PTRACE_PEEKUSER for the
      general registers.  Some kernels support these, but not the newer
      PPC_PTRACE_GETREGS.  */
+  { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TAR, 0, EXTENDED_REGS,
+  ppc_fill_tarregset, ppc_store_tarregset },
   { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_PPR, 0, EXTENDED_REGS,
   ppc_fill_pprregset, ppc_store_pprregset },
   { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_DSCR, 0, EXTENDED_REGS,
@@ -696,7 +714,14 @@  ppc_arch_setup (void)
   if ((ppc_hwcap2 & PPC_FEATURE2_DSCR)
       && ppc_check_regset (tid, NT_PPC_DSCR, PPC_LINUX_SIZEOF_DSCRREGSET)
       && ppc_check_regset (tid, NT_PPC_PPR, PPC_LINUX_SIZEOF_PPRREGSET))
-    features.ppr_dscr = true;
+    {
+      features.ppr_dscr = true;
+      if ((ppc_hwcap2 & PPC_FEATURE2_ARCH_2_07)
+	  && (ppc_hwcap2 & PPC_FEATURE2_TAR)
+	  && ppc_check_regset (tid, NT_PPC_TAR,
+			       PPC_LINUX_SIZEOF_TARREGSET))
+	features.isa207 = true;
+    }
 
   if (ppc_hwcap & PPC_FEATURE_CELL)
     features.cell = true;
@@ -753,6 +778,10 @@  ppc_arch_setup (void)
 	    regset->size = (features.ppr_dscr ?
 			    PPC_LINUX_SIZEOF_DSCRREGSET : 0);
 	    break;
+	  case NT_PPC_TAR:
+	    regset->size = (features.isa207 ?
+			    PPC_LINUX_SIZEOF_TARREGSET : 0);
+	    break;
 	  default:
 	    break;
 	  }
@@ -3134,6 +3163,8 @@  ppc_get_ipa_tdesc_idx (void)
     return PPC_TDESC_ISA205_VSX;
   if (tdesc == tdesc_powerpc_isa205_ppr_dscr_vsx64l)
     return PPC_TDESC_ISA205_PPR_DSCR_VSX;
+  if (tdesc == tdesc_powerpc_isa207_vsx64l)
+    return PPC_TDESC_ISA207_VSX;
 #endif
 
   if (tdesc == tdesc_powerpc_32l)
@@ -3152,6 +3183,8 @@  ppc_get_ipa_tdesc_idx (void)
     return PPC_TDESC_ISA205_VSX;
   if (tdesc == tdesc_powerpc_isa205_ppr_dscr_vsx32l)
     return PPC_TDESC_ISA205_PPR_DSCR_VSX;
+  if (tdesc == tdesc_powerpc_isa207_vsx32l)
+    return PPC_TDESC_ISA207_VSX;
   if (tdesc == tdesc_powerpc_e500l)
     return PPC_TDESC_E500;
 
@@ -3211,6 +3244,7 @@  initialize_low_arch (void)
   init_registers_powerpc_isa205_altivec32l ();
   init_registers_powerpc_isa205_vsx32l ();
   init_registers_powerpc_isa205_ppr_dscr_vsx32l ();
+  init_registers_powerpc_isa207_vsx32l ();
   init_registers_powerpc_e500l ();
 #if __powerpc64__
   init_registers_powerpc_64l ();
@@ -3221,6 +3255,7 @@  initialize_low_arch (void)
   init_registers_powerpc_isa205_altivec64l ();
   init_registers_powerpc_isa205_vsx64l ();
   init_registers_powerpc_isa205_ppr_dscr_vsx64l ();
+  init_registers_powerpc_isa207_vsx64l ();
 #endif
 
   initialize_regsets_info (&ppc_regsets_info);
diff --git a/gdb/gdbserver/linux-ppc-tdesc-init.h b/gdb/gdbserver/linux-ppc-tdesc-init.h
index c5c10c0670..29b8122886 100644
--- a/gdb/gdbserver/linux-ppc-tdesc-init.h
+++ b/gdb/gdbserver/linux-ppc-tdesc-init.h
@@ -30,6 +30,7 @@  enum ppc_linux_tdesc {
   PPC_TDESC_ISA205_ALTIVEC,
   PPC_TDESC_ISA205_VSX,
   PPC_TDESC_ISA205_PPR_DSCR_VSX,
+  PPC_TDESC_ISA207_VSX,
   PPC_TDESC_E500,
 };
 
@@ -59,6 +60,9 @@  void init_registers_powerpc_isa205_vsx32l (void);
 /* Defined in auto-generated file powerpc-isa205-ppr-dscr-vsx32l.c.  */
 void init_registers_powerpc_isa205_ppr_dscr_vsx32l (void);
 
+/* Defined in auto-generated file powerpc-isa207-vsx32l.c.  */
+void init_registers_powerpc_isa207_vsx32l (void);
+
 /* Defined in auto-generated file powerpc-e500l.c.  */
 void init_registers_powerpc_e500l (void);
 
@@ -90,4 +94,7 @@  void init_registers_powerpc_isa205_vsx64l (void);
 /* Defined in auto-generated file powerpc-isa205-ppr-dscr-vsx64l.c.  */
 void init_registers_powerpc_isa205_ppr_dscr_vsx64l (void);
 
+/* Defined in auto-generated file powerpc-isa207-vsx64l.c.  */
+void init_registers_powerpc_isa207_vsx64l (void);
+
 #endif