All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/23] Make register values available to Alpha panic notifiers
@ 2010-04-12  6:06 ` David VomLehn
  0 siblings, 0 replies; 5+ messages in thread
From: David VomLehn @ 2010-04-12  6:06 UTC (permalink / raw)
  To: to, linux-arch@vger.kernel.org, linux-arch; +Cc: akpm, linux-kernel, maint_arch

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/alpha/include/asm/ptrace.h |  124 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 124 insertions(+), 0 deletions(-)

diff --git a/arch/alpha/include/asm/ptrace.h b/arch/alpha/include/asm/ptrace.h
index 65cf3e2..952d177 100644
--- a/arch/alpha/include/asm/ptrace.h
+++ b/arch/alpha/include/asm/ptrace.h
@@ -79,6 +79,130 @@ extern void show_regs(struct pt_regs *);
 
 #define force_successful_syscall_return() (task_pt_regs(current)->r0 = 0)
 
+/* Macros for saving the contents of registers and for the output constraint
+ * for those registers */
+#include "/home/vomlehn/git/kernel.org/linux/ptreg.h"
+#define PTREG_SAVE(r, name)	"stq	" #r ", %[" #name "]\n"
+#define PTREG_SAVE_R(i)		PTREG_SAVE_I($, r, i)
+
+#define PTREG_OUT_R(regsp, i)	PTREG_OUT_I(regsp, 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__ (
+			/* Based on the SAVE_ALL code */
+			PTREG_SAVE_R(0)
+			PTREG_SAVE_R(1)
+			PTREG_SAVE_R(2)
+			PTREG_SAVE_R(3)
+			PTREG_SAVE_R(4)
+			PTREG_SAVE_R(28)
+			"lda	$2, alpha_mv\n"
+			PTREG_SAVE_R(5)
+			PTREG_SAVE_R(6)
+			PTREG_SAVE_R(7)
+			PTREG_SAVE_R(8)
+			PTREG_SAVE_R(19)
+			PTREG_SAVE_R(20)
+			PTREG_SAVE_R(21)
+			"ldq	$2, HAE_CACHE($2)\n"
+			PTREG_SAVE_R(22)
+			PTREG_SAVE_R(23)
+			PTREG_SAVE_R(24)
+			PTREG_SAVE_R(25)
+			PTREG_SAVE_R(26)
+			PTREG_SAVE_R(27)
+			PTREG_SAVE($2, hae)
+			PTREG_SAVE_R(16)
+			PTREG_SAVE_R(17)
+			PTREG_SAVE_R(18)
+
+			PTREG_SAVE_R(9)
+			PTREG_SAVE_R(10)
+			PTREG_SAVE_R(11)
+			PTREG_SAVE_R(12)
+			PTREG_SAVE_R(13)
+			PTREG_SAVE_R(14)
+			PTREG_SAVE_R(15)
+			PTREG_SAVE_R(29)
+			PTREG_SAVE_R(30)
+			PTREG_SAVE_R(31)
+			PTREG_SAVE_REG($gp, gp)
+			PTREG_SAVE_REG($31, ps)
+
+			/* These are almost certainly wrong */
+			PTREG_SAVE_REG(trap_a0, trap_a0)
+			PTREG_SAVE_REG(trap_a1, trap_a1)
+			PTREG_SAVE_REG(trap_a2, trap_a2)
+		/*
+		 * The current location is the one for which the register
+		 * values are correct, even if some had been modified on
+		 * function entry. So, the current location is the value to
+		 * save as the execution address.
+		 */
+		"1b:\n"
+			"lda	$2, 1b\n"
+			PTREG_SAVE($2, pc)
+	:
+		PTREG_OUT_R(regs, 0),
+		PTREG_OUT_R(regs, 1),
+		PTREG_OUT_R(regs, 2),
+		PTREG_OUT_R(regs, 3),
+		PTREG_OUT_R(regs, 4),
+		PTREG_OUT_R(regs, 5),
+		PTREG_OUT_R(regs, 6),
+		PTREG_OUT_R(regs, 7),
+		PTREG_OUT_R(regs, 8),
+		PTREG_OUT_R(regs, 9),
+		PTREG_OUT_R(regs, 10),
+		PTREG_OUT_R(regs, 11),
+		PTREG_OUT_R(regs, 12),
+		PTREG_OUT_R(regs, 13),
+		PTREG_OUT_R(regs, 14),
+		PTREG_OUT_R(regs, 15),
+		PTREG_OUT_R(regs, 16),
+		PTREG_OUT_R(regs, 17),
+		PTREG_OUT_R(regs, 18),
+		PTREG_OUT_R(regs, 19),
+		PTREG_OUT_R(regs, 20),
+		PTREG_OUT_R(regs, 21),
+		PTREG_OUT_R(regs, 22),
+		PTREG_OUT_R(regs, 23),
+		PTREG_OUT_R(regs, 24),
+		PTREG_OUT_R(regs, 25),
+		PTREG_OUT_R(regs, 26),
+		PTREG_OUT_R(regs, 27),
+		PTREG_OUT_R(regs, 28),
+		PTREG_OUT_R(regs, 29),
+		PTREG_OUT_R(regs, 30),
+		PTREG_OUT_R(regs, 31),
+
+		PTREG_OUT(regs, hae, hae),
+		PTREG_OUT(regs, trap_a0, trap_a0),
+		PTREG_OUT(regs, trap_a1, trap_a1),
+		PTREG_OUT(regs, trap_a2, trap_a2),
+		PTREG_OUT(regs, ps, ps),
+		PTREG_OUT(regs, pc, pc),
+		PTREG_OUT(regs, gp, gp)
+	:
+		"$2"
+	);
+
+	return regs;
+}
 #endif
 
 #endif

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/23] Make register values available to Alpha panic notifiers
@ 2010-04-12  6:06 ` David VomLehn
  0 siblings, 0 replies; 5+ messages in thread
From: David VomLehn @ 2010-04-12  6:06 UTC (permalink / raw)
  To: to, linux-arch@vger.kernel.org; +Cc: akpm, linux-kernel, maint_arch

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/alpha/include/asm/ptrace.h |  124 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 124 insertions(+), 0 deletions(-)

diff --git a/arch/alpha/include/asm/ptrace.h b/arch/alpha/include/asm/ptrace.h
index 65cf3e2..952d177 100644
--- a/arch/alpha/include/asm/ptrace.h
+++ b/arch/alpha/include/asm/ptrace.h
@@ -79,6 +79,130 @@ extern void show_regs(struct pt_regs *);
 
 #define force_successful_syscall_return() (task_pt_regs(current)->r0 = 0)
 
+/* Macros for saving the contents of registers and for the output constraint
+ * for those registers */
+#include "/home/vomlehn/git/kernel.org/linux/ptreg.h"
+#define PTREG_SAVE(r, name)	"stq	" #r ", %[" #name "]\n"
+#define PTREG_SAVE_R(i)		PTREG_SAVE_I($, r, i)
+
+#define PTREG_OUT_R(regsp, i)	PTREG_OUT_I(regsp, 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__ (
+			/* Based on the SAVE_ALL code */
+			PTREG_SAVE_R(0)
+			PTREG_SAVE_R(1)
+			PTREG_SAVE_R(2)
+			PTREG_SAVE_R(3)
+			PTREG_SAVE_R(4)
+			PTREG_SAVE_R(28)
+			"lda	$2, alpha_mv\n"
+			PTREG_SAVE_R(5)
+			PTREG_SAVE_R(6)
+			PTREG_SAVE_R(7)
+			PTREG_SAVE_R(8)
+			PTREG_SAVE_R(19)
+			PTREG_SAVE_R(20)
+			PTREG_SAVE_R(21)
+			"ldq	$2, HAE_CACHE($2)\n"
+			PTREG_SAVE_R(22)
+			PTREG_SAVE_R(23)
+			PTREG_SAVE_R(24)
+			PTREG_SAVE_R(25)
+			PTREG_SAVE_R(26)
+			PTREG_SAVE_R(27)
+			PTREG_SAVE($2, hae)
+			PTREG_SAVE_R(16)
+			PTREG_SAVE_R(17)
+			PTREG_SAVE_R(18)
+
+			PTREG_SAVE_R(9)
+			PTREG_SAVE_R(10)
+			PTREG_SAVE_R(11)
+			PTREG_SAVE_R(12)
+			PTREG_SAVE_R(13)
+			PTREG_SAVE_R(14)
+			PTREG_SAVE_R(15)
+			PTREG_SAVE_R(29)
+			PTREG_SAVE_R(30)
+			PTREG_SAVE_R(31)
+			PTREG_SAVE_REG($gp, gp)
+			PTREG_SAVE_REG($31, ps)
+
+			/* These are almost certainly wrong */
+			PTREG_SAVE_REG(trap_a0, trap_a0)
+			PTREG_SAVE_REG(trap_a1, trap_a1)
+			PTREG_SAVE_REG(trap_a2, trap_a2)
+		/*
+		 * The current location is the one for which the register
+		 * values are correct, even if some had been modified on
+		 * function entry. So, the current location is the value to
+		 * save as the execution address.
+		 */
+		"1b:\n"
+			"lda	$2, 1b\n"
+			PTREG_SAVE($2, pc)
+	:
+		PTREG_OUT_R(regs, 0),
+		PTREG_OUT_R(regs, 1),
+		PTREG_OUT_R(regs, 2),
+		PTREG_OUT_R(regs, 3),
+		PTREG_OUT_R(regs, 4),
+		PTREG_OUT_R(regs, 5),
+		PTREG_OUT_R(regs, 6),
+		PTREG_OUT_R(regs, 7),
+		PTREG_OUT_R(regs, 8),
+		PTREG_OUT_R(regs, 9),
+		PTREG_OUT_R(regs, 10),
+		PTREG_OUT_R(regs, 11),
+		PTREG_OUT_R(regs, 12),
+		PTREG_OUT_R(regs, 13),
+		PTREG_OUT_R(regs, 14),
+		PTREG_OUT_R(regs, 15),
+		PTREG_OUT_R(regs, 16),
+		PTREG_OUT_R(regs, 17),
+		PTREG_OUT_R(regs, 18),
+		PTREG_OUT_R(regs, 19),
+		PTREG_OUT_R(regs, 20),
+		PTREG_OUT_R(regs, 21),
+		PTREG_OUT_R(regs, 22),
+		PTREG_OUT_R(regs, 23),
+		PTREG_OUT_R(regs, 24),
+		PTREG_OUT_R(regs, 25),
+		PTREG_OUT_R(regs, 26),
+		PTREG_OUT_R(regs, 27),
+		PTREG_OUT_R(regs, 28),
+		PTREG_OUT_R(regs, 29),
+		PTREG_OUT_R(regs, 30),
+		PTREG_OUT_R(regs, 31),
+
+		PTREG_OUT(regs, hae, hae),
+		PTREG_OUT(regs, trap_a0, trap_a0),
+		PTREG_OUT(regs, trap_a1, trap_a1),
+		PTREG_OUT(regs, trap_a2, trap_a2),
+		PTREG_OUT(regs, ps, ps),
+		PTREG_OUT(regs, pc, pc),
+		PTREG_OUT(regs, gp, gp)
+	:
+		"$2"
+	);
+
+	return regs;
+}
 #endif
 
 #endif

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/23] Make register values available to Alpha panic notifiers
  2010-04-12  6:06 ` David VomLehn
  (?)
@ 2010-04-12 19:06 ` Sam Ravnborg
  2010-04-14 21:10   ` David VomLehn
  -1 siblings, 1 reply; 5+ messages in thread
From: Sam Ravnborg @ 2010-04-12 19:06 UTC (permalink / raw)
  To: David VomLehn; +Cc: linux-arch, akpm, linux-kernel

On Sun, Apr 11, 2010 at 11:06:13PM -0700, David VomLehn wrote:
> 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/alpha/include/asm/ptrace.h |  124 +++++++++++++++++++++++++++++++++++++++
>  1 files changed, 124 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/alpha/include/asm/ptrace.h b/arch/alpha/include/asm/ptrace.h
> index 65cf3e2..952d177 100644
> --- a/arch/alpha/include/asm/ptrace.h
> +++ b/arch/alpha/include/asm/ptrace.h
> @@ -79,6 +79,130 @@ extern void show_regs(struct pt_regs *);
>  
>  #define force_successful_syscall_return() (task_pt_regs(current)->r0 = 0)
>  
> +/* Macros for saving the contents of registers and for the output constraint
> + * for those registers */
> +#include "/home/vomlehn/git/kernel.org/linux/ptreg.h"
The above include needs fixing.

	Sam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/23] Make register values available to Alpha panic notifiers
  2010-04-12 19:06 ` Sam Ravnborg
@ 2010-04-14 21:10   ` David VomLehn
  0 siblings, 0 replies; 5+ messages in thread
From: David VomLehn @ 2010-04-14 21:10 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-arch, akpm, linux-kernel

Sam Ravnborg wrote:
> On Sun, Apr 11, 2010 at 11:06:13PM -0700, David VomLehn wrote:
>   
>> 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/alpha/include/asm/ptrace.h |  124 +++++++++++++++++++++++++++++++++++++++
>>  1 files changed, 124 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/alpha/include/asm/ptrace.h b/arch/alpha/include/asm/ptrace.h
>> index 65cf3e2..952d177 100644
>> --- a/arch/alpha/include/asm/ptrace.h
>> +++ b/arch/alpha/include/asm/ptrace.h
>> @@ -79,6 +79,130 @@ extern void show_regs(struct pt_regs *);
>>  
>>  #define force_successful_syscall_return() (task_pt_regs(current)->r0 = 0)
>>  
>> +/* Macros for saving the contents of registers and for the output constraint
>> + * for those registers */
>> +#include "/home/vomlehn/git/kernel.org/linux/ptreg.h"
>>     
> The above include needs fixing.
>
> 	Sam
>   
Definitely, thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/23] Make register values available to Alpha panic notifiers
@ 2010-04-12  6:03 David VomLehn
  0 siblings, 0 replies; 5+ messages in thread
From: David VomLehn @ 2010-04-12  6:03 UTC (permalink / raw)
  To: to, linux_arch, linux_arch; +Cc: akpm, linux-kernel, maint_arch

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/alpha/include/asm/ptrace.h |  124 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 124 insertions(+), 0 deletions(-)

diff --git a/arch/alpha/include/asm/ptrace.h b/arch/alpha/include/asm/ptrace.h
index 65cf3e2..952d177 100644
--- a/arch/alpha/include/asm/ptrace.h
+++ b/arch/alpha/include/asm/ptrace.h
@@ -79,6 +79,130 @@ extern void show_regs(struct pt_regs *);
 
 #define force_successful_syscall_return() (task_pt_regs(current)->r0 = 0)
 
+/* Macros for saving the contents of registers and for the output constraint
+ * for those registers */
+#include "/home/vomlehn/git/kernel.org/linux/ptreg.h"
+#define PTREG_SAVE(r, name)	"stq	" #r ", %[" #name "]\n"
+#define PTREG_SAVE_R(i)		PTREG_SAVE_I($, r, i)
+
+#define PTREG_OUT_R(regsp, i)	PTREG_OUT_I(regsp, 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__ (
+			/* Based on the SAVE_ALL code */
+			PTREG_SAVE_R(0)
+			PTREG_SAVE_R(1)
+			PTREG_SAVE_R(2)
+			PTREG_SAVE_R(3)
+			PTREG_SAVE_R(4)
+			PTREG_SAVE_R(28)
+			"lda	$2, alpha_mv\n"
+			PTREG_SAVE_R(5)
+			PTREG_SAVE_R(6)
+			PTREG_SAVE_R(7)
+			PTREG_SAVE_R(8)
+			PTREG_SAVE_R(19)
+			PTREG_SAVE_R(20)
+			PTREG_SAVE_R(21)
+			"ldq	$2, HAE_CACHE($2)\n"
+			PTREG_SAVE_R(22)
+			PTREG_SAVE_R(23)
+			PTREG_SAVE_R(24)
+			PTREG_SAVE_R(25)
+			PTREG_SAVE_R(26)
+			PTREG_SAVE_R(27)
+			PTREG_SAVE($2, hae)
+			PTREG_SAVE_R(16)
+			PTREG_SAVE_R(17)
+			PTREG_SAVE_R(18)
+
+			PTREG_SAVE_R(9)
+			PTREG_SAVE_R(10)
+			PTREG_SAVE_R(11)
+			PTREG_SAVE_R(12)
+			PTREG_SAVE_R(13)
+			PTREG_SAVE_R(14)
+			PTREG_SAVE_R(15)
+			PTREG_SAVE_R(29)
+			PTREG_SAVE_R(30)
+			PTREG_SAVE_R(31)
+			PTREG_SAVE_REG($gp, gp)
+			PTREG_SAVE_REG($31, ps)
+
+			/* These are almost certainly wrong */
+			PTREG_SAVE_REG(trap_a0, trap_a0)
+			PTREG_SAVE_REG(trap_a1, trap_a1)
+			PTREG_SAVE_REG(trap_a2, trap_a2)
+		/*
+		 * The current location is the one for which the register
+		 * values are correct, even if some had been modified on
+		 * function entry. So, the current location is the value to
+		 * save as the execution address.
+		 */
+		"1b:\n"
+			"lda	$2, 1b\n"
+			PTREG_SAVE($2, pc)
+	:
+		PTREG_OUT_R(regs, 0),
+		PTREG_OUT_R(regs, 1),
+		PTREG_OUT_R(regs, 2),
+		PTREG_OUT_R(regs, 3),
+		PTREG_OUT_R(regs, 4),
+		PTREG_OUT_R(regs, 5),
+		PTREG_OUT_R(regs, 6),
+		PTREG_OUT_R(regs, 7),
+		PTREG_OUT_R(regs, 8),
+		PTREG_OUT_R(regs, 9),
+		PTREG_OUT_R(regs, 10),
+		PTREG_OUT_R(regs, 11),
+		PTREG_OUT_R(regs, 12),
+		PTREG_OUT_R(regs, 13),
+		PTREG_OUT_R(regs, 14),
+		PTREG_OUT_R(regs, 15),
+		PTREG_OUT_R(regs, 16),
+		PTREG_OUT_R(regs, 17),
+		PTREG_OUT_R(regs, 18),
+		PTREG_OUT_R(regs, 19),
+		PTREG_OUT_R(regs, 20),
+		PTREG_OUT_R(regs, 21),
+		PTREG_OUT_R(regs, 22),
+		PTREG_OUT_R(regs, 23),
+		PTREG_OUT_R(regs, 24),
+		PTREG_OUT_R(regs, 25),
+		PTREG_OUT_R(regs, 26),
+		PTREG_OUT_R(regs, 27),
+		PTREG_OUT_R(regs, 28),
+		PTREG_OUT_R(regs, 29),
+		PTREG_OUT_R(regs, 30),
+		PTREG_OUT_R(regs, 31),
+
+		PTREG_OUT(regs, hae, hae),
+		PTREG_OUT(regs, trap_a0, trap_a0),
+		PTREG_OUT(regs, trap_a1, trap_a1),
+		PTREG_OUT(regs, trap_a2, trap_a2),
+		PTREG_OUT(regs, ps, ps),
+		PTREG_OUT(regs, pc, pc),
+		PTREG_OUT(regs, gp, gp)
+	:
+		"$2"
+	);
+
+	return regs;
+}
 #endif
 
 #endif

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-04-14 21:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-12  6:06 [PATCH 2/23] Make register values available to Alpha panic notifiers David VomLehn
2010-04-12  6:06 ` David VomLehn
2010-04-12 19:06 ` Sam Ravnborg
2010-04-14 21:10   ` David VomLehn
  -- strict thread matches above, loose matches on Subject: below --
2010-04-12  6:03 David VomLehn

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.