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

gregory.menke at gsfc.nasa.gov gregory.menke at gsfc.nasa.gov
Thu Jul 15 14:07:16 UTC 2004


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 1.28.2.2, which is RTEMS 4.6.1.
Versions of the file lower than that may not have it.


Gregm




More information about the users mailing list