[ECOS] Floating Point Register saves

Nick Garnett nickg@ecoscentric.com
Tue Sep 28 11:01:00 GMT 2004

David Brennan <eCos@brennanhome.com> writes:

> According to the documentation in the i386 hal cdl documentation, it
> states that by default eCos will "save and restore FPU state on every
> thread switch, interrupt and exception." It states this in the option
> for turning off lazy FPU switching. Our application uses floating
> point registers in the DSR context. With Lazy FPU on, we get an
> SIGFPE. (Which I guess is not surprising). So we have turned off lazy
> FPU switching. With lazy FPU off, is it safe to use floating points in
> DSR (or ISR) context? (We got burned by this earlier under VxWorks.)

In theory using the FPU in ISRs and DSRs is allowed, there is code to
save and restore the FPU state in both lazy and non-lazy
configurations. Of course this has not been exercised very much and
may contain bugs. You may have to some debugging.

However, I would also question the need to do FP operations in ISRs
and DSRs. These routines are meant to be fast and small. It is often
better to offload any complex computations to a thread. Note that even
if the DSR only does a small amount of FP computation, the cost of
saving and restoring the FP state to let it do so is very high. 

Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list