Subject: Re: Floating point in the kernel
To: Chris G. Demetriou <cgd@netbsd.org>
From: Martin Husemann <martin@rumolt.teuto.de>
List: tech-kern
Date: 09/19/1998 10:47:34
[ FP in kernel when kernel threads are there ]

> I believe that the notion was that one day that might be 'fixed.'
> 
> But, because there are lots of them and they may switch often, you
> really want kernel thread switching ot be as lightweight as
> possible...  So i still think it's unlikely.

There should be a flag "not using fp" in the per-thread structure and when
switching to or from a thread with this not beeing set the expensive register
recovery could be used.

Or there could be a pointer to FPU-context for the thread with most threads
sharing one context and special short-circuit code when switching between
two threads with the same FPU-context-pointer.

I don't know how the interrupt stubs would handle this, but probably they
don't need any special action as long as they don't use floating point.
So FP could be enabled on a per thread basis only in the upper half of the
kernel without major overhead for the general case.


Martin