> > > > if (current->used_math) { /* Using the FPU again. > */ > > lazy_fpu_switch(last_task_used_math); > > } else { /* First time FPU user. > */ > > init_fpu(); > > current->used_math = 1; > > } > > last_task_used_math = current; > > > > Clearly the second path is logically the correct one. > > Not really. See below. > > > BTW, do I see another bug here in do_cpu()? It seems that before we call > > init_fpu(), we should check last_task_used_math. If it is not NULL, we > should > > save the FP state to the last_task_used_math. Hmm, strange ... > > Strange indeed. And note that if the code were correct, your > surmise about the init_fpu() path being "logically the correct" > one would no longer be true - we'd be saving the FPU state of > the current process for no good reason. And note further that, by forcing current->used_math to zero, the old code was in fact driving the signal handler needlessly into the broken code... Kevin K.