From a38ced268314dfe3f61cbba5b982eeb77c2b8de4 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 10 Oct 2014 09:09:19 +0200 Subject: score: Rework global construction Ensure that the global construction is performed in the context of the first initialization thread. On SMP this was not guaranteed in the previous implementation. --- cpukit/rtems/src/taskinitusers.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'cpukit/rtems/src/taskinitusers.c') diff --git a/cpukit/rtems/src/taskinitusers.c b/cpukit/rtems/src/taskinitusers.c index 51fb474a3e..490ddc73eb 100644 --- a/cpukit/rtems/src/taskinitusers.c +++ b/cpukit/rtems/src/taskinitusers.c @@ -48,6 +48,8 @@ void _RTEMS_tasks_Initialize_user_tasks_body( void ) rtems_id id; rtems_status_code return_value; rtems_initialization_tasks_table *user_tasks; + bool register_global_construction; + rtems_task_entry entry_point; /* * Move information into local variables @@ -61,6 +63,8 @@ void _RTEMS_tasks_Initialize_user_tasks_body( void ) if ( !user_tasks ) return; + register_global_construction = true; + /* * Now iterate over the initialization tasks and create/start them. */ @@ -76,9 +80,16 @@ void _RTEMS_tasks_Initialize_user_tasks_body( void ) if ( !rtems_is_status_successful( return_value ) ) _Terminate( INTERNAL_ERROR_RTEMS_API, true, return_value ); + entry_point = user_tasks[ index ].entry_point; + + if ( register_global_construction && entry_point != NULL ) { + register_global_construction = false; + entry_point = (rtems_task_entry) _Thread_Global_construction; + } + return_value = rtems_task_start( id, - user_tasks[ index ].entry_point, + entry_point, user_tasks[ index ].argument ); if ( !rtems_is_status_successful( return_value ) ) -- cgit v1.2.3