M68k/ColdFire: FPU context initialization
Joel Sherrill
joel.sherrill at oarcorp.com
Mon Nov 5 18:49:18 UTC 2007
Thomas Doerfler wrote:
> Joel,
>
> thank you.
>
> Joel Sherrill schrieb:
>
>> If the thread is not an FP task, you would prefer to disable the FPU.
>> If it is FP enabled, then all that you have to initialize is usually
>> the control registers.
>>
>
> Ok, agreed, but in cpu_asm.S, in the assembly code to
> _CPU_Context_restore_fp, even the initialization of the FPU control
> registers is skipped, when the "NULL-frame" flag is zero.
>
I hate to say this but we wrote that code in 1989. I recall
it being almost directly out of the manual but couldn't
prove that today. :)
> This means, that the FPU control register would remain in the state of
> the last task that executed. IMHO this might lead to unexpected values
> in the control register: If one task sets the control register to very
> special rounding modes etc, then it might inherit this to a newly
> created task.
>
>
True. I don't have a particularly strong opinion on this
so if you have suggestions, I am happy to go along.
--joel
>> Is the Coldfire FPU similar to the 68881 or is it more RISC like?
>> Do you have the same type of fsave/restore instructions?
>>
>
> It implements a subset of the 68881 instructions, has only 64 bit per FP
> register (instead of the old 80 bit model in 68881 and friends). It has
> an fsave/frestore (which generates a smaller context).
>
> Additionally the CF v4e has an EMAC unit, with about 7 registers, and we
> want to add them to the FPU context. They also have a similar
> status/control register and we are currently thinking on where to
> initialize it properly.
>
> Thomas.
>
>
>
>>> Any hint appreciated,
>>>
>>> Thomas Dörfler.
>>>
>>>
>>>
>>>
>>>
>
>
>
More information about the users
mailing list