Changeset 7af623bf in rtems for cpukit/score/inline


Ignore:
Timestamp:
Apr 8, 2002, 5:23:11 PM (18 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
40c24d32
Parents:
7b705dc3
Message:

2002-04-08 Chris Johns <ccj@…>

  • Per PR142, make task switch extension its own list.
  • include/rtems/score/userext.h: Reflect above by adding User_extensions_Switch_control and adding it to User_extenions_Control.
  • inline/rtems/score/userext.inl: Allocate all memory in one chunk to minimize overhead. Address processing dedicated switch chain.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/inline/rtems/score/userext.inl

    r7b705dc3 r7af623bf  
    2121/*PAGE
    2222 *
     23 *  _User_extensions_Add_set
     24 *
     25 *  DESCRIPTION:
     26 *
     27 *  This routine is used to add a user extension set to the active list.
     28 */
     29
     30RTEMS_INLINE_ROUTINE void _User_extensions_Add_set (
     31  User_extensions_Control *the_extension,
     32  User_extensions_Table   *extension_table
     33)
     34{
     35  the_extension->Callouts = *extension_table;
     36
     37  _Chain_Append( &_User_extensions_List, &the_extension->Node );
     38
     39  /*
     40   * If a switch handler is present, append it to the switch chain.
     41   */
     42  if ( extension_table->thread_switch != NULL ) {
     43    the_extension->Switch.thread_switch = extension_table->thread_switch;
     44    _Chain_Append( &_User_extensions_Switches_list, &the_extension->Switch.Node );
     45  }
     46}
     47
     48/*PAGE
     49 *
    2350 *  _User_extensions_Handler_initialization
    2451 *
     
    3764
    3865  _Chain_Initialize_empty( &_User_extensions_List );
     66  _Chain_Initialize_empty( &_User_extensions_Switches_list );
    3967
    4068  if ( initial_extensions ) {
    41     for (i=0 ; i<number_of_extensions ; i++ ) {
    42       extension =
    43          _Workspace_Allocate_or_fatal_error( sizeof(User_extensions_Control) );
    44 
    45       extension->Callouts = initial_extensions[i];
    46       _Chain_Append( &_User_extensions_List, &extension->Node );
     69    extension =
     70      _Workspace_Allocate_or_fatal_error(
     71        number_of_extensions * sizeof( User_extensions_Control )
     72      );
     73 
     74    memset (
     75      extension,
     76      0,
     77      number_of_extensions * sizeof( User_extensions_Control )
     78    );
     79 
     80    for ( i = 0 ; i < number_of_extensions ; i++ ) {
     81      _User_extensions_Add_set (extension, &initial_extensions[i]);
     82      extension++;
    4783    }
    4884  }
     
    5187/*PAGE
    5288 *
    53  *  _User_extensions_Add_set
     89 *  _User_extensions_Add_API_set
    5490 *
    55  *  DESCRIPTION:
    56  *
    57  *  This routine is used to add a user extension set to the active list.
    58  */
    59 
    60 RTEMS_INLINE_ROUTINE void _User_extensions_Add_set (
    61   User_extensions_Control *the_extension,
    62   User_extensions_Table   *extension_table
    63 )
    64 {
    65   the_extension->Callouts = *extension_table;
    66 
    67   _Chain_Append( &_User_extensions_List, &the_extension->Node );
    68 }
    69 
    70 /*PAGE
    71  *
    72  *  _User_extensions_Add_API_set
    7391 *  DESCRIPTION:
    7492 *
     
    8098)
    8199{
    82   _Chain_Prepend( &_User_extensions_List, &the_extension->Node );
     100  _User_extensions_Add_set( the_extension );
    83101}
    84  
     102
    85103/*PAGE
    86104 *
     
    97115{
    98116  _Chain_Extract( &the_extension->Node );
     117 
     118  /*
     119   * If a switch handler is present, remove it.
     120   */
     121
     122  if ( the_extension->Callouts.thread_switch != NULL )
     123    _Chain_Extract( &the_extension->Switch.Node );
    99124}
    100125
     
    114139)
    115140{
    116   Chain_Node              *the_node;
    117   User_extensions_Control *the_extension;
    118 
    119   for ( the_node = _User_extensions_List.first ;
    120         !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
     141  Chain_Node                     *the_node;
     142  User_extensions_Switch_control *the_extension_switch;
     143 
     144  for ( the_node = _User_extensions_Switches_list.first ;
     145        !_Chain_Is_tail( &_User_extensions_Switches_list, the_node ) ;
    121146        the_node = the_node->next ) {
    122147
    123     the_extension = (User_extensions_Control *) the_node;
     148    the_extension_switch = (User_extensions_Switch_control *) the_node;
    124149
    125     if ( the_extension->Callouts.thread_switch != NULL )
    126       (*the_extension->Callouts.thread_switch)( executing, heir );
     150    (*the_extension_switch->thread_switch)( executing, heir );
    127151  }
    128152}
Note: See TracChangeset for help on using the changeset viewer.