linux-mips
[Top] [All Lists]

Re: Breakage in arch/mips/kernel/traps.c for 64bit

To: ralf@linux-mips.org
Subject: Re: Breakage in arch/mips/kernel/traps.c for 64bit
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Sun, 04 May 2008 01:16:47 +0900 (JST)
Cc: tsbogend@alpha.franken.de, linux-mips@linux-mips.org
In-reply-to: <20080502101113.GA24408@linux-mips.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20080501163314.GA9955@alpha.franken.de> <20080502101113.GA24408@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
On Fri, 2 May 2008 11:11:13 +0100, Ralf Baechle <ralf@linux-mips.org> wrote:
> It came as part of 39b8d5254246ac56342b72f812255c8f7a74dca9 which is a
> patch amalgated from several other patches.  Below is the original patch
> it came with.  I think the idea of the patch is valid but the idea needs a
> bit of mending.

Then how about this fix?

---------------------------------------------------------------------
Subject: [PATCH] Fix detection of kernel segment on 64-bit

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index cb8b0e2..7893bb3 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -78,6 +78,19 @@ void (*board_nmi_handler_setup)(void);
 void (*board_ejtag_handler_setup)(void);
 void (*board_bind_eic_interrupt)(int irq, int regset);
 
+static inline int kernel_unmapped_seg(void *addr)
+{
+       unsigned long a = (unsigned long)addr;
+
+#ifdef CONFIG_32BIT
+       /* KSEG0 or KSEG1 */
+       return (a & 0xc0000000) == KSEG0;
+#else
+       /* CKSEG0, CKSEG1 or XKPHYS  */
+       return ((a & 0xffffffffc0000000L) == CKSEG0) ||
+               ((a & 0xc000000000000000L) == XKPHYS);
+#endif
+}
 
 static void show_raw_backtrace(unsigned long reg29)
 {
@@ -88,8 +101,7 @@ static void show_raw_backtrace(unsigned long reg29)
 #ifdef CONFIG_KALLSYMS
        printk("\n");
 #endif
-#define IS_KVA01(a) ((((unsigned int)a) & 0xc0000000) == 0x80000000)
-       if (IS_KVA01(sp)) {
+       if (kernel_unmapped_seg(sp)) {
                while (!kstack_end(sp)) {
                        addr = *sp++;
                        if (__kernel_text_address(addr))

<Prev in Thread] Current Thread [Next in Thread>