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 setthe FPU control word to a non-default value (i.e. change roundingmodes, etc). The programmer legitimely expects the child process toinherit those settings (just like it inherits pretty much everythingelse 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.Let's just copy the whole FPU state as the original code meant to do,and fix it so that it works correctly on an SMP machine as well: