Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 15/22] [GDBserver] Multi-process + multi-arch: GNU/Linux Xtensa
Date: Thu, 30 May 2013 12:15:00 -0000	[thread overview]
Message-ID: <20130530121522.15047.96785.stgit@brno.lan> (raw)
In-Reply-To: <20130530121335.15047.12654.stgit@brno.lan>

This adjusts the GNU/Linux TI Xtensa port to new interfaces.

Completely untested.

2013-05-30  Pedro Alves  <palves@redhat.com>

	* linux-xtensa-low.c (tdesc_xtensa): Declare.
	(xtensa_fill_gregset, xtensa_store_gregset): Adjust.
	(target_regsets): Rename to ...
	(xtensa_regsets): ... this, and make static.
	(xtensa_regsets_info, xtensa_usrregs_info, regs_info): New
	globals.
	(xtensa_arch_setup, xtensa_regs_info): New functions.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
---
 gdb/gdbserver/linux-xtensa-low.c |   61 ++++++++++++++++++++++++++++++++------
 1 file changed, 52 insertions(+), 9 deletions(-)

diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdb/gdbserver/linux-xtensa-low.c
index d988a46..6083f33 100644
--- a/gdb/gdbserver/linux-xtensa-low.c
+++ b/gdb/gdbserver/linux-xtensa-low.c
@@ -22,6 +22,7 @@
 
 /* Defined in auto-generated file reg-xtensa.c.  */
 void init_registers_xtensa (void);
+extern const struct target_desc *tdesc_xtensa;
 
 #include <sys/ptrace.h>
 #include <xtensa-config.h>
@@ -40,19 +41,20 @@ static void
 xtensa_fill_gregset (struct regcache *regcache, void *buf)
 {
   elf_greg_t* rset = (elf_greg_t*)buf;
+  const struct target_desc *tdesc = regcache->tdesc;
   int ar0_regnum;
   char *ptr;
   int i;
 
   /* Take care of AR registers.  */
 
-  ar0_regnum = find_regno ("ar0");
+  ar0_regnum = find_regno (tdesc, "ar0");
   ptr = (char*)&rset[R_A0];
 
   for (i = ar0_regnum; i < ar0_regnum + XCHAL_NUM_AREGS; i++)
     {
       collect_register (regcache, i, ptr);
-      ptr += register_size(i);
+      ptr += register_size (tdesc, i);
     }
 
   /* Loop registers, if hardware has it.  */
@@ -74,19 +76,20 @@ static void
 xtensa_store_gregset (struct regcache *regcache, const void *buf)
 {
   const elf_greg_t* rset = (const elf_greg_t*)buf;
+  const struct target_desc *tdesc = regcache->tdesc;
   int ar0_regnum;
   char *ptr;
   int i;
 
   /* Take care of AR registers.  */
 
-  ar0_regnum = find_regno ("ar0");
+  ar0_regnum = find_regno (tdesc, "ar0");
   ptr = (char *)&rset[R_A0];
 
   for (i = ar0_regnum; i < ar0_regnum + XCHAL_NUM_AREGS; i++)
     {
       supply_register (regcache, i, ptr);
-      ptr += register_size(i);
+      ptr += register_size (tdesc, i);
     }
 
   /* Loop registers, if hardware has it.  */
@@ -130,7 +133,7 @@ xtensa_store_xtregset (struct regcache *regcache, const void *buf)
     }
 }
 
-struct regset_info target_regsets[] = {
+static struct regset_info xtensa_regsets[] = {
   { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t),
     GENERAL_REGS,
     xtensa_fill_gregset, xtensa_store_gregset },
@@ -176,11 +179,41 @@ xtensa_breakpoint_at (CORE_ADDR where)
 		  xtensa_breakpoint, xtensa_breakpoint_len) == 0;
 }
 
+static struct regsets_info xtensa_regsets_info =
+  {
+    xtensa_regsets, /* regsets */
+    0, /* num_regsets */
+    NULL, /* disabled_regsets */
+  };
+
+static struct usrregs_info xtensa_usrregs_info =
+  {
+    xtensa_num_regs,
+    xtensa_regmap,
+  };
+
+static struct regs_info regs_info =
+  {
+    NULL, /* regset_bitmap */
+    &xtensa_usrregs_info,
+    &xtensa_regsets_info
+  };
+
+static void
+xtensa_arch_setup (void)
+{
+  current_process ()->tdesc = tdesc_xtensa;
+}
+
+static const struct regs_info *
+xtensa_regs_info (void)
+{
+  return &regs_info;
+}
+
 struct linux_target_ops the_low_target = {
-  init_registers_xtensa,
-  0,
-  0,
-  NULL,
+  xtensa_arch_setup,
+  xtensa_regs_info,
   0,
   0,
   NULL, /* fetch_register */
@@ -192,3 +225,13 @@ struct linux_target_ops the_low_target = {
   0,
   xtensa_breakpoint_at,
 };
+
+
+void
+initialize_low_arch (void)
+{
+  /* Initialize the Linux target descriptions.  */
+  init_registers_xtensa ();
+
+  initialize_regsets_info (&xtensa_regsets_info);
+}


  parent reply	other threads:[~2013-05-30 12:15 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 12:13 [PATCH 00/22 v3] [GDBserver] Multi-process + multi-arch Pedro Alves
2013-05-30 12:13 ` [PATCH 01/22] [GDBserver] Multi-process + multi-arch: core + GNU/Linux x86* Pedro Alves
2013-06-03  8:47   ` Yao Qi
2013-06-03 15:24     ` Pedro Alves
2013-05-30 12:14 ` [PATCH 10/22] [GDBserver] Multi-process + multi-arch: GNU/Linux Blackfin Pedro Alves
2013-05-30 12:14 ` [PATCH 09/22] [GDBserver] Multi-process + multi-arch: GNU/Linux SH Pedro Alves
2013-05-30 12:14 ` [PATCH 05/22] [GDBserver] Multi-process + multi-arch: GNU/Linux S/390 Pedro Alves
2013-05-30 12:14 ` [PATCH 04/22] [GDBserver] Multi-process + multi-arch: GNU/Linux PowerPC Pedro Alves
2013-05-30 12:14 ` [PATCH 03/22] [GDBserver] Multi-process + multi-arch: GNU/Linux SPARC Pedro Alves
2013-05-30 12:14 ` [PATCH 07/22] [GDBserver] Multi-process + multi-arch: GNU/Linux ARM Pedro Alves
2013-05-30 12:14 ` [PATCH 11/22] [GDBserver] Multi-process + multi-arch: GNU/Linux CRIS Pedro Alves
2013-05-30 12:14 ` [PATCH 08/22] [GDBserver] Multi-process + multi-arch: GNU/Linux m68k Pedro Alves
2013-05-30 12:14 ` [PATCH 06/22] [GDBserver] Multi-process + multi-arch: GNU/Linux MIPS Pedro Alves
2013-05-30 12:14 ` [PATCH 02/22] [GDBserver] Multi-process + multi-arch: GNU/Linux IA64 Pedro Alves
2013-05-30 12:15 ` [PATCH 12/22] [GDBserver] Multi-process + multi-arch: GNU/Linux CRISv32 Pedro Alves
2013-05-30 12:15 ` [PATCH 16/22] [GDBserver] Multi-process + multi-arch: GNU/Linux Nios 2 Pedro Alves
2013-05-30 12:15 ` [PATCH 19/22] [GDBserver] Multi-process + multi-arch: SPU Pedro Alves
2013-05-30 12:15 ` Pedro Alves [this message]
2013-05-30 12:15 ` [PATCH 14/22] [GDBserver] Multi-process + multi-arch: GNU/Linux TI C6x Pedro Alves
2013-06-03  9:15   ` Yao Qi
2013-06-03 15:25     ` Pedro Alves
2013-05-30 12:15 ` [PATCH 13/22] [GDBserver] Multi-process + multi-arch: GNU/Linux M32R Pedro Alves
2013-05-30 12:15 ` [PATCH 17/22] [GDBserver] Multi-process + multi-arch: GNU/Linux Aarch64 Pedro Alves
2013-05-30 12:15 ` [PATCH 18/22] [GDBserver] Multi-process + multi-arch: GNU/Linux TILE-Gx Pedro Alves
2013-05-30 12:16 ` [PATCH 20/22] [GDBserver] Multi-process + multi-arch: Windows Pedro Alves
2013-05-30 12:16 ` [PATCH 21/22] [GDBserver] Multi-process + multi-arch: LynxOS Pedro Alves
2013-05-30 12:16 ` [PATCH 22/22] [GDBserver] Multi-process + multi-arch: QNX NTO Pedro Alves
2013-06-07 10:51 ` [COMMIT PATCH][GDBserver] Multi-process + multi-arch Pedro Alves
2013-06-07 10:57   ` Pedro Alves
2013-06-08  1:56   ` gdbserver regression [Re: [COMMIT PATCH][GDBserver] Multi-process + multi-arch] Jan Kratochvil
2013-06-10 10:24     ` Pedro Alves
2013-06-11 13:57     ` Pedro Alves
2013-06-11 15:44       ` Jan Kratochvil
2013-06-11 15:51         ` Pedro Alves
2013-06-11 18:07           ` Pedro Alves
2013-06-12 14:53             ` gdbserver regression #2 " Jan Kratochvil
2013-06-12 15:09               ` Pedro Alves
2013-06-12 16:47                 ` Pedro Alves
  -- strict thread matches above, loose matches on Subject: below --
2013-05-29 16:24 [PATCH 00/22] [GDBserver] Multi-process + multi-arch Pedro Alves
2013-05-29 16:28 ` [PATCH 15/22] [GDBserver] Multi-process + multi-arch: GNU/Linux Xtensa Pedro Alves

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=20130530121522.15047.96785.stgit@brno.lan \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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