linux-mips
[Top] [All Lists]

Re: kernel_thread creation bug?

To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>, Ralf Baechle <ralf@linux-mips.org>
Subject: Re: kernel_thread creation bug?
From: "Maciej W. Rozycki" <macro@linux-mips.org>
Date: Sat, 23 Oct 2004 05:08:09 +0100 (BST)
Cc: linux-mips@linux-mips.org
In-reply-to: <20041022.212503.39150495.nemoto@toshiba-tops.co.jp>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20041022.170758.48799763.nemoto@toshiba-tops.co.jp> <20041022121647.GA27961@linux-mips.org> <20041022.212503.39150495.nemoto@toshiba-tops.co.jp>
Sender: linux-mips-bounce@linux-mips.org
On Fri, 22 Oct 2004, Atsushi Nemoto wrote:

> >>>>> On Fri, 22 Oct 2004 14:16:48 +0200, Ralf Baechle <ralf@linux-mips.org> 
> >>>>> said:
> >> With recent change in kernel_thread(), initial cp0_status value
> >> comes from current C0_STATUS (which does not include EXL bit).  Is
> >> this correct?  The initial value should contain EXL bit to start
> >> the thread up safely, shouldn't it?
> 
> ralf> Yes ...
> 
> I see the fix in CVS.  Thank you.

 Thanks for tracking down this problem -- I think we want the following
fix on top of yours to handle the R3k style of exception handling.  I
don't have a way to test it ATM (I'd appreciate feedback if anyone could
do that for me), but it should be obvious.

 Ralf, do you agree?

  Maciej

patch-mips-2.6.9-20041023-kernel_thread-r3k-0
diff -up --recursive --new-file 
linux-mips-2.6.9-20041023.macro/arch/mips/kernel/process.c 
linux-mips-2.6.9-20041023/arch/mips/kernel/process.c
--- linux-mips-2.6.9-20041023.macro/arch/mips/kernel/process.c  Sat Oct 23 
03:30:46 2004
+++ linux-mips-2.6.9-20041023/arch/mips/kernel/process.c        Sat Oct 23 
03:43:16 2004
@@ -175,7 +175,10 @@ long kernel_thread(int (*fn)(void *), vo
        regs.regs[5] = (unsigned long) fn;
        regs.cp0_epc = (unsigned long) kernel_thread_helper;
        regs.cp0_status = read_c0_status();
-#if !(defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX))
+#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
+       regs.cp0_status &= ~ST0_KUP;
+       regs.cp0_status |= ST0_IEP;
+#else
        regs.cp0_status |= ST0_EXL;
 #endif
 

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