Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@davemloft.net>
To: gdb-patches@sources.redhat.com
Subject: [PATCH]: Core regset support for Linux/SPARC.
Date: Thu, 06 Apr 2006 21:52:00 -0000	[thread overview]
Message-ID: <20060406.145119.102460789.davem@davemloft.net> (raw)


Thankfully the Sparc target layer already had nice generic
support for this, so it was merely a matter of defining some
offsets and some small helper stubs.

Ok to apply?

2006-04-06  David S. Miller  <davem@sunset.davemloft.net>

	* sparc64-linux-tdep.c (sparc64_linux_core_gregset,
	sparc64_linux_supply_core_gregset,
	sparc64_linux_collect_core_gregset,
	sparc64_linux_supply_core_fpregset,
	sparc64_linux_collect_core_fpregset): New.
	(sparc64_linux_init_abi): Register them with generic sparc
	core regset infrastructure.
	* sparc32-linux-tdep.c (sparc32_linux_core_gregset,
	sparc32_linux_supply_core_gregset,
	sparc32_linux_collect_core_gregset,
	sparc32_linux_supply_core_fpregset,
	sparc32_linux_collect_core_fpregset): New.
	(sparc32_linux_init_abi): Register them with generic sparc
	core regset infrastructure.
	* Makefile.in: Update dependencies.
	
--- ./sparc64-linux-tdep.c.~1~	2006-04-05 12:18:50.000000000 -0700
+++ ./sparc64-linux-tdep.c	2006-04-06 14:39:27.000000000 -0700
@@ -22,6 +22,7 @@
 #include "defs.h"
 #include "frame.h"
 #include "frame-unwind.h"
+#include "regset.h"
 #include "gdbarch.h"
 #include "osabi.h"
 #include "solib-svr4.h"
@@ -99,11 +100,67 @@ sparc64_linux_sigframe_init (const struc
 }
 \f
 
+const struct sparc_gregset sparc64_linux_core_gregset =
+{
+  32 * 8,			/* %tstate */
+  33 * 8,			/* %tpc */
+  34 * 8,			/* %tnpc */
+  35 * 8,			/* %y */
+  -1,				/* %wim */
+  -1,				/* %tbr */
+  1 * 8,			/* %g1 */
+  16 * 8,			/* %l0 */
+  8,				/* y size */
+};
+\f
+
+static void
+sparc64_linux_supply_core_gregset (const struct regset *regset,
+				   struct regcache *regcache,
+				   int regnum, const void *gregs, size_t len)
+{
+  sparc64_supply_gregset (&sparc64_linux_core_gregset, regcache, regnum, gregs);
+}
+
+static void
+sparc64_linux_collect_core_gregset (const struct regset *regset,
+				    const struct regcache *regcache,
+				    int regnum, void *gregs, size_t len)
+{
+  sparc64_collect_gregset (&sparc64_linux_core_gregset, regcache, regnum, gregs);
+}
+
+static void
+sparc64_linux_supply_core_fpregset (const struct regset *regset,
+				    struct regcache *regcache,
+				    int regnum, const void *fpregs, size_t len)
+{
+  sparc64_supply_fpregset (regcache, regnum, fpregs);
+}
+
+static void
+sparc64_linux_collect_core_fpregset (const struct regset *regset,
+				     const struct regcache *regcache,
+				     int regnum, void *fpregs, size_t len)
+{
+  sparc64_collect_fpregset (regcache, regnum, fpregs);
+}
+
+\f
+
 static void
 sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
+  tdep->gregset = regset_alloc (gdbarch, sparc64_linux_supply_core_gregset,
+				sparc64_linux_collect_core_gregset);
+  tdep->sizeof_gregset = 288;
+
+  tdep->fpregset = regset_alloc (gdbarch, sparc64_linux_supply_core_fpregset,
+				 sparc64_linux_collect_core_fpregset);
+  tdep->sizeof_fpregset = 280;
+
   tramp_frame_prepend_unwinder (gdbarch, &sparc64_linux_rt_sigframe);
 
   sparc64_init_abi (info, gdbarch);
--- ./sparc-linux-tdep.c.~1~	2006-04-05 13:02:35.000000000 -0700
+++ ./sparc-linux-tdep.c	2006-04-06 14:40:25.000000000 -0700
@@ -24,6 +24,7 @@
 #include "floatformat.h"
 #include "frame.h"
 #include "frame-unwind.h"
+#include "regset.h"
 #include "gdbarch.h"
 #include "gdbcore.h"
 #include "osabi.h"
@@ -127,11 +128,67 @@ sparc32_linux_sigframe_init (const struc
 }
 \f
 
+const struct sparc_gregset sparc32_linux_core_gregset =
+{
+  32 * 4,			/* %psr */
+  33 * 4,			/* %pc */
+  34 * 4,			/* %npc */
+  35 * 4,			/* %y */
+  -1,				/* %wim */
+  -1,				/* %tbr */
+  1 * 4,			/* %g1 */
+  16 * 4,			/* %l0 */
+  4,				/* y size */
+};
+\f
+
+static void
+sparc32_linux_supply_core_gregset (const struct regset *regset,
+				   struct regcache *regcache,
+				   int regnum, const void *gregs, size_t len)
+{
+  sparc32_supply_gregset (&sparc32_linux_core_gregset, regcache, regnum, gregs);
+}
+
+static void
+sparc32_linux_collect_core_gregset (const struct regset *regset,
+				    const struct regcache *regcache,
+				    int regnum, void *gregs, size_t len)
+{
+  sparc32_collect_gregset (&sparc32_linux_core_gregset, regcache, regnum, gregs);
+}
+
+static void
+sparc32_linux_supply_core_fpregset (const struct regset *regset,
+				    struct regcache *regcache,
+				    int regnum, const void *fpregs, size_t len)
+{
+  sparc32_supply_fpregset (regcache, regnum, fpregs);
+}
+
+static void
+sparc32_linux_collect_core_fpregset (const struct regset *regset,
+				     const struct regcache *regcache,
+				     int regnum, void *fpregs, size_t len)
+{
+  sparc32_collect_fpregset (regcache, regnum, fpregs);
+}
+
+\f
+
 static void
 sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
+  tdep->gregset = regset_alloc (gdbarch, sparc32_linux_supply_core_gregset,
+				sparc32_linux_collect_core_gregset);
+  tdep->sizeof_gregset = 152;
+
+  tdep->fpregset = regset_alloc (gdbarch, sparc32_linux_supply_core_fpregset,
+				 sparc32_linux_collect_core_fpregset);
+  tdep->sizeof_fpregset = 396;
+
   tramp_frame_prepend_unwinder (gdbarch, &sparc32_linux_sigframe);
   tramp_frame_prepend_unwinder (gdbarch, &sparc32_linux_rt_sigframe);
 
--- ./Makefile.in.~1~	2006-04-05 15:55:07.000000000 -0700
+++ ./Makefile.in	2006-04-06 14:41:03.000000000 -0700
@@ -2616,7 +2616,7 @@ sparc64-linux-nat.o: sparc64-linux-nat.c
 	$(gregset_h) $(sparc64_tdep_h) $(sparc_tdep_h) \
 	$(sparc_nat_h) $(inferior_h) $(target_h) $(linux_nat_h)
 sparc64-linux-tdep.o: sparc64-linux-tdep.c $(defs_h) $(frame_h) \
-	$(frame_unwind_h) $(gdbarch_h) $(osabi_h) $(solib_svr4_h) \
+	$(frame_unwind_h) $(regset_h) $(gdbarch_h) $(osabi_h) $(solib_svr4_h) \
 	$(symtab_h) $(trad_frame_h) $(tramp_frame_h) $(sparc64_tdep_h)
 sparc64-nat.o: sparc64-nat.c $(defs_h) $(gdbarch_h) $(sparc64_tdep_h) \
 	$(sparc_nat_h)
@@ -2643,9 +2643,9 @@ sparc-linux-nat.o: sparc-linux-nat.c $(d
 	$(sparc_tdep_h) $(sparc_nat_h) $(inferior_h) $(target_h) \
 	$(linux_nat_h)
 sparc-linux-tdep.o: sparc-linux-tdep.c $(defs_h) $(dwarf2_frame_h) \
-	$(floatformat_h) $(frame_h) $(frame_unwind_h) $(gdbarch_h) \
-	$(gdbcore_h) $(osabi_h) $(regcache_h) $(solib_svr4_h) $(symtab_h) \
-	$(trad_frame_h) $(tramp_frame_h) $(sparc_tdep_h)
+	$(floatformat_h) $(frame_h) $(frame_unwind_h) $(regset_h) \
+	$(gdbarch_h) $(gdbcore_h) $(osabi_h) $(regcache_h) $(solib_svr4_h) \
+	$(symtab_h) $(trad_frame_h) $(tramp_frame_h) $(sparc_tdep_h)
 sparc-nat.o: sparc-nat.c $(defs_h) $(inferior_h) $(regcache_h) $(target_h) \
 	$(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) $(sparc_tdep_h) \
 	$(sparc_nat_h) $(inf_ptrace_h)


             reply	other threads:[~2006-04-06 21:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-06 21:52 David S. Miller [this message]
2006-04-08 20:30 ` Daniel Jacobowitz
2006-04-08 21:16   ` David S. Miller

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=20060406.145119.102460789.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=gdb-patches@sources.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