Allocation of FP area
Till Straumann
strauman at slac.stanford.edu
Fri Nov 13 14:47:59 UTC 2009
If a CPU has FP support then RTEMS forcefully
allocates a context area.
In some cases, e.g., if a port decides to manage
the FPU together with the general context, it might
be more efficient to make the FP context area
part of the general register context because
this saves one call to the allocator.
Also, a port might have special alignment requirements
which are not met by the default allocator.
Hence I propose to introduce an additional macro
like
CPU_ALLOCATES_FP_AREA
which if defined by the port calls a cpu-specific
'allocator'; the relevant snippet from threadinitialize
would then look like this:
#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
if ( is_fp ) {
#if ( CPU_ALLOCATES_FP_AREA == TRUE )
fp_area = _Context_Fp_allocate( the_thread, CONTEXT_FP_SIZE );
#else
fp_area = _Workspace_Allocate( CONTEXT_FP_SIZE );
#endif
if ( !fp_area )
goto failed;
fp_area = _Context_Fp_start( fp_area, 0 );
}
the_thread->fp_context = fp_area;
the_thread->Start.fp_context = fp_area;
#endif
(the 'the_thread' pointer is passed so that the port
could just calculate and return a pointer to the
register area instead of doing a real allocation)
-- Till
More information about the users
mailing list