public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Cc: Richard Henderson <rth@redhat.com>
Subject: [PATCH v2 05/13] ALPHA Linux: Fill 'collect_regset' in regset structures.
Date: Wed, 25 Jun 2014 16:49:00 -0000	[thread overview]
Message-ID: <1403714949-28133-6-git-send-email-arnez@linux.vnet.ibm.com> (raw)
In-Reply-To: <1403714949-28133-1-git-send-email-arnez@linux.vnet.ibm.com>

gdb/
	* alpha-linux-tdep.c (alpha_linux_supply_gregset): Replace logic
	by call to alpha_supply_int_regs.
	(alpha_linux_collect_gregset): New function.
	(alpha_linux_supply_fpregset): Replace logic by call to
	alpha_supply_fp_regs.
	(alpha_linux_collect_fpregset): New function.
	(alpha_linux_gregset, alpha_linux_fpregset): Add collect method.
---
 gdb/alpha-linux-tdep.c | 56 +++++++++++++++++++++++++++++++-------------------
 1 file changed, 35 insertions(+), 21 deletions(-)

diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c
index 52f19d0..51bce4f 100644
--- a/gdb/alpha-linux-tdep.c
+++ b/gdb/alpha-linux-tdep.c
@@ -166,21 +166,27 @@ alpha_linux_supply_gregset (const struct regset *regset,
 			    int regnum, const void *gregs, size_t len)
 {
   const gdb_byte *regs = gregs;
-  int i;
+
   gdb_assert (len >= 32 * 8);
+  alpha_supply_int_regs (regcache, regnum, regs, regs + 31 * 8,
+			 len >= 33 * 8 ? regs + 32 * 8 : NULL);
+}
 
-  for (i = 0; i < ALPHA_ZERO_REGNUM; i++)
-    {
-      if (regnum == i || regnum == -1)
-	regcache_raw_supply (regcache, i, regs + i * 8);
-    }
+/* Collect register REGNUM from the register cache REGCACHE and store
+   it in the buffer specified by GREGS and LEN as described by the
+   general-purpose register set REGSET.  If REGNUM is -1, do this for
+   all registers in REGSET.  */
 
-  if (regnum == ALPHA_PC_REGNUM || regnum == -1)
-    regcache_raw_supply (regcache, ALPHA_PC_REGNUM, regs + 31 * 8);
+static void
+alpha_linux_collect_gregset (const struct regset *regset,
+			     const struct regcache *regcache,
+			     int regnum, void *gregs, size_t len)
+{
+  gdb_byte *regs = gregs;
 
-  if (regnum == ALPHA_UNIQUE_REGNUM || regnum == -1)
-    regcache_raw_supply (regcache, ALPHA_UNIQUE_REGNUM,
-			 len >= 33 * 8 ? regs + 32 * 8 : NULL);
+  gdb_assert (len >= 32 * 8);
+  alpha_fill_int_regs (regcache, regnum, regs, regs + 31 * 8,
+		       len >= 33 * 8 ? regs + 32 * 8 : NULL);
 }
 
 /* Supply register REGNUM from the buffer specified by FPREGS and LEN
@@ -193,29 +199,37 @@ alpha_linux_supply_fpregset (const struct regset *regset,
 			     int regnum, const void *fpregs, size_t len)
 {
   const gdb_byte *regs = fpregs;
-  int i;
+
   gdb_assert (len >= 32 * 8);
+  alpha_supply_fp_regs (regcache, regnum, regs, regs + 31 * 8);
+}
 
-  for (i = ALPHA_FP0_REGNUM; i < ALPHA_FP0_REGNUM + 31; i++)
-    {
-      if (regnum == i || regnum == -1)
-	regcache_raw_supply (regcache, i, regs + (i - ALPHA_FP0_REGNUM) * 8);
-    }
+/* Collect register REGNUM from the register cache REGCACHE and store
+   it in the buffer specified by FPREGS and LEN as described by the
+   general-purpose register set REGSET.  If REGNUM is -1, do this for
+   all registers in REGSET.  */
 
-  if (regnum == ALPHA_FPCR_REGNUM || regnum == -1)
-    regcache_raw_supply (regcache, ALPHA_FPCR_REGNUM, regs + 31 * 8);
+static void
+alpha_linux_collect_fpregset (const struct regset *regset,
+			      const struct regcache *regcache,
+			      int regnum, void *fpregs, size_t len)
+{
+  gdb_byte *regs = fpregs;
+
+  gdb_assert (len >= 32 * 8);
+  alpha_fill_fp_regs (regcache, regnum, regs, regs + 31 * 8);
 }
 
 static const struct regset alpha_linux_gregset =
 {
   NULL,
-  alpha_linux_supply_gregset
+  alpha_linux_supply_gregset, alpha_linux_collect_gregset
 };
 
 static const struct regset alpha_linux_fpregset =
 {
   NULL,
-  alpha_linux_supply_fpregset
+  alpha_linux_supply_fpregset, alpha_linux_collect_fpregset
 };
 
 /* Return the appropriate register set for the core section identified
-- 
1.8.4.2

  reply	other threads:[~2014-06-25 16:49 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-25 16:49 [PATCH v2 00/13] Regset rework preparations part 2 Andreas Arnez
2014-06-25 16:49 ` Andreas Arnez [this message]
2014-06-25 16:49 ` [PATCH v2 04/13] AARCH64 Linux: Fill 'collect_regset' in regset structures Andreas Arnez
2014-07-07  9:57   ` Omair Javaid
2014-06-25 16:49 ` [PATCH v2 01/13] Rename 'descr' field in regset structure to 'regmap' Andreas Arnez
2014-06-25 16:49 ` [PATCH v2 02/13] regcache: Add functions suitable for regset_supply/collect Andreas Arnez
2014-07-07  9:32   ` Omair Javaid
2014-07-08 11:32     ` Andreas Arnez
2014-07-08 19:09       ` Omair Javaid
2014-07-10  7:54         ` Andreas Arnez
2014-07-19 13:10           ` Omair Javaid
2014-06-25 16:49 ` [PATCH v2 12/13] M68K Linux: Define regset structures Andreas Arnez
2014-07-15 12:13   ` Ulrich Weigand
2014-07-16 18:01     ` Andreas Arnez
2014-06-25 16:49 ` [PATCH v2 07/13] HPPA Linux: Fill 'collect_regset' in " Andreas Arnez
2014-06-25 16:49 ` [PATCH v2 03/13] S390: Migrate to regcache_supply/collect_regset Andreas Arnez
2014-07-15  9:27   ` Ulrich Weigand
2014-07-15 12:07     ` Andreas Arnez
2014-06-25 16:49 ` [PATCH v2 11/13] TILEGX Linux: Fill 'collect_regset' in regset structure Andreas Arnez
2014-07-15 10:12   ` Ulrich Weigand
2014-07-16 13:30     ` Andreas Arnez
2014-06-25 16:49 ` [PATCH v2 13/13] IA64 Linux: Define regset structures Andreas Arnez
2014-07-15 13:01   ` Ulrich Weigand
2014-07-18  9:06     ` Andreas Arnez
2014-06-25 16:49 ` [PATCH v2 10/13] SCORE: Fill 'collect_regset' in regset structure Andreas Arnez
2014-07-15 10:01   ` Ulrich Weigand
2014-07-15 12:25     ` Andreas Arnez
2014-06-25 16:49 ` [PATCH v2 09/13] NIOS2 Linux: " Andreas Arnez
2014-06-25 16:49 ` [PATCH v2 06/13] FRV Linux: Fill 'collect_regset' in regset structures Andreas Arnez
2014-06-25 16:49 ` [PATCH v2 08/13] M32R Linux: Fill 'collect_regset' in regset structure Andreas Arnez
2014-07-01  8:00 ` [ping][PATCH v2 00/13] Regset rework preparations part 2 Andreas Arnez

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=1403714949-28133-6-git-send-email-arnez@linux.vnet.ibm.com \
    --to=arnez@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=rth@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).