Skip to contentSkip to conversation

Make instruction dumping work in real mode.

PATCH Superseded Scott Wood 4 participants 4 messages Sep 27, 2007 PowerPC

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Scott Wood

author
#0 lore raw

PATCH v3 1/1 Make instruction dumping work in real mode.

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.

---
Resent with 40x->44x.

 arch/powerpc/kernel/process.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
arch/powerpc/kernel/process.c +8 -0
index 57c589c..6dbde7f 100644
@@ -354,6 +354,14 @@ static void show_instructions(struct pt_regs *regs)
 		if (!(i % 8))
 			printk("\n");
 
+#if !defined(CONFIG_BOOKE) && !defined(CONFIG_44x)
+		/* 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.
Signature · 1 line
1.5.3.1
#1 lore raw
Quoted 8 lines · Scott Wood

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.

44x is Book-e :)

all you need is a ifndef CONFIG_BOOKE.

- k

#2 lore raw
In reply to Scott Wood

Hello.

Quoted 19 lines · Scott Wood

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.

---
Resent with 40x->44x.

 arch/powerpc/kernel/process.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
arch/powerpc/kernel/process.c +0 -0
index 57c589c..6dbde7f 100644

arch/powerpc/kernel/process.c static void show_instructions(struct pt_regs *regs) · line 357

Quoted 4 lines
arch/powerpc/kernel/process.c +1 -0
@@ -354,6 +354,14 @@ static void show_instructions(struct pt_regs *regs)
 		if (!(i % 8))
 			printk("\n");
 
+#if !defined(CONFIG_BOOKE) && !defined(CONFIG_44x)
    Doesn't CONFIG_44x select CONFIG_BOOKE? Maybe you meant CONFIG_40x?

arch/powerpc/kernel/process.c static void show_instructions(struct pt_regs *regs) · line 367

Quoted 10 lines
arch/powerpc/kernel/process.c +7 -0
+		/* 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.

WBR, Sergei

#3 lore raw
Quoted 26 lines · Sergei Shtylyov

Hello.

Quoted 22 lines · Scott Wood

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.

---
Resent with 40x->44x.

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

arch/powerpc/kernel/process.c static void show_instructions(struct pt_regs *regs) · line 357

Quoted 1 line
arch/powerpc/kernel/process.c +1 -0
+#if !defined(CONFIG_BOOKE) && !defined(CONFIG_44x)
     Doesn't CONFIG_44x select CONFIG_BOOKE? Maybe you meant CONFIG_40x?

Heeheehee! That was the *last* version of the patch. :-)

40x *does* have real mode, so CONFIG_40x is not appropriate here. As Kumar mentioned, only CONFIG_BOOKE is needed.

Cheers,
g.

Signature · 4 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195