PowerPC FP handling weakness.

Duncan Smith dds at flavors.com
Sun Oct 1 17:15:08 UTC 2000


At 8:04 PM +0400 9/29/00, Sergei Organov wrote:
>Joel Sherrill <joel.sherrill at OARcorp.com> writes:
>
>> Eric Valette wrote:
>> >
>> > Sergei Organov wrote:
>> > >
>> > > Eric Valette <valette at crf.canon.fr> writes:
>> > >
>> > > [...]
> > > > > Why don't you send a patch that does deffered FPU registers saving... In
>...



> > I think that in a system where all tasks are FP deferred switching is
>> equivalent to on every switch.  Think about it.  All deferred switching
>> says is that we won't save the context until another FP task is switched
>> in.  This is every time.  Not as clear as it should be but technically
> > OK.


At Flavors we have been using RTEMS for 4 or 5 years on 604/604e MPC105/106, VME boards.  Although the version we use is an old one, the BSP requirement is probably similar.

In our own BSP we do lazy FPU context switching based on actual use of FP through the FP fault.

All processes are FP capable.

Interrupt contexts may also use FP and the interrupt Frames each have an FP save area.  Again the register saving/loading is done on demand.  Here is my comment from my level 0 handler.

d


# ###############################################################################
#
#	FP Unavailable Handler (0x800) Level 0
#
#	N.B. ASR's MAY NOT safely use FP, due to limitations imposed by the
#	EE Handler, and related elements of asynchronous calls to the ASR.
#	One solution to this is to link FP_Contexts in EE frames.
#
#	If ( <In_an_ISR> )
#		if ( <ISR_doesn't_own_FP> )
#			{
#			if ( <Some_Other_ISR_Owns_FP> )
#				Save_ISR_Context( <Other_ISR_Context> );
#			else If (_Thread_Allocated_fp != NULL)
#				{
#				Save_Context( _Thread_Allocated_fp );
#				_Thread_Allocated_fp = NULL;
#				}
#			Restore_ISR_Context( <This_ISR_Context> );
#			<ISR_owns_FP>
#			}
#	else If (_Thread_Allocated_fp != _Thread_Executing)
#		{
#		If (_Thread_Allocated_fp != NULL)
#			Save_Context( _Thread_Allocated_fp );
#		_Thread_Allocated_fp = _Thread_Executing;
#		Restore_Context( _Thread_Allocated_fp );
#		}



More information about the users mailing list