MIPS with Floating Point: Where is fp status register saved/restored?

Joel Sherrill <joel@OARcorp.com> joel.sherrill at OARcorp.com
Thu Jul 15 19:57:40 UTC 2004

gregory.menke at gsfc.nasa.gov wrote:
> Bruce Robinson writes:
>  > Hello fellow RTEMS develelopers,
>  > 
>  > Maybe someone can help me out? I can't find where the MIPS floating point
>  > coprocessor status register is saved and restored through a context switch
>  > in RTEMS. This is register fcr31. Is it not necessary to explicitly save and
>  > restore it, or did I miss the code, or did it get left out? As a sanity
>  > check, I looked at the Linux kernel code for the MIPS processor and found
>  > where it is saved and restored there.
>  > 
>  > Any feedback would be appreciated!
>  > 
>  > Bruce
> cpukit/score/cpu/mips/cpu_asm.S
> The functions are
> _CPU_Context_save_fp  and  _CPU_Context_restore_fp
> There was a long-standing problem in the MIPS fp context save/restore
> code where the fp status register was not saved & restored along with
> the other fp registers.  This led to an infrequently experienced bug
> where a branch based on an fpu result would be incorrectly taken (or
> not) because a context switch to another fp task occured just after
> the fpu calculation and just before the branch.
> The fix exists in cpu_asm.S version, which is RTEMS 4.6.1.
> Versions of the file lower than that may not have it.

FWIW this was tracked as PR598.  And here is the patch in CVS:


> Gregm

Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985

More information about the users mailing list