On Thu, 6 Jun 2002, Kevin D. Kissell wrote: > It's been a while since I worked on the code, > but I'm not sure why last_task_used_math > needs to be cleared if there is no FPU. > The way the FPU emulator was integrated, > the FPU register storage *is* the thread > context, so if there is no FPU, there was no > FPU context switching, lazy or otherwise. > Sounds like someone broke this. If you check do_cpu in traps.c you'll find: fp_emul: if (last_task_used_math != current) { if (!current->used_math) { fpu_emulator_init_fpu(); current->used_math = 1; } } sig = fpu_emulator_cop1Handler(0, regs, ¤t->thread.fpu.soft); last_task_used_math = current; if (sig) fpu_emulator_init_fpu() is not called, when two processes are created like I described. Alternatively the test "if (last_task_used_math != current)" could be removed. > Beyond that, the CFC1 instruction is presumably > there because in the R4000 (at least) it is specified > as the means to force the FP pipeline to drain > before the context switch. I would suppose this > would be done in Linux to avoid mis-attribution > of FP exceptions. (See chapter 6 of the R4000 > User's manual, page 160 in the Second Edition). Great. It was exactly something like that I was looking for. Perhaps a comment would be nice in the code here ;-) /Kjeld -- _ _ ____ ___ Mailto:kjelde@mips.com |\ /|||___)(___ MIPS Denmark Direct: +45 44 86 55 85 | \/ ||| ____) Lautrupvang 4 B Switch: +45 44 86 55 55 TECHNOLOGIES DK-2750 Ballerup Fax...: +45 44 86 55 56 Denmark http://www.mips.com/