[PATCH v2] Make instruction dumping work in real mode.

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE6905d

2 messages, 2 authors, 2007-09-26 · open the first message on its own page

[PATCH v2] Make instruction dumping work in real mode.

From: Scott Wood <hidden>
Date: 2007-09-25 20:20:02

On non-book-E-or-4xx, exceptions execute in real mode.  If a fault happens
that leads to a register dump, the kernel currently prints XXXXXXXX because
it doesn't realize that PC is a physical address.

This patch checks the state of the IMMU, and if necessary converts PC into a
virtual address.

Signed-off-by: Scott Wood <redacted>
---
This version uses MSR_IR rather than address heuristics, and fixes breakage
that somehow crept into the address adjustment in the previous patch.

 arch/powerpc/kernel/process.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 57c589c..6dbde7f 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -354,6 +354,14 @@ static void show_instructions(struct pt_regs *regs)
 		if (!(i % 8))
 			printk("\n");
 
+#if !defined(CONFIG_BOOKE) && !defined(CONFIG_40x)
+		/* If executing with the IMMU off, adjust pc rather
+		 * than print XXXXXXXX.
+		 */
+		if (!(regs->msr & MSR_IR))
+			pc = (unsigned long)phys_to_virt(pc);
+#endif
+
 		/* We use __get_user here *only* to avoid an OOPS on a
 		 * bad address because the pc *should* only be a
 		 * kernel address.
-- 
1.5.3.1

Re: [PATCH v2] Make instruction dumping work in real mode.

From: Kumar Gala <hidden>
Date: 2007-09-26 04:06:58

On Sep 25, 2007, at 3:19 PM, Scott Wood wrote:
quoted hunk
On non-book-E-or-4xx, exceptions execute in real mode.  If a fault  
happens
that leads to a register dump, the kernel currently prints XXXXXXXX  
because
it doesn't realize that PC is a physical address.

This patch checks the state of the IMMU, and if necessary converts  
PC into a
virtual address.

Signed-off-by: Scott Wood <redacted>
---
This version uses MSR_IR rather than address heuristics, and fixes  
breakage
that somehow crept into the address adjustment in the previous patch.

 arch/powerpc/kernel/process.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/ 
process.c
index 57c589c..6dbde7f 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -354,6 +354,14 @@ static void show_instructions(struct pt_regs  
*regs)
 		if (!(i % 8))
 			printk("\n");

+#if !defined(CONFIG_BOOKE) && !defined(CONFIG_40x)
40x has a real mode and can have the IMMU off.
+		/* If executing with the IMMU off, adjust pc rather
+		 * than print XXXXXXXX.
+		 */
+		if (!(regs->msr & MSR_IR))
+			pc = (unsigned long)phys_to_virt(pc);
+#endif
+
 		/* We use __get_user here *only* to avoid an OOPS on a
 		 * bad address because the pc *should* only be a
 		 * kernel address.
-- 
1.5.3.1
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help