Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
To: gdb-patches@sourceware.org
Cc: uweigand@de.ibm.com, edjunior@gmail.com
Subject: [PATCH 17/17] [PowerPC] Add gdbserver support for EBB and PMU registers
Date: Fri, 13 Jul 2018 14:49:00 -0000	[thread overview]
Message-ID: <20180713135226.2321-18-pedromfc@linux.ibm.com> (raw)
In-Reply-To: <20180713135226.2321-1-pedromfc@linux.ibm.com>

This patch extends support for EBB and PMU registers to the powerpc
linux gdbserver stub.

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

	* linux-ppc-low.c (ppc_store_ebbregset, ppc_store_pmuregset): New
	functions.
	(ppc_regsets): Add entries for ebb and pmu regsets.
	(ppc_arch_setup): Set isa207 in features struct if the ebb and pmu
	regsets are available. Set sizes for these regsets.
---
 gdb/gdbserver/linux-ppc-low.c | 50 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 49 insertions(+), 1 deletion(-)

diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
index 2c830d638a..9d1845088b 100644
--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -526,6 +526,38 @@ ppc_store_tarregset (struct regcache *regcache, const void *buf)
 }
 
 static void
+ppc_store_ebbregset (struct regcache *regcache, const void *buf)
+{
+  int base;
+  char *regset = (char *) buf;
+
+  base = find_regno (regcache->tdesc, "bescr");
+
+  /* The order in the kernel regset is: EBBRR, EBBHR, BESCR, in our
+     .dat file it is BESCR, EBBHR, EBBRR.  */
+  supply_register (regcache, base, &regset[16]);
+  supply_register (regcache, base + 1, &regset[8]);
+  supply_register (regcache, base + 2, &regset[0]);
+}
+
+static void
+ppc_store_pmuregset (struct regcache *regcache, const void *buf)
+{
+  int base;
+  char *regset = (char *) buf;
+
+  base = find_regno (regcache->tdesc, "mmcr0");
+
+  /* The order in the kernel regset is SIAR, SDAR, SIER, MMCR2, MMCR0.
+     In the .dat file is MMCR0, MMCR2, SIAR, SDAR, SIER.  */
+  supply_register (regcache, base, &regset[32]);
+  supply_register (regcache, base + 1, &regset[24]);
+  supply_register (regcache, base + 2, &regset[0]);
+  supply_register (regcache, base + 3, &regset[8]);
+  supply_register (regcache, base + 4, &regset[16]);
+}
+
+static void
 ppc_fill_tm_sprregset (struct regcache *regcache, void *buf)
 {
   int i, base;
@@ -775,6 +807,10 @@ static struct regset_info ppc_regsets[] = {
     NULL, ppc_store_tm_cgprregset },
   { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TM_SPR, 0, EXTENDED_REGS,
     ppc_fill_tm_sprregset, ppc_store_tm_sprregset },
+  { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_EBB, 0, EXTENDED_REGS,
+    NULL, ppc_store_ebbregset },
+  { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_PMU, 0, EXTENDED_REGS,
+    NULL, ppc_store_pmuregset },
   { 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,
@@ -856,7 +892,11 @@ ppc_arch_setup (void)
       if ((ppc_hwcap2 & PPC_FEATURE2_ARCH_2_07)
 	  && (ppc_hwcap2 & PPC_FEATURE2_TAR)
 	  && ppc_check_regset (tid, NT_PPC_TAR,
-			       PPC_LINUX_SIZEOF_TARREGSET))
+			       PPC_LINUX_SIZEOF_TARREGSET)
+	  && ppc_check_regset (tid, NT_PPC_EBB,
+			       PPC_LINUX_SIZEOF_EBBREGSET)
+	  && ppc_check_regset (tid, NT_PPC_PMU,
+			       PPC_LINUX_SIZEOF_PMUREGSET))
 	{
 	  features.isa207 = true;
 	  if ((ppc_hwcap2 & PPC_FEATURE2_HTM)
@@ -925,6 +965,14 @@ ppc_arch_setup (void)
 	    regset->size = (features.isa207 ?
 			    PPC_LINUX_SIZEOF_TARREGSET : 0);
 	    break;
+	  case NT_PPC_EBB:
+	    regset->size = (features.isa207 ?
+			    PPC_LINUX_SIZEOF_EBBREGSET : 0);
+	    break;
+	  case NT_PPC_PMU:
+	    regset->size = (features.isa207 ?
+			    PPC_LINUX_SIZEOF_PMUREGSET : 0);
+	    break;
 	  case NT_PPC_TM_SPR:
 	    regset->size = (features.htm ?
 			    PPC_LINUX_SIZEOF_TM_SPRREGSET : 0);
-- 
2.13.6


  parent reply	other threads:[~2018-07-13 14:49 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-13 13:53 [PATCH 00/17] GDB support for more powerpc registers on linux Pedro Franco de Carvalho
2018-07-13 13:53 ` [PATCH 06/17] [PowerPC] Add record/replay support for PPR and DSCR Pedro Franco de Carvalho
2018-07-13 15:25   ` Ulrich Weigand
2018-07-13 13:53 ` [PATCH 04/17] [PowerPC] Refactor have_ initializers in rs6000-tdep.c Pedro Franco de Carvalho
2018-07-13 15:19   ` Ulrich Weigand
2018-07-13 13:53 ` [PATCH 05/17] [PowerPC] Add support for PPR and DSCR Pedro Franco de Carvalho
2018-07-13 15:23   ` Ulrich Weigand
2018-07-13 13:53 ` [PATCH 16/17] [PowerPC] Add support for EBB and PMU registers Pedro Franco de Carvalho
2018-07-13 16:38   ` Ulrich Weigand
2018-07-13 18:23     ` Pedro Franco de Carvalho
2018-07-13 13:53 ` [PATCH 02/17] [PowerPC] Fix two if statements in gdb/ppc-linux-nat.c Pedro Franco de Carvalho
2018-07-13 15:17   ` Ulrich Weigand
2018-07-13 13:53 ` [PATCH 07/17] [PowerPC] Add gdbserver support for PPR and DSCR Pedro Franco de Carvalho
2018-07-13 15:26   ` Ulrich Weigand
2018-07-13 13:53 ` [PATCH 14/17] [PowerPC] Add gdbserver support for HTM registers Pedro Franco de Carvalho
2018-07-13 16:26   ` Ulrich Weigand
2018-07-13 13:53 ` [PATCH 01/17] [PowerPC] Simplify rs6000_pseudo_register_reggroup_p Pedro Franco de Carvalho
2018-07-13 15:17   ` Ulrich Weigand
2018-07-13 13:53 ` [PATCH 08/17] [PowerPC] Add tests for PPR and DSCR Pedro Franco de Carvalho
2018-07-13 15:27   ` Ulrich Weigand
2018-07-13 13:53 ` [PATCH 10/17] [PowerPC] Add record/replay support for TAR Pedro Franco de Carvalho
2018-07-13 15:31   ` Ulrich Weigand
2018-07-13 13:53 ` [PATCH 09/17] [PowerPC] Add " Pedro Franco de Carvalho
2018-07-13 15:30   ` Ulrich Weigand
2018-07-13 13:53 ` [PATCH 12/17] [PowerPC] Add tests " Pedro Franco de Carvalho
2018-07-13 15:33   ` Ulrich Weigand
2018-07-13 13:53 ` [PATCH 03/17] [PowerPC] Fix indentation in arch/ppc-linux-common.c Pedro Franco de Carvalho
2018-07-13 15:18   ` Ulrich Weigand
2018-07-13 13:53 ` [PATCH 13/17] [PowerPC] Add support for HTM registers Pedro Franco de Carvalho
2018-07-13 16:24   ` Ulrich Weigand
2018-07-13 18:16     ` Pedro Franco de Carvalho
2018-07-13 14:23 ` [PATCH 15/17] [PowerPC] Add tests " Pedro Franco de Carvalho
2018-07-13 16:27   ` Ulrich Weigand
2018-07-13 14:49 ` Pedro Franco de Carvalho [this message]
2018-07-13 16:40   ` [PATCH 17/17] [PowerPC] Add gdbserver support for EBB and PMU registers Ulrich Weigand
2018-07-13 18:29     ` Pedro Franco de Carvalho
2018-07-13 15:33 ` [PATCH 11/17] [PowerPC] Add gdbserver support for TAR Pedro Franco de Carvalho
2018-07-13 15:33   ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180713135226.2321-18-pedromfc@linux.ibm.com \
    --to=pedromfc@linux.ibm.com \
    --cc=edjunior@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox