diff options
Diffstat (limited to 'cpukit/score')
-rw-r--r-- | cpukit/score/src/threadcreateidle.c | 3 | ||||
-rw-r--r-- | cpukit/score/src/threaddispatch.c | 5 | ||||
-rw-r--r-- | cpukit/score/src/threadhandler.c | 4 | ||||
-rw-r--r-- | cpukit/score/src/userextaddset.c | 21 |
4 files changed, 33 insertions, 0 deletions
diff --git a/cpukit/score/src/threadcreateidle.c b/cpukit/score/src/threadcreateidle.c index 52c3ad4534..d71315005b 100644 --- a/cpukit/score/src/threadcreateidle.c +++ b/cpukit/score/src/threadcreateidle.c @@ -75,6 +75,9 @@ static void _Thread_Create_idle_for_CPU( Per_CPU_Control *cpu ) */ cpu->heir = cpu->executing = idle; +#if defined(RTEMS_SMP) + cpu->ancestor = idle; +#endif idle->is_idle = true; idle->Start.Entry.adaptor = _Thread_Entry_adaptor_idle; diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c index cd32f5a1d2..3b611f7a7a 100644 --- a/cpukit/score/src/threaddispatch.c +++ b/cpukit/score/src/threaddispatch.c @@ -297,10 +297,15 @@ void _Thread_Do_dispatch( Per_CPU_Control *cpu_self, ISR_Level level ) _ISR_Local_enable( level ); +#if !defined(RTEMS_SMP) _User_extensions_Thread_switch( executing, heir ); +#endif _Thread_Save_fp( executing ); _Context_Switch( &executing->Registers, &heir->Registers ); _Thread_Restore_fp( executing ); +#if defined(RTEMS_SMP) + _User_extensions_Thread_switch( NULL, executing ); +#endif /* * We have to obtain this value again after the context switch since the diff --git a/cpukit/score/src/threadhandler.c b/cpukit/score/src/threadhandler.c index 6ddb303299..4b8e386a67 100644 --- a/cpukit/score/src/threadhandler.c +++ b/cpukit/score/src/threadhandler.c @@ -97,6 +97,10 @@ void _Thread_Handler( void ) */ _Thread_Restore_fp( executing ); +#if defined(RTEMS_SMP) + _User_extensions_Thread_switch( NULL, executing ); +#endif + /* * Do not use the level of the thread control block, since it has a * different format. diff --git a/cpukit/score/src/userextaddset.c b/cpukit/score/src/userextaddset.c index 2b13dfad62..70e9fb008f 100644 --- a/cpukit/score/src/userextaddset.c +++ b/cpukit/score/src/userextaddset.c @@ -20,8 +20,28 @@ #endif #include <rtems/score/userextimpl.h> +#include <rtems/score/smp.h> #include <rtems/score/percpu.h> +static void _User_extensions_Set_ancestors( void ) +{ +#if defined(RTEMS_SMP) + if ( _Chain_Is_empty( &_User_extensions_Switches_list ) ) { + uint32_t cpu_max; + uint32_t cpu_index; + + cpu_max = _SMP_Get_processor_maximum(); + + for ( cpu_index = 0 ; cpu_index < cpu_max ; ++cpu_index ) { + Per_CPU_Control *cpu; + + cpu = _Per_CPU_Get_by_index( cpu_index ); + cpu->ancestor = cpu->executing; + } + } +#endif +} + void _User_extensions_Add_set( User_extensions_Control *the_extension ) @@ -45,6 +65,7 @@ void _User_extensions_Add_set( the_extension->Callouts.thread_switch; _Per_CPU_Acquire_all( &lock_context ); + _User_extensions_Set_ancestors(); _Chain_Initialize_node( &the_extension->Switch.Node ); _Chain_Append_unprotected( &_User_extensions_Switches_list, |