diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-01-07 09:55:45 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-01-11 08:47:01 +0100 |
commit | ccd54344d904b657123e4e4ba795a32212382be2 (patch) | |
tree | d490d77b6173f586137036ed07ec5bd27d8ca65a /cpukit/rtems | |
parent | smptests/README: Delete obsolete information (diff) | |
download | rtems-ccd54344d904b657123e4e4ba795a32212382be2.tar.bz2 |
score: Introduce Thread_Entry_information
This avoids potential dead code in _Thread_Handler(). It gets rid of
the dangerous function pointer casts.
Update #2514.
Diffstat (limited to 'cpukit/rtems')
-rw-r--r-- | cpukit/rtems/src/taskinitusers.c | 7 | ||||
-rw-r--r-- | cpukit/rtems/src/taskrestart.c | 5 | ||||
-rw-r--r-- | cpukit/rtems/src/taskstart.c | 24 |
3 files changed, 22 insertions, 14 deletions
diff --git a/cpukit/rtems/src/taskinitusers.c b/cpukit/rtems/src/taskinitusers.c index f5c2f82995..aeed5b4523 100644 --- a/cpukit/rtems/src/taskinitusers.c +++ b/cpukit/rtems/src/taskinitusers.c @@ -33,11 +33,14 @@ static void _RTEMS_Global_construction( rtems_task_argument arg ) { - Thread_Entry entry_point = (Thread_Entry) + Thread_Control *executing = _Thread_Get_executing(); + Thread_Entry_information entry = executing->Start.Entry; + + entry.Kinds.Numeric.entry = Configuration_RTEMS_API.User_initialization_tasks_table[ 0 ].entry_point; (void) arg; - _Thread_Global_construction( entry_point ); + _Thread_Global_construction( executing, &entry ); } /* diff --git a/cpukit/rtems/src/taskrestart.c b/cpukit/rtems/src/taskrestart.c index 0b56ed5b18..8aa7c73d9a 100644 --- a/cpukit/rtems/src/taskrestart.c +++ b/cpukit/rtems/src/taskrestart.c @@ -28,12 +28,15 @@ rtems_status_code rtems_task_restart( { Thread_Control *the_thread; Objects_Locations location; + Thread_Entry_information entry; the_thread = _Thread_Get( id, &location ); switch ( location ) { case OBJECTS_LOCAL: - if ( _Thread_Restart( the_thread, _Thread_Executing, NULL, argument ) ) { + entry = the_thread->Start.Entry; + entry.Kinds.Numeric.argument = argument; + if ( _Thread_Restart( the_thread, _Thread_Executing, &entry ) ) { _Objects_Put( &the_thread->Object ); return RTEMS_SUCCESSFUL; } diff --git a/cpukit/rtems/src/taskstart.c b/cpukit/rtems/src/taskstart.c index d6f15d8624..39b3e9ca1d 100644 --- a/cpukit/rtems/src/taskstart.c +++ b/cpukit/rtems/src/taskstart.c @@ -44,9 +44,18 @@ rtems_status_code rtems_task_start( rtems_task_argument argument ) { - Thread_Control *the_thread; - Objects_Locations location; - bool successfully_started; + Thread_Entry_information entry = { + .adaptor = _Thread_Entry_adaptor_numeric, + .Kinds = { + .Numeric = { + .entry = entry_point, + .argument = argument + } + } + }; + Thread_Control *the_thread; + Objects_Locations location; + bool successfully_started; if ( entry_point == NULL ) return RTEMS_INVALID_ADDRESS; @@ -55,14 +64,7 @@ rtems_status_code rtems_task_start( switch ( location ) { case OBJECTS_LOCAL: - successfully_started = _Thread_Start( - the_thread, - THREAD_START_NUMERIC, - entry_point, - NULL, - argument, - NULL - ); + successfully_started = _Thread_Start( the_thread, &entry, NULL ); _Objects_Put( &the_thread->Object ); |