diff options
Diffstat (limited to 'cpukit/score')
-rw-r--r-- | cpukit/score/include/rtems/score/apiext.h | 22 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/thread.h | 1 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/userext.h | 20 | ||||
-rw-r--r-- | cpukit/score/inline/rtems/score/userext.inl | 24 | ||||
-rw-r--r-- | cpukit/score/macros/rtems/score/userext.inl | 9 | ||||
-rw-r--r-- | cpukit/score/src/apiext.c | 21 | ||||
-rw-r--r-- | cpukit/score/src/thread.c | 7 |
7 files changed, 47 insertions, 57 deletions
diff --git a/cpukit/score/include/rtems/score/apiext.h b/cpukit/score/include/rtems/score/apiext.h index 594c71d25c..44e7bc8dd3 100644 --- a/cpukit/score/include/rtems/score/apiext.h +++ b/cpukit/score/include/rtems/score/apiext.h @@ -18,6 +18,7 @@ #define __API_EXTENSIONS_h #include <rtems/score/chain.h> +#include <rtems/score/thread.h> /* * The control structure which defines the points at which an API @@ -26,11 +27,16 @@ typedef void (*API_extensions_Predriver_hook)(void); typedef void (*API_extensions_Postdriver_hook)(void); +typedef void (*API_extensions_Postswitch_hook)( + Thread_Control * + ); + typedef struct { - Chain_Node Node; - API_extensions_Predriver_hook predriver_hook; - API_extensions_Postdriver_hook postdriver_hook; + Chain_Node Node; + API_extensions_Predriver_hook predriver_hook; + API_extensions_Postdriver_hook postdriver_hook; + API_extensions_Postswitch_hook postswitch_hook; } API_extensions_Control; /* @@ -82,5 +88,15 @@ void _API_extensions_Run_predriver( void ); void _API_extensions_Run_postdriver( void ); +/* + * _API_extensions_Run_postswitch + * + * DESCRIPTION: + * + * XXX + */ + +void _API_extensions_Run_postswitch( void ); + #endif /* end of include file */ diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h index d2ffb41093..94909a3a18 100644 --- a/cpukit/score/include/rtems/score/thread.h +++ b/cpukit/score/include/rtems/score/thread.h @@ -148,6 +148,7 @@ typedef struct { MP_packet_Prefix *receive_packet; /****************** end of common block ********************/ boolean is_global; + boolean do_post_task_switch_extension; Chain_Control *ready; Priority_Information Priority_map; Thread_Start_information Start; diff --git a/cpukit/score/include/rtems/score/userext.h b/cpukit/score/include/rtems/score/userext.h index 424871e895..58fa087780 100644 --- a/cpukit/score/include/rtems/score/userext.h +++ b/cpukit/score/include/rtems/score/userext.h @@ -60,10 +60,6 @@ typedef User_extensions_routine ( *User_extensions_thread_switch_extension )( Thread_Control * ); -typedef User_extensions_routine (*User_extensions_thread_post_switch_extension)( - Thread_Control * - ); - typedef User_extensions_routine ( *User_extensions_thread_begin_extension )( Thread_Control * ); @@ -85,7 +81,6 @@ typedef struct { User_extensions_thread_restart_extension thread_restart; User_extensions_thread_delete_extension thread_delete; User_extensions_thread_switch_extension thread_switch; - User_extensions_thread_post_switch_extension thread_post_switch; User_extensions_thread_begin_extension thread_begin; User_extensions_thread_exitted_extension thread_exitted; User_extensions_fatal_extension fatal; @@ -230,21 +225,6 @@ STATIC INLINE void _User_extensions_Thread_switch ( ); /* - * _User_extensions_Thread_post_switch - * - * DESCRIPTION: - * - * This routine is used to invoke the user extension which is invoked - * after a context switch occurs (i.e. we are running in the context - * of the new thread). - */ - -STATIC INLINE void _User_extensions_Thread_post_switch ( - Thread_Control *executing -); - - -/* * _User_extensions_Thread_begin * * DESCRIPTION: diff --git a/cpukit/score/inline/rtems/score/userext.inl b/cpukit/score/inline/rtems/score/userext.inl index 697a7eddd0..2b4483c553 100644 --- a/cpukit/score/inline/rtems/score/userext.inl +++ b/cpukit/score/inline/rtems/score/userext.inl @@ -99,29 +99,5 @@ STATIC INLINE void _User_extensions_Thread_switch ( } } -/*PAGE - * - * _User_extensions_Thread_post_switch - * - */ - -STATIC INLINE void _User_extensions_Thread_post_switch ( - 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_post_switch != NULL ) - (*the_extension->Callouts.thread_post_switch)( executing ); - } -} - #endif /* end of include file */ diff --git a/cpukit/score/macros/rtems/score/userext.inl b/cpukit/score/macros/rtems/score/userext.inl index 2daa37494d..4b5b8083bf 100644 --- a/cpukit/score/macros/rtems/score/userext.inl +++ b/cpukit/score/macros/rtems/score/userext.inl @@ -122,14 +122,5 @@ #define _User_extensions_Thread_switch( _executing, _heir ) \ _User_extensions_Run_list_forward(thread_switch, (_executing, _heir) ) -/*PAGE - * - * _User_extensions_Thread_post_switch - * - */ - -#define _User_extensions_Thread_post_switch( _executing ) \ - _User_extensions_Run_list_forward(thread_post_switch, (_executing) ) - #endif /* end of include file */ diff --git a/cpukit/score/src/apiext.c b/cpukit/score/src/apiext.c index 68d80bed07..6e82b49a53 100644 --- a/cpukit/score/src/apiext.c +++ b/cpukit/score/src/apiext.c @@ -81,4 +81,25 @@ void _API_extensions_Run_postdriver( void ) } } +/*PAGE + * + * _API_extensions_Run_postswitch + */ + +void _API_extensions_Run_postswitch( void ) +{ + Chain_Node *the_node; + API_extensions_Control *the_extension; + + for ( the_node = _API_extensions_List.first ; + !_Chain_Is_tail( &_API_extensions_List, the_node ) ; + the_node = the_node->next ) { + + the_extension = (API_extensions_Control *) the_node; + + if ( the_extension->postswitch_hook ) + (*the_extension->postswitch_hook)( _Thread_Executing ); + } +} + /* end of file */ diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c index b44da17c67..7cda6e5108 100644 --- a/cpukit/score/src/thread.c +++ b/cpukit/score/src/thread.c @@ -14,6 +14,7 @@ */ #include <rtems/system.h> +#include <rtems/score/apiext.h> #include <rtems/score/context.h> #include <rtems/score/interr.h> #include <rtems/score/isr.h> @@ -200,7 +201,10 @@ void _Thread_Dispatch( void ) _ISR_Enable( level ); - _User_extensions_Thread_post_switch( executing ); + if ( executing->do_post_task_switch_extension ) { + executing->do_post_task_switch_extension = FALSE; + _API_extensions_Run_postswitch(); + } } @@ -813,6 +817,7 @@ void _Thread_Load_environment( is_fp = TRUE; } + the_thread->do_post_task_switch_extension = FALSE; the_thread->is_preemptible = the_thread->Start.is_preemptible; the_thread->is_timeslice = the_thread->Start.is_timeslice; |