diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-12-22 09:13:08 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-01-08 09:00:53 +0100 |
commit | fe100e16117c36c40e99a853d09cd8dcf98dbff0 (patch) | |
tree | 81eb8dd6469908a103e3ade1d378c3a24ff9781b /cpukit | |
parent | bsp/qoriq: Use array for FMan modules (diff) | |
download | rtems-fe100e16117c36c40e99a853d09cd8dcf98dbff0.tar.bz2 |
score: Add fatal errors for NULL entry init tasks
This simplifies the global construction.
Update #2514.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/posix/src/pthreadinitthreads.c | 9 | ||||
-rw-r--r-- | cpukit/rtems/src/taskinitusers.c | 14 | ||||
-rw-r--r-- | cpukit/sapi/src/interrtext.c | 6 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/interr.h | 4 |
4 files changed, 26 insertions, 7 deletions
diff --git a/cpukit/posix/src/pthreadinitthreads.c b/cpukit/posix/src/pthreadinitthreads.c index 3379b7968c..7804c1875f 100644 --- a/cpukit/posix/src/pthreadinitthreads.c +++ b/cpukit/posix/src/pthreadinitthreads.c @@ -74,8 +74,15 @@ void _POSIX_Threads_Initialize_user_threads_body(void) _Assert( eno == 0 ); thread_entry = user_threads[ index ].thread_entry; + if ( thread_entry == NULL ) { + _Terminate( + INTERNAL_ERROR_CORE, + false, + INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL + ); + } - if ( register_global_construction && thread_entry != NULL ) { + if ( register_global_construction ) { register_global_construction = false; thread_entry = (void *(*)(void *)) _Thread_Global_construction; } diff --git a/cpukit/rtems/src/taskinitusers.c b/cpukit/rtems/src/taskinitusers.c index 490ddc73eb..46d0af3f70 100644 --- a/cpukit/rtems/src/taskinitusers.c +++ b/cpukit/rtems/src/taskinitusers.c @@ -24,6 +24,7 @@ #include <rtems/rtems/support.h> #include <rtems/rtems/modes.h> #include <rtems/rtems/rtemsapi.h> +#include <rtems/score/assert.h> #include <rtems/score/stack.h> #include <rtems/rtems/tasksimpl.h> #include <rtems/score/thread.h> @@ -81,8 +82,15 @@ void _RTEMS_tasks_Initialize_user_tasks_body( void ) _Terminate( INTERNAL_ERROR_RTEMS_API, true, return_value ); entry_point = user_tasks[ index ].entry_point; + if ( entry_point == NULL ) { + _Terminate( + INTERNAL_ERROR_CORE, + false, + INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL + ); + } - if ( register_global_construction && entry_point != NULL ) { + if ( register_global_construction ) { register_global_construction = false; entry_point = (rtems_task_entry) _Thread_Global_construction; } @@ -92,7 +100,7 @@ void _RTEMS_tasks_Initialize_user_tasks_body( void ) entry_point, user_tasks[ index ].argument ); - if ( !rtems_is_status_successful( return_value ) ) - _Terminate( INTERNAL_ERROR_RTEMS_API, true, return_value ); + _Assert( rtems_is_status_successful( return_value ) ); + (void) return_value; } } diff --git a/cpukit/sapi/src/interrtext.c b/cpukit/sapi/src/interrtext.c index 09bc215df5..3a0681df41 100644 --- a/cpukit/sapi/src/interrtext.c +++ b/cpukit/sapi/src/interrtext.c @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2012-2014 embedded brains GmbH. All rights reserved. + * Copyright (c) 2012-2015 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Dornierstr. 4 @@ -52,7 +52,9 @@ static const char *const internal_error_text[] = { "INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED", "INTERNAL_ERROR_NO_MEMORY_FOR_HEAP", "INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR", - "INTERNAL_ERROR_RESOURCE_IN_USE" + "INTERNAL_ERROR_RESOURCE_IN_USE", + "INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL", + "INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL" }; const char *rtems_internal_error_text( rtems_fatal_code error ) diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h index f09d6e90a5..ea468e035e 100644 --- a/cpukit/score/include/rtems/score/interr.h +++ b/cpukit/score/include/rtems/score/interr.h @@ -161,7 +161,9 @@ typedef enum { INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED, INTERNAL_ERROR_NO_MEMORY_FOR_HEAP, INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR, - INTERNAL_ERROR_RESOURCE_IN_USE + INTERNAL_ERROR_RESOURCE_IN_USE, + INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL, + INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL } Internal_errors_Core_list; typedef CPU_Uint32ptr Internal_errors_t; |