diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-05-09 18:27:26 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-05-09 18:27:26 +0000 |
commit | c3db01d0f37921ba809825e9c6b7fbe86b8fae5d (patch) | |
tree | 0f7adb0ea85567c63adf99d5cf0e67b7598aa61b /cpukit/score/src/userext.c | |
parent | 2007-05-09 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-c3db01d0f37921ba809825e9c6b7fbe86b8fae5d.tar.bz2 |
2007-05-09 Joel Sherrill <joel.sherrill@OARcorp.com>
* libcsupport/include/rtems/libcsupport.h, libcsupport/src/newlibc.c,
sapi/Makefile.am, sapi/include/confdefs.h, sapi/src/exinit.c,
score/Makefile.am, score/preinstall.am,
score/include/rtems/score/userext.h, score/src/chain.c,
score/src/userext.c: Switch to newlib reentrancy extension being
installed in the initial set instead of using rtems_extension_create.
While implementing this, noticed that user extensions and chain code
had multiple functions in a single file which is not desirable in the
SuperCore and API portions of RTEMS, so split these into multiple
files with one function per file. Also noticed that some of user
extension code was inlined for no particular reason so moved that to
C bodies. Split executive shutdown from initialization since not
every application shuts down. Moved __fini call to executive shutdown
to be more symmetrical with where it is called at startup.
* sapi/src/exshutdown.c, score/src/chainappend.c,
score/src/chainextract.c, score/src/chainget.c,
score/src/chaininsert.c, score/src/userextaddapiset.c,
score/src/userextaddset.c, score/src/userextremoveset.c,
score/src/userextthreadbegin.c, score/src/userextthreadcreate.c,
score/src/userextthreaddelete.c, score/src/userextthreadrestart.c,
score/src/userextthreadstart.c, score/src/userextthreadswitch.c: New
files.
* score/inline/rtems/score/userext.inl: Removed.
Diffstat (limited to 'cpukit/score/src/userext.c')
-rw-r--r-- | cpukit/score/src/userext.c | 203 |
1 files changed, 26 insertions, 177 deletions
diff --git a/cpukit/score/src/userext.c b/cpukit/score/src/userext.c index 469200ef76..c23e63f40d 100644 --- a/cpukit/score/src/userext.c +++ b/cpukit/score/src/userext.c @@ -1,9 +1,5 @@ /* - * User Extension Handler - * - * NOTE: XXX - * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -19,187 +15,40 @@ #include <rtems/system.h> #include <rtems/score/userext.h> +#include <rtems/score/wkspace.h> +#include <string.h> -/*PAGE - * - * _User_extensions_Thread_create +/** + * This routine performs the initialization necessary for this handler. */ -boolean _User_extensions_Thread_create ( - Thread_Control *the_thread +void _User_extensions_Handler_initialization ( + uint32_t number_of_extensions, + User_extensions_Table *initial_extensions ) { - Chain_Node *the_node; - User_extensions_Control *the_extension; - boolean status; + User_extensions_Control *extension; + uint32_t i; - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; - the_node = the_node->next ) { + _Chain_Initialize_empty( &_User_extensions_List ); + _Chain_Initialize_empty( &_User_extensions_Switches_list ); - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.thread_create != NULL ) { - status = (*the_extension->Callouts.thread_create)( - _Thread_Executing, - the_thread + if ( initial_extensions ) { + extension = (User_extensions_Control *) + _Workspace_Allocate_or_fatal_error( + number_of_extensions * sizeof( User_extensions_Control ) ); - if ( !status ) - return FALSE; + + 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++; } } - - return TRUE; -} - -/*PAGE - * - * _User_extensions_Thread_delete - */ - -void _User_extensions_Thread_delete ( - Thread_Control *the_thread -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.last ; - !_Chain_Is_head( &_User_extensions_List, the_node ) ; - the_node = the_node->previous ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.thread_delete != NULL ) - (*the_extension->Callouts.thread_delete)( - _Thread_Executing, - the_thread - ); - } -} - -/*PAGE - * - * _User_extensions_Thread_start - * - */ - -void _User_extensions_Thread_start ( - Thread_Control *the_thread -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.thread_start != NULL ) - (*the_extension->Callouts.thread_start)( - _Thread_Executing, - the_thread - ); - } -} - -/*PAGE - * - * _User_extensions_Thread_restart - * - */ - -void _User_extensions_Thread_restart ( - Thread_Control *the_thread -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.thread_restart != NULL ) - (*the_extension->Callouts.thread_restart)( - _Thread_Executing, - the_thread - ); - } -} - -/*PAGE - * - * _User_extensions_Thread_begin - * - */ - -void _User_extensions_Thread_begin ( - Thread_Control *executing -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.first ; - !_Chain_Is_tail( &_User_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.thread_begin != NULL ) - (*the_extension->Callouts.thread_begin)( executing ); - } -} - -/*PAGE - * - * _User_extensions_Thread_exitted - */ - -void _User_extensions_Thread_exitted ( - Thread_Control *executing -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.last ; - !_Chain_Is_head( &_User_extensions_List, the_node ) ; - the_node = the_node->previous ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.thread_exitted != NULL ) - (*the_extension->Callouts.thread_exitted)( executing ); - } } -/*PAGE - * - * _User_extensions_Fatal - */ - -void _User_extensions_Fatal ( - Internal_errors_Source the_source, - boolean is_internal, - uint32_t the_error -) -{ - Chain_Node *the_node; - User_extensions_Control *the_extension; - - for ( the_node = _User_extensions_List.last ; - !_Chain_Is_head( &_User_extensions_List, the_node ) ; - the_node = the_node->previous ) { - - the_extension = (User_extensions_Control *) the_node; - - if ( the_extension->Callouts.fatal != NULL ) - (*the_extension->Callouts.fatal)( the_source, is_internal, the_error ); - } -} |