Allocation of FP area

Till Straumann strauman at
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


which if defined by the port calls a cpu-specific
'allocator'; the relevant snippet from threadinitialize
would then look like this:

    if ( is_fp ) {
      fp_area = _Context_Fp_allocate( the_thread, CONTEXT_FP_SIZE );
      fp_area = _Workspace_Allocate( CONTEXT_FP_SIZE );
      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;

(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