forked from Imagelibrary/rtems
score: Add fatal errors for NULL entry init tasks
This simplifies the global construction. Update #2514.
This commit is contained in:
@@ -74,8 +74,15 @@ void _POSIX_Threads_Initialize_user_threads_body(void)
|
|||||||
_Assert( eno == 0 );
|
_Assert( eno == 0 );
|
||||||
|
|
||||||
thread_entry = user_threads[ index ].thread_entry;
|
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;
|
register_global_construction = false;
|
||||||
thread_entry = (void *(*)(void *)) _Thread_Global_construction;
|
thread_entry = (void *(*)(void *)) _Thread_Global_construction;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <rtems/rtems/support.h>
|
#include <rtems/rtems/support.h>
|
||||||
#include <rtems/rtems/modes.h>
|
#include <rtems/rtems/modes.h>
|
||||||
#include <rtems/rtems/rtemsapi.h>
|
#include <rtems/rtems/rtemsapi.h>
|
||||||
|
#include <rtems/score/assert.h>
|
||||||
#include <rtems/score/stack.h>
|
#include <rtems/score/stack.h>
|
||||||
#include <rtems/rtems/tasksimpl.h>
|
#include <rtems/rtems/tasksimpl.h>
|
||||||
#include <rtems/score/thread.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 );
|
_Terminate( INTERNAL_ERROR_RTEMS_API, true, return_value );
|
||||||
|
|
||||||
entry_point = user_tasks[ index ].entry_point;
|
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;
|
register_global_construction = false;
|
||||||
entry_point = (rtems_task_entry) _Thread_Global_construction;
|
entry_point = (rtems_task_entry) _Thread_Global_construction;
|
||||||
}
|
}
|
||||||
@@ -92,7 +100,7 @@ void _RTEMS_tasks_Initialize_user_tasks_body( void )
|
|||||||
entry_point,
|
entry_point,
|
||||||
user_tasks[ index ].argument
|
user_tasks[ index ].argument
|
||||||
);
|
);
|
||||||
if ( !rtems_is_status_successful( return_value ) )
|
_Assert( rtems_is_status_successful( return_value ) );
|
||||||
_Terminate( INTERNAL_ERROR_RTEMS_API, true, return_value );
|
(void) return_value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
* embedded brains GmbH
|
||||||
* Dornierstr. 4
|
* Dornierstr. 4
|
||||||
@@ -52,7 +52,9 @@ static const char *const internal_error_text[] = {
|
|||||||
"INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED",
|
"INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED",
|
||||||
"INTERNAL_ERROR_NO_MEMORY_FOR_HEAP",
|
"INTERNAL_ERROR_NO_MEMORY_FOR_HEAP",
|
||||||
"INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR",
|
"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 )
|
const char *rtems_internal_error_text( rtems_fatal_code error )
|
||||||
|
|||||||
@@ -161,7 +161,9 @@ typedef enum {
|
|||||||
INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED,
|
INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED,
|
||||||
INTERNAL_ERROR_NO_MEMORY_FOR_HEAP,
|
INTERNAL_ERROR_NO_MEMORY_FOR_HEAP,
|
||||||
INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR,
|
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;
|
} Internal_errors_Core_list;
|
||||||
|
|
||||||
typedef CPU_Uint32ptr Internal_errors_t;
|
typedef CPU_Uint32ptr Internal_errors_t;
|
||||||
|
|||||||
@@ -27,9 +27,10 @@ posix_initialization_threads_table POSIX_Initialization_threads[] = {
|
|||||||
#define FATAL_ERROR_TEST_NAME "1"
|
#define FATAL_ERROR_TEST_NAME "1"
|
||||||
#define FATAL_ERROR_DESCRIPTION \
|
#define FATAL_ERROR_DESCRIPTION \
|
||||||
"POSIX API Init thread create failure - NULL entry"
|
"POSIX API Init thread create failure - NULL entry"
|
||||||
#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_POSIX_API
|
#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE
|
||||||
#define FATAL_ERROR_EXPECTED_IS_INTERNAL FALSE
|
#define FATAL_ERROR_EXPECTED_IS_INTERNAL FALSE
|
||||||
#define FATAL_ERROR_EXPECTED_ERROR ((POSIX_FD_PTHREAD << 8) | EFAULT)
|
#define FATAL_ERROR_EXPECTED_ERROR \
|
||||||
|
INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL
|
||||||
|
|
||||||
void force_error(void)
|
void force_error(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ rtems_initialization_tasks_table Initialization_tasks[] = {
|
|||||||
|
|
||||||
#define FATAL_ERROR_TEST_NAME "2"
|
#define FATAL_ERROR_TEST_NAME "2"
|
||||||
#define FATAL_ERROR_DESCRIPTION "Classic API Init task start failure"
|
#define FATAL_ERROR_DESCRIPTION "Classic API Init task start failure"
|
||||||
#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_RTEMS_API
|
#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE
|
||||||
#define FATAL_ERROR_EXPECTED_IS_INTERNAL TRUE
|
#define FATAL_ERROR_EXPECTED_IS_INTERNAL FALSE
|
||||||
#define FATAL_ERROR_EXPECTED_ERROR RTEMS_INVALID_ADDRESS
|
#define FATAL_ERROR_EXPECTED_ERROR \
|
||||||
|
INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL
|
||||||
|
|
||||||
void force_error()
|
void force_error()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012-2014 embedded brains GmbH. All rights reserved.
|
* Copyright (c) 2012-2015 embedded brains GmbH. All rights reserved.
|
||||||
*
|
*
|
||||||
* embedded brains GmbH
|
* embedded brains GmbH
|
||||||
* Donierstr. 4
|
* Donierstr. 4
|
||||||
@@ -35,7 +35,9 @@ static void test_internal_error_text(void)
|
|||||||
puts( text );
|
puts( text );
|
||||||
} while ( text != text_last );
|
} while ( text != text_last );
|
||||||
|
|
||||||
rtems_test_assert( error - 3 == INTERNAL_ERROR_RESOURCE_IN_USE );
|
rtems_test_assert(
|
||||||
|
error - 3 == INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_fatal_source_text(void)
|
static void test_fatal_source_text(void)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
*** TEST SPINTERNALERROR 2 ***
|
*** BEGIN OF TEST SPINTERNALERROR 2 ***
|
||||||
INTERNAL_ERROR_NO_CONFIGURATION_TABLE
|
INTERNAL_ERROR_NO_CONFIGURATION_TABLE
|
||||||
INTERNAL_ERROR_NO_CPU_TABLE
|
INTERNAL_ERROR_NO_CPU_TABLE
|
||||||
INTERNAL_ERROR_TOO_LITTLE_WORKSPACE
|
INTERNAL_ERROR_TOO_LITTLE_WORKSPACE
|
||||||
@@ -24,6 +24,9 @@ INTERNAL_ERROR_GXX_KEY_ADD_FAILED
|
|||||||
INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED
|
INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED
|
||||||
INTERNAL_ERROR_NO_MEMORY_FOR_HEAP
|
INTERNAL_ERROR_NO_MEMORY_FOR_HEAP
|
||||||
INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR
|
INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR
|
||||||
|
INTERNAL_ERROR_RESOURCE_IN_USE
|
||||||
|
INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL
|
||||||
|
INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL
|
||||||
?
|
?
|
||||||
?
|
?
|
||||||
INTERNAL_ERROR_CORE
|
INTERNAL_ERROR_CORE
|
||||||
|
|||||||
Reference in New Issue
Block a user