linux-mips
[Top] [All Lists]

Re: FP emulator patch

To: dan@debian.org
Subject: Re: FP emulator patch
From: Atsushi Nemoto <nemoto@toshiba-tops.co.jp>
Date: Thu, 16 Aug 2001 13:20:42 +0900
Cc: carstenl@mips.com, linux-mips@oss.sgi.com
In-reply-to: <20010815110634.A19305@nevyn.them.org>
Organization: TOSHIBA Personal Computer System Corporation
References: <3B7A70B8.ED92FE4@mips.com> <20010815110634.A19305@nevyn.them.org>
Sender: owner-linux-mips@oss.sgi.com
>>>>> On Wed, 15 Aug 2001 11:06:34 -0700, Daniel Jacobowitz <dan@debian.org> 
>>>>> said:
>> Index: linux/arch/mips/kernel/signal.c
>
>> @@ -353,12 +355,11 @@
>>      owned_fp = (current == last_task_used_math);
>>      err |= __put_user(owned_fp, &sc->sc_ownedfp);
>>  
>> -    if (current->used_math) {       /* fp is active.  */
>> +    if (owned_fp) { /* fp is active.  */
>>              set_cp0_status(ST0_CU1);
>>              err |= save_fp_context(sc);
>>              last_task_used_math = NULL;
>>              regs->cp0_status &= ~ST0_CU1;
>> -            current->used_math = 0;
>>      }
>>  
>>      return err;

dan> This is absolutely not right.  It's righter than the status quo.
dan> If we don't own the FP, you don't save the FP.  Then we can use
dan> FP in the signal handler, corrupting the process's original
dan> floating point context.

I also am trying to fix this problem.  How about my patch?

restore_sigcontext() can be more optimized, but I think this is a
smallest patch to fix the problem.

---
Atsushi Nemoto

Attachment: signal.c.patch
Description: Text document

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