All of lore.kernel.org
 help / color / mirror / Atom feed
From: David VomLehn <dvomlehn@cisco.com>
To: to@dvomlehn-lnx2.corp.sa.net,
	"linux-arch@vger.kernel.org"@cisco.com,
	linux-arch@vger.kernel.org
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	maint_arch@dvomlehn-lnx2.corp.sa.net
Subject: [PATCH 6/23] Make register values available to CRIS panic notifiers
Date: Sun, 11 Apr 2010 23:06:25 -0700	[thread overview]
Message-ID: <20100412060625.GA25426@dvomlehn-lnx2.corp.sa.net> (raw)

The save_ptregs() function has not been tested or even built. I will need
help to complete this.

Signed-off-by: David VomLehn <dvomlehn@cisco.com>
---
 arch/cris/include/arch-v10/arch/ptrace.h |   80 ++++++++++++++++++++++++++++
 arch/cris/include/arch-v32/arch/ptrace.h |   84 ++++++++++++++++++++++++++++++
 2 files changed, 164 insertions(+), 0 deletions(-)

diff --git a/arch/cris/include/arch-v10/arch/ptrace.h b/arch/cris/include/arch-v10/arch/ptrace.h
index 2f464ea..28be57c 100644
--- a/arch/cris/include/arch-v10/arch/ptrace.h
+++ b/arch/cris/include/arch-v10/arch/ptrace.h
@@ -114,6 +114,86 @@ struct switch_stack {
 #define profile_pc(regs) instruction_pointer(regs)
 extern void show_regs(struct pt_regs *);
 
+/* Macros for saving the contents of registers and for the output constraint
+ * for those registers */
+#include "/home/vomlehn/git/kernel.org/ptreg.h"
+#define PTREG_SAVE(r, name)	"move.d	$" #r ", %[" #r "]\n"
+#define PTREG_SAVE_R(i)		PTREG_SAVE_I(r, r, i)
+
+#define PTREG_OUT_R(regs, i)	PTREG_OUT_I(regs, r, r, i)
+
+#define arch_has_save_ptregs	1
+
+/**
+ * save_ptregs - save processor registers for backtracing
+ * @regs:	Pointer to &struct pt_regs structure in which to save the
+ *		registers
+ *
+ * Returns a constant pointer to @regs.
+ *
+ * This function must be called first in a function. There must be no
+ * auto variables defined that are initialized before calling this function.
+ */
+static __always_inline
+const struct pt_regs *save_ptregs(struct pt_regs *regs)
+{
+	__asm__ __volatile__ (
+			PTREG_SAVE(frametype)
+			PTREG_SAVE(orig_r10)
+			PTREGS_SAVE_R(13)
+			PTREGS_SAVE_R(12)
+			PTREGS_SAVE_R(11)
+			PTREGS_SAVE_R(10)
+			PTREGS_SAVE_R(9)
+			PTREGS_SAVE_R(8)
+			PTREGS_SAVE_R(7)
+			PTREGS_SAVE_R(6)
+			PTREGS_SAVE_R(5)
+			PTREGS_SAVE_R(4)
+			PTREGS_SAVE_R(3)
+			PTREGS_SAVE_R(2)
+			PTREGS_SAVE_R(1)
+			PTREGS_SAVE_R(0)
+			PTREG_SAVE(mof)
+			PTREG_SAVE(dccr)
+			PTREG_SAVE(srp)
+			PTREG_SAVE(irp)
+			PTREG_SAVE(csrinstr)
+			PTREG_SAVE(csraddr)
+			PTREG_SAVE(csrdata)
+		"1:\n"
+			"move.d	1b, r0\n"
+			PTREG_SAVE(r0, irp)
+	:
+		PTREG_OUT(regs, frametype, frametype),
+		PTREG_OUT(regs, orig_r10, orig_r10),
+		PTREG_OUT_I(regs, 13),
+		PTREG_OUT_I(regs, 12),
+		PTREG_OUT_I(regs, 11),
+		PTREG_OUT_I(regs, 10),
+		PTREG_OUT_I(regs, 9),
+		PTREG_OUT_I(regs, 8),
+		PTREG_OUT_I(regs, 7),
+		PTREG_OUT_I(regs, 6),
+		PTREG_OUT_I(regs, 5),
+		PTREG_OUT_I(regs, 4),
+		PTREG_OUT_I(regs, 3),
+		PTREG_OUT_I(regs, 2),
+		PTREG_OUT_I(regs, 1),
+		PTREG_OUT_I(regs, 0),
+		PTREG_OUT(regs, mof, mof),
+		PTREG_OUT(regs, dccr, dccr),
+		PTREG_OUT(regs, srp, srp),
+		PTREG_OUT(regs, irp, irp),
+		PTREG_OUT(regs, csrinstr, csrinstr),
+		PTREG_OUT(regs, csraddr, csraddr),
+		PTREG_OUT(regs, csrdata, csrdata)
+	:
+		"r0"
+	);
+
+	return regs;
+}
 #endif  /*  __KERNEL__  */
 
 #endif
diff --git a/arch/cris/include/arch-v32/arch/ptrace.h b/arch/cris/include/arch-v32/arch/ptrace.h
index ffca8d0..90ad6b1 100644
--- a/arch/cris/include/arch-v32/arch/ptrace.h
+++ b/arch/cris/include/arch-v32/arch/ptrace.h
@@ -114,6 +114,90 @@ struct switch_stack {
 extern void show_regs(struct pt_regs *);
 #define profile_pc(regs) instruction_pointer(regs)
 
+/* Macros for saving the contents of registers and for the output constraint
+ * for those registers */
+#include "/home/vomlehn/git/kernel.org/ptreg.h"
+#define PTREG_SAVE(r, name)	"move.d	$" #r ", %[" #r "]\n"
+#define PTREG_SAVE_R(i)		PTREG_SAVE_I(r, r, i)
+
+#define PTREG_OUT_R(regs, i)	PTREG_OUT_I(regs, r, r, i)
+
+#define arch_has_save_ptregs	1
+
+/**
+ * save_ptregs - save processor registers for backtracing
+ * @regs:	Pointer to &struct pt_regs structure in which to save the
+ *		registers
+ *
+ * Returns a constant pointer to @regs.
+ *
+ * This function must be called first in a function. There must be no
+ * auto variables defined that are initialized before calling this function.
+ */
+static __always_inline
+const struct pt_regs *save_ptregs(struct pt_regs *regs)
+{
+	__asm__ __volatile__ (
+			PTREG_SAVE(frametype)
+			PTREG_SAVE(orig_r10)
+			PTREGS_SAVE_R(13)
+			PTREGS_SAVE_R(12)
+			PTREGS_SAVE_R(11)
+			PTREGS_SAVE_R(10)
+			PTREGS_SAVE_R(9)
+			PTREGS_SAVE_R(8)
+			PTREGS_SAVE_R(7)
+			PTREGS_SAVE_R(6)
+			PTREGS_SAVE_R(5)
+			PTREGS_SAVE_R(4)
+			PTREGS_SAVE_R(3)
+			PTREGS_SAVE_R(2)
+			PTREGS_SAVE_R(1)
+			PTREGS_SAVE_R(0)
+			PTREG_SAVE(acr)
+			PTREG_SAVE(srs)
+			PTREG_SAVE(mof)
+			PTREG_SAVE(spc)
+			PTREG_SAVE(ccs)
+			PTREG_SAVE(srp)
+			PTREG_SAVE(erp)
+			PTREG_SAVE(exs)
+			PTREG_SAVE(eda)
+		"1:\n"
+			"move.d	1b, r0\n"
+			PTREG_SAVE(r0, irp)
+	:
+		PTREG_OUT(regs, frametype, frametype),
+		PTREG_OUT(regs, orig_r10, orig_r10),
+		PTREG_OUT_I(regs, 0),
+		PTREG_OUT_I(regs, 1),
+		PTREG_OUT_I(regs, 2),
+		PTREG_OUT_I(regs, 3),
+		PTREG_OUT_I(regs, 4),
+		PTREG_OUT_I(regs, 5),
+		PTREG_OUT_I(regs, 6),
+		PTREG_OUT_I(regs, 7),
+		PTREG_OUT_I(regs, 8),
+		PTREG_OUT_I(regs, 9),
+		PTREG_OUT_I(regs, 10),
+		PTREG_OUT_I(regs, 11),
+		PTREG_OUT_I(regs, 12),
+		PTREG_OUT_I(regs, 13),
+		PTREG_OUT(regs, acr, acr),
+		PTREG_OUT(regs, srs, srs),
+		PTREG_OUT(regs, mof, mof),
+		PTREG_OUT(regs, spc, spc),
+		PTREG_OUT(regs, ccs, ccs),
+		PTREG_OUT(regs, srp, srp),
+		PTREG_OUT(regs, erp, erp),
+		PTREG_OUT(regs, exs, exs),
+		PTREG_OUT(regs, eda, eda)
+	:
+		"r0"
+	);
+
+	return regs;
+}
 #endif  /*  __KERNEL__  */
 
 #endif

WARNING: multiple messages have this Message-ID (diff)
From: David VomLehn <dvomlehn@cisco.com>
To: to@dvomlehn-lnx2.corp.sa.net,
	"linux-arch@vger.kernel.org"@cisco.comlinux-arch@vger.kernel.org
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	maint_arch@dvomlehn-lnx2.corp.sa.net
Subject: [PATCH 6/23] Make register values available to CRIS panic notifiers
Date: Sun, 11 Apr 2010 23:06:25 -0700	[thread overview]
Message-ID: <20100412060625.GA25426@dvomlehn-lnx2.corp.sa.net> (raw)

The save_ptregs() function has not been tested or even built. I will need
help to complete this.

Signed-off-by: David VomLehn <dvomlehn@cisco.com>
---
 arch/cris/include/arch-v10/arch/ptrace.h |   80 ++++++++++++++++++++++++++++
 arch/cris/include/arch-v32/arch/ptrace.h |   84 ++++++++++++++++++++++++++++++
 2 files changed, 164 insertions(+), 0 deletions(-)

diff --git a/arch/cris/include/arch-v10/arch/ptrace.h b/arch/cris/include/arch-v10/arch/ptrace.h
index 2f464ea..28be57c 100644
--- a/arch/cris/include/arch-v10/arch/ptrace.h
+++ b/arch/cris/include/arch-v10/arch/ptrace.h
@@ -114,6 +114,86 @@ struct switch_stack {
 #define profile_pc(regs) instruction_pointer(regs)
 extern void show_regs(struct pt_regs *);
 
+/* Macros for saving the contents of registers and for the output constraint
+ * for those registers */
+#include "/home/vomlehn/git/kernel.org/ptreg.h"
+#define PTREG_SAVE(r, name)	"move.d	$" #r ", %[" #r "]\n"
+#define PTREG_SAVE_R(i)		PTREG_SAVE_I(r, r, i)
+
+#define PTREG_OUT_R(regs, i)	PTREG_OUT_I(regs, r, r, i)
+
+#define arch_has_save_ptregs	1
+
+/**
+ * save_ptregs - save processor registers for backtracing
+ * @regs:	Pointer to &struct pt_regs structure in which to save the
+ *		registers
+ *
+ * Returns a constant pointer to @regs.
+ *
+ * This function must be called first in a function. There must be no
+ * auto variables defined that are initialized before calling this function.
+ */
+static __always_inline
+const struct pt_regs *save_ptregs(struct pt_regs *regs)
+{
+	__asm__ __volatile__ (
+			PTREG_SAVE(frametype)
+			PTREG_SAVE(orig_r10)
+			PTREGS_SAVE_R(13)
+			PTREGS_SAVE_R(12)
+			PTREGS_SAVE_R(11)
+			PTREGS_SAVE_R(10)
+			PTREGS_SAVE_R(9)
+			PTREGS_SAVE_R(8)
+			PTREGS_SAVE_R(7)
+			PTREGS_SAVE_R(6)
+			PTREGS_SAVE_R(5)
+			PTREGS_SAVE_R(4)
+			PTREGS_SAVE_R(3)
+			PTREGS_SAVE_R(2)
+			PTREGS_SAVE_R(1)
+			PTREGS_SAVE_R(0)
+			PTREG_SAVE(mof)
+			PTREG_SAVE(dccr)
+			PTREG_SAVE(srp)
+			PTREG_SAVE(irp)
+			PTREG_SAVE(csrinstr)
+			PTREG_SAVE(csraddr)
+			PTREG_SAVE(csrdata)
+		"1:\n"
+			"move.d	1b, r0\n"
+			PTREG_SAVE(r0, irp)
+	:
+		PTREG_OUT(regs, frametype, frametype),
+		PTREG_OUT(regs, orig_r10, orig_r10),
+		PTREG_OUT_I(regs, 13),
+		PTREG_OUT_I(regs, 12),
+		PTREG_OUT_I(regs, 11),
+		PTREG_OUT_I(regs, 10),
+		PTREG_OUT_I(regs, 9),
+		PTREG_OUT_I(regs, 8),
+		PTREG_OUT_I(regs, 7),
+		PTREG_OUT_I(regs, 6),
+		PTREG_OUT_I(regs, 5),
+		PTREG_OUT_I(regs, 4),
+		PTREG_OUT_I(regs, 3),
+		PTREG_OUT_I(regs, 2),
+		PTREG_OUT_I(regs, 1),
+		PTREG_OUT_I(regs, 0),
+		PTREG_OUT(regs, mof, mof),
+		PTREG_OUT(regs, dccr, dccr),
+		PTREG_OUT(regs, srp, srp),
+		PTREG_OUT(regs, irp, irp),
+		PTREG_OUT(regs, csrinstr, csrinstr),
+		PTREG_OUT(regs, csraddr, csraddr),
+		PTREG_OUT(regs, csrdata, csrdata)
+	:
+		"r0"
+	);
+
+	return regs;
+}
 #endif  /*  __KERNEL__  */
 
 #endif
diff --git a/arch/cris/include/arch-v32/arch/ptrace.h b/arch/cris/include/arch-v32/arch/ptrace.h
index ffca8d0..90ad6b1 100644
--- a/arch/cris/include/arch-v32/arch/ptrace.h
+++ b/arch/cris/include/arch-v32/arch/ptrace.h
@@ -114,6 +114,90 @@ struct switch_stack {
 extern void show_regs(struct pt_regs *);
 #define profile_pc(regs) instruction_pointer(regs)
 
+/* Macros for saving the contents of registers and for the output constraint
+ * for those registers */
+#include "/home/vomlehn/git/kernel.org/ptreg.h"
+#define PTREG_SAVE(r, name)	"move.d	$" #r ", %[" #r "]\n"
+#define PTREG_SAVE_R(i)		PTREG_SAVE_I(r, r, i)
+
+#define PTREG_OUT_R(regs, i)	PTREG_OUT_I(regs, r, r, i)
+
+#define arch_has_save_ptregs	1
+
+/**
+ * save_ptregs - save processor registers for backtracing
+ * @regs:	Pointer to &struct pt_regs structure in which to save the
+ *		registers
+ *
+ * Returns a constant pointer to @regs.
+ *
+ * This function must be called first in a function. There must be no
+ * auto variables defined that are initialized before calling this function.
+ */
+static __always_inline
+const struct pt_regs *save_ptregs(struct pt_regs *regs)
+{
+	__asm__ __volatile__ (
+			PTREG_SAVE(frametype)
+			PTREG_SAVE(orig_r10)
+			PTREGS_SAVE_R(13)
+			PTREGS_SAVE_R(12)
+			PTREGS_SAVE_R(11)
+			PTREGS_SAVE_R(10)
+			PTREGS_SAVE_R(9)
+			PTREGS_SAVE_R(8)
+			PTREGS_SAVE_R(7)
+			PTREGS_SAVE_R(6)
+			PTREGS_SAVE_R(5)
+			PTREGS_SAVE_R(4)
+			PTREGS_SAVE_R(3)
+			PTREGS_SAVE_R(2)
+			PTREGS_SAVE_R(1)
+			PTREGS_SAVE_R(0)
+			PTREG_SAVE(acr)
+			PTREG_SAVE(srs)
+			PTREG_SAVE(mof)
+			PTREG_SAVE(spc)
+			PTREG_SAVE(ccs)
+			PTREG_SAVE(srp)
+			PTREG_SAVE(erp)
+			PTREG_SAVE(exs)
+			PTREG_SAVE(eda)
+		"1:\n"
+			"move.d	1b, r0\n"
+			PTREG_SAVE(r0, irp)
+	:
+		PTREG_OUT(regs, frametype, frametype),
+		PTREG_OUT(regs, orig_r10, orig_r10),
+		PTREG_OUT_I(regs, 0),
+		PTREG_OUT_I(regs, 1),
+		PTREG_OUT_I(regs, 2),
+		PTREG_OUT_I(regs, 3),
+		PTREG_OUT_I(regs, 4),
+		PTREG_OUT_I(regs, 5),
+		PTREG_OUT_I(regs, 6),
+		PTREG_OUT_I(regs, 7),
+		PTREG_OUT_I(regs, 8),
+		PTREG_OUT_I(regs, 9),
+		PTREG_OUT_I(regs, 10),
+		PTREG_OUT_I(regs, 11),
+		PTREG_OUT_I(regs, 12),
+		PTREG_OUT_I(regs, 13),
+		PTREG_OUT(regs, acr, acr),
+		PTREG_OUT(regs, srs, srs),
+		PTREG_OUT(regs, mof, mof),
+		PTREG_OUT(regs, spc, spc),
+		PTREG_OUT(regs, ccs, ccs),
+		PTREG_OUT(regs, srp, srp),
+		PTREG_OUT(regs, erp, erp),
+		PTREG_OUT(regs, exs, exs),
+		PTREG_OUT(regs, eda, eda)
+	:
+		"r0"
+	);
+
+	return regs;
+}
 #endif  /*  __KERNEL__  */
 
 #endif

             reply	other threads:[~2010-04-12  6:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-12  6:06 David VomLehn [this message]
2010-04-12  6:06 ` [PATCH 6/23] Make register values available to CRIS panic notifiers David VomLehn
2010-04-12 19:08 ` Sam Ravnborg
2010-04-14 21:13   ` David VomLehn
  -- strict thread matches above, loose matches on Subject: below --
2010-04-12  6:03 David VomLehn

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=20100412060625.GA25426@dvomlehn-lnx2.corp.sa.net \
    --to=dvomlehn@cisco.com \
    --cc="linux-arch@vger.kernel.org"@cisco.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maint_arch@dvomlehn-lnx2.corp.sa.net \
    --cc=to@dvomlehn-lnx2.corp.sa.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.