Floating Point Operation in Kernel

Grant Likely grant.likely at secretlab.ca
Wed Dec 13 09:09:01 EST 2006


On 12/12/06, jimmy liu <jimmyzhmliu at yahoo.com> wrote:
> I am writing a module which need be integrated to the
> linux kernel with floating point operations for
> mpc82xx. The kernel does not provide support for
> floating point operations. Does anybody have good idea
> to implement it or make it to work around?

The official answer is: "Don't do that."  :)

Here's the more generous reply:  The kernel explicitly does not
support floating point in the kernel.  Save/restore on floating point
registers is expensive.  In fact, IIRC, floating point registers for
user space use 'lazy save/restore'; ie. the registers are not saved on
every context switch; they are only saved if another user space
process tries to perform FP operations.

To support FP access in kernel space means you must fit your code into
the already complex FP save/restore state machine; or you need to
disable all interrupts and perform your own FP register save/restore
within the context of your driver.  And it's a pretty safe bet that
you'll have trouble getting the driver into mainline.

Why do you need kernel space FP?

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely at secretlab.ca
(403) 399-0195



More information about the Linuxppc-embedded mailing list