Coldfile and Floating Point Context

Till Straumann strauman at slac.stanford.edu
Mon Mar 16 15:42:46 UTC 2009


Sebastian Huber wrote:
> Hi,
>
> I have problems with an initialization task with enabled floating point (which
> is needed for the global C++ constructors).  The call to
> _CPU_Context_restore_fp results in an exception because it tries to execute a
> floating point instruction with DF set in the CACR register (= disabled
> floating point).  Why is the floating point unit not enabled in the
> restore/save FP routines?  On the PowerPC platform the FP unit will be enabled
> during a restore/save 
and only during the save/restore, i.e., the algorithm is

if ( ! (wasOn = fpuIsEnabled()) ) {
     switch_fpu_on();
}

/* save/restore FP regs */

if ( ! wasOn ) {
    switch_fpu_off();
}

to make sure the actual on/off state of the FPU
after execution is the same as before.

T.
> since a FP context switch may occur in an ISR or
> exception handler when the FPU is not available.  Is this different on the
> ColdFire?  Where is the right place to enable the FP unit?
>
> Have a nice day!
>
>   




More information about the users mailing list