FP context switching on i386
strauman at slac.stanford.edu
Thu Oct 22 04:17:00 UTC 2009
Thomas Doerfler wrote:
> although I am not at all familiar with i386 ABI stuff, I would guess
> that we have to save the context during a task switch, at least when it
> was forced due to a interrupt (e.g. timer) event. In these cases there
> is no function call involved for the function that uses the FP context.
Wouldn't it then be more efficient to only save/restore FP context
(or any volatile co-processor context) just
around the call to _Thread_Dispatch() from the interrupt exception
handler (assembly) rather than on *every* context switch?
If _Thread_Dispatch() is called from pure C-code (e.g. one task
surrendering a mutex) then saving/restoring the co-processor
context would be superfluous.
As a matter of fact -- if we build e.g. with -maltivec or -msse2 --
we might have to save/restore co-processor context as part
of exception handling anyways (just because gcc will eventually
use the vector units anywhere - possibly in exception handlers
and ISRs, too).
> Till Straumann schrieb:
>> I thought the i386 sysv ABI said that FP registers
>> are not preserved across function calls -- doesn't
>> this mean that there is no need for saving/restoring
>> the FP context ? Am I missing something ?
>> I was thinking about what it takes to support SSE
>> and I believe it may essentially come for free
>> since XMM registers seem not to be callee saved
>> either. Hard to find that information though since
>> doesn't mention SSE yet.
>> -- Till
>> rtems-users mailing list
>> rtems-users at rtems.org
More information about the users