Bug in arch/i386/signal.c

A.N.Kuznetsov (kuznet@ms2.inr.ac.ru)
Sun, 28 Apr 1996 23:06:17 +0400 (MSD)


Hi!

Apparently, it was bug. When used_math==0, random (zero, to be more
exact) "FPU state" would be saved on stack and "restored" on exit from
signal handler.
I believe, that SMP part is buggy too, but not fixed it.

Alexey Kuznetsov

static inline struct _fpstate * save_i387_hard(struct _fpstate * buf)
{
#ifdef __SMP__
if (current->flags & PF_USEDFPU) {
__asm__ __volatile__("fnsave %0":"=m" (current->tss.i387.hard));
stts();
current->flags &= ~PF_USEDFPU;
}
#else
#ifndef NO_ANK_FIX
if (!current->used_math)
return NULL;
#endif
if (current == last_task_used_math) {
__asm__ __volatile__("fnsave %0":"=m" (current->tss.i387.hard));
last_task_used_math = NULL;
__asm__ __volatile__("fwait"); /* not needed on 486+ */
stts();
}
#endif
current->tss.i387.hard.status = current->tss.i387.hard.swd;