Re: Intel floating-point initialization

Albert D. Cahalan (acahalan@cs.uml.edu)
Tue, 19 May 1998 06:32:00 -0400 (EDT)


Xavier Leroy writes:

> In 2.1.102, floating-point initialization in arch/i386/kernel/process.c,
> function copy_thread, has been changed to the following:
>
> /*
> * This tried to copy the FPU state, but I wonder whether we really
> * want this at all. It is probably nicer to just have a newly started
> * process start with a clean slate wrt the fpu. - Linus
> */
> #if 1
> current->used_math = 0;
> current->flags &= ~PF_USEDFPU;
> #else
> if (last_task_used_math == current)
> __asm__("clts ; fnsave %0 ; frstor %0":"=m" (p->tss.i387));
> #endif
>
> I beg to disagree with Linus. The parent process/thread may have set
> the FPU control word to a non-default value (i.e. change rounding
> modes, etc). The programmer legitimely expects the child process to
> inherit those settings (just like it inherits pretty much everything
> else from its parent).
>
> So, it is not correct to reinitialize the FPU in the new process.
> At least the FPU control word should be copied from the parent process.

No, I don't think so. Current loader code on i386 resets the FPU control
word to something sane. Elimination of that reset code would make the
"used FPU" process bit actually mean something like it does on the SPARC.
It ought to save a tiny bit of space and help performance a tiny bit too.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu