From 7af623bf688801ea93d2b57afa4861e7a9136fb4 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 8 Apr 2002 17:23:11 +0000 Subject: [PATCH] 2002-04-08 Chris Johns * 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. --- c/src/exec/score/ChangeLog | 8 ++ .../exec/score/inline/rtems/score/userext.inl | 94 ++++++++++++------- cpukit/score/ChangeLog | 8 ++ cpukit/score/inline/rtems/score/userext.inl | 94 ++++++++++++------- 4 files changed, 134 insertions(+), 70 deletions(-) diff --git a/c/src/exec/score/ChangeLog b/c/src/exec/score/ChangeLog index 12e3aec7c7..f9a62e2faf 100644 --- a/c/src/exec/score/ChangeLog +++ b/c/src/exec/score/ChangeLog @@ -1,3 +1,11 @@ +2002-04-08 Chris Johns + + * 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. + 2002-03-27 Ralf Corsepius * cpu/Makefile.am: Remove AUTOMAKE_OPTIONS. diff --git a/c/src/exec/score/inline/rtems/score/userext.inl b/c/src/exec/score/inline/rtems/score/userext.inl index 06f1525680..9c8cb43731 100644 --- a/c/src/exec/score/inline/rtems/score/userext.inl +++ b/c/src/exec/score/inline/rtems/score/userext.inl @@ -18,6 +18,33 @@ #include +/*PAGE + * + * _User_extensions_Add_set + * + * DESCRIPTION: + * + * This routine is used to add a user extension set to the active list. + */ + +RTEMS_INLINE_ROUTINE void _User_extensions_Add_set ( + User_extensions_Control *the_extension, + User_extensions_Table *extension_table +) +{ + the_extension->Callouts = *extension_table; + + _Chain_Append( &_User_extensions_List, &the_extension->Node ); + + /* + * If a switch handler is present, append it to the switch chain. + */ + if ( extension_table->thread_switch != NULL ) { + the_extension->Switch.thread_switch = extension_table->thread_switch; + _Chain_Append( &_User_extensions_Switches_list, &the_extension->Switch.Node ); + } +} + /*PAGE * * _User_extensions_Handler_initialization @@ -36,40 +63,31 @@ RTEMS_INLINE_ROUTINE void _User_extensions_Handler_initialization ( unsigned32 i; _Chain_Initialize_empty( &_User_extensions_List ); + _Chain_Initialize_empty( &_User_extensions_Switches_list ); if ( initial_extensions ) { - for (i=0 ; iCallouts = initial_extensions[i]; - _Chain_Append( &_User_extensions_List, &extension->Node ); + extension = + _Workspace_Allocate_or_fatal_error( + number_of_extensions * sizeof( User_extensions_Control ) + ); + + memset ( + extension, + 0, + number_of_extensions * sizeof( User_extensions_Control ) + ); + + for ( i = 0 ; i < number_of_extensions ; i++ ) { + _User_extensions_Add_set (extension, &initial_extensions[i]); + extension++; } } } -/*PAGE - * - * _User_extensions_Add_set - * - * DESCRIPTION: - * - * This routine is used to add a user extension set to the active list. - */ - -RTEMS_INLINE_ROUTINE void _User_extensions_Add_set ( - User_extensions_Control *the_extension, - User_extensions_Table *extension_table -) -{ - the_extension->Callouts = *extension_table; - - _Chain_Append( &_User_extensions_List, &the_extension->Node ); -} - /*PAGE * * _User_extensions_Add_API_set + * * DESCRIPTION: * * This routine is used to add an API extension set to the active list. @@ -79,9 +97,9 @@ RTEMS_INLINE_ROUTINE void _User_extensions_Add_API_set ( User_extensions_Control *the_extension ) { - _Chain_Prepend( &_User_extensions_List, &the_extension->Node ); + _User_extensions_Add_set( the_extension ); } - + /*PAGE * * _User_extensions_Remove_set @@ -96,6 +114,13 @@ RTEMS_INLINE_ROUTINE void _User_extensions_Remove_set ( ) { _Chain_Extract( &the_extension->Node ); + + /* + * If a switch handler is present, remove it. + */ + + if ( the_extension->Callouts.thread_switch != NULL ) + _Chain_Extract( &the_extension->Switch.Node ); } /*PAGE @@ -113,17 +138,16 @@ RTEMS_INLINE_ROUTINE void _User_extensions_Thread_switch ( Thread_Control *heir ) { - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; + Chain_Node *the_node; + User_extensions_Switch_control *the_extension_switch; + + for ( the_node = _User_extensions_Switches_list.first ; + !_Chain_Is_tail( &_User_extensions_Switches_list, the_node ) ; the_node = the_node->next ) { - the_extension = (User_extensions_Control *) the_node; + the_extension_switch = (User_extensions_Switch_control *) the_node; - if ( the_extension->Callouts.thread_switch != NULL ) - (*the_extension->Callouts.thread_switch)( executing, heir ); + (*the_extension_switch->thread_switch)( executing, heir ); } } diff --git a/cpukit/score/ChangeLog b/cpukit/score/ChangeLog index 12e3aec7c7..f9a62e2faf 100644 --- a/cpukit/score/ChangeLog +++ b/cpukit/score/ChangeLog @@ -1,3 +1,11 @@ +2002-04-08 Chris Johns + + * 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. + 2002-03-27 Ralf Corsepius * cpu/Makefile.am: Remove AUTOMAKE_OPTIONS. diff --git a/cpukit/score/inline/rtems/score/userext.inl b/cpukit/score/inline/rtems/score/userext.inl index 06f1525680..9c8cb43731 100644 --- a/cpukit/score/inline/rtems/score/userext.inl +++ b/cpukit/score/inline/rtems/score/userext.inl @@ -18,6 +18,33 @@ #include +/*PAGE + * + * _User_extensions_Add_set + * + * DESCRIPTION: + * + * This routine is used to add a user extension set to the active list. + */ + +RTEMS_INLINE_ROUTINE void _User_extensions_Add_set ( + User_extensions_Control *the_extension, + User_extensions_Table *extension_table +) +{ + the_extension->Callouts = *extension_table; + + _Chain_Append( &_User_extensions_List, &the_extension->Node ); + + /* + * If a switch handler is present, append it to the switch chain. + */ + if ( extension_table->thread_switch != NULL ) { + the_extension->Switch.thread_switch = extension_table->thread_switch; + _Chain_Append( &_User_extensions_Switches_list, &the_extension->Switch.Node ); + } +} + /*PAGE * * _User_extensions_Handler_initialization @@ -36,40 +63,31 @@ RTEMS_INLINE_ROUTINE void _User_extensions_Handler_initialization ( unsigned32 i; _Chain_Initialize_empty( &_User_extensions_List ); + _Chain_Initialize_empty( &_User_extensions_Switches_list ); if ( initial_extensions ) { - for (i=0 ; iCallouts = initial_extensions[i]; - _Chain_Append( &_User_extensions_List, &extension->Node ); + extension = + _Workspace_Allocate_or_fatal_error( + number_of_extensions * sizeof( User_extensions_Control ) + ); + + memset ( + extension, + 0, + number_of_extensions * sizeof( User_extensions_Control ) + ); + + for ( i = 0 ; i < number_of_extensions ; i++ ) { + _User_extensions_Add_set (extension, &initial_extensions[i]); + extension++; } } } -/*PAGE - * - * _User_extensions_Add_set - * - * DESCRIPTION: - * - * This routine is used to add a user extension set to the active list. - */ - -RTEMS_INLINE_ROUTINE void _User_extensions_Add_set ( - User_extensions_Control *the_extension, - User_extensions_Table *extension_table -) -{ - the_extension->Callouts = *extension_table; - - _Chain_Append( &_User_extensions_List, &the_extension->Node ); -} - /*PAGE * * _User_extensions_Add_API_set + * * DESCRIPTION: * * This routine is used to add an API extension set to the active list. @@ -79,9 +97,9 @@ RTEMS_INLINE_ROUTINE void _User_extensions_Add_API_set ( User_extensions_Control *the_extension ) { - _Chain_Prepend( &_User_extensions_List, &the_extension->Node ); + _User_extensions_Add_set( the_extension ); } - + /*PAGE * * _User_extensions_Remove_set @@ -96,6 +114,13 @@ RTEMS_INLINE_ROUTINE void _User_extensions_Remove_set ( ) { _Chain_Extract( &the_extension->Node ); + + /* + * If a switch handler is present, remove it. + */ + + if ( the_extension->Callouts.thread_switch != NULL ) + _Chain_Extract( &the_extension->Switch.Node ); } /*PAGE @@ -113,17 +138,16 @@ RTEMS_INLINE_ROUTINE void _User_extensions_Thread_switch ( Thread_Control *heir ) { - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; + Chain_Node *the_node; + User_extensions_Switch_control *the_extension_switch; + + for ( the_node = _User_extensions_Switches_list.first ; + !_Chain_Is_tail( &_User_extensions_Switches_list, the_node ) ; the_node = the_node->next ) { - the_extension = (User_extensions_Control *) the_node; + the_extension_switch = (User_extensions_Switch_control *) the_node; - if ( the_extension->Callouts.thread_switch != NULL ) - (*the_extension->Callouts.thread_switch)( executing, heir ); + (*the_extension_switch->thread_switch)( executing, heir ); } }