floating point in kernel (Re: insmod problem)

Roger Larsson roger.larsson at norran.net
Sat May 14 12:55:29 EST 2005


On Friday 13 May 2005 15.46, Kumar Gala wrote:
> On May 13, 2005, at 8:14 AM, Mark Chambers wrote:
> >  > You're using floating arithmetic in the kernel.
> >  >
> >  > That's not supported.
> >  >
> >  > Regards
> >  >
> >  > Pantelis
> >
> > Just for my edification:  Is floating point itself not supported
> > (floating
> >  point register
> >  corruption or something like that) or just linking to user space
> > libraries?
>
> Use of floating point registers and instructions.  Its possible to use
> FP in rare cases inside the kernel buts its extremely discouraged.
>

The kernel is doing lazy saving of FP registers, only saving for user 
processes that uses them.  And especially avoiding to save for every
interrupt!

So if you like to use any FP (registers) in kernel you have to:
- disable kernel preemption (YES)
- save previous value
- do your stuff
- restore
- enable preemption

I remember a preemption bug caused by using MMX/SSE to copy
memory uncached.

/RogerL



More information about the Linuxppc-embedded mailing list