score: Introduce _Internal_error()

This commit is contained in:
Sebastian Huber
2016-12-09 07:19:22 +01:00
parent 0a81a58254
commit 3a659b0481
18 changed files with 42 additions and 55 deletions

View File

@@ -137,7 +137,7 @@ int rtems_gxx_setspecific(__gthread_key_t key, const void *ptr)
#endif
if ( eno != 0 ) {
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_GXX_KEY_ADD_FAILED );
_Internal_error( INTERNAL_ERROR_GXX_KEY_ADD_FAILED );
}
return 0;
@@ -171,7 +171,7 @@ void rtems_gxx_mutex_init (__gthread_mutex_t *mutex)
status
);
#endif
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED );
_Internal_error( INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED );
}
#ifdef DEBUG_GXX_WRAPPERS
printk( "gxx_wrappers: mutex init complete =%X\n", *mutex );

View File

@@ -50,7 +50,7 @@ void RTEMS_Malloc_Initialize(
}
if ( init_or_extend == _Heap_Initialize ) {
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_NO_MEMORY_FOR_HEAP );
_Internal_error( INTERNAL_ERROR_NO_MEMORY_FOR_HEAP );
}
}
}

View File

@@ -85,10 +85,7 @@ void _POSIX_Threads_Initialize_user_threads_body(void)
thread_entry = user_threads[ index ].thread_entry;
if ( thread_entry == NULL ) {
_Terminate(
INTERNAL_ERROR_CORE,
INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL
);
_Internal_error( INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL );
}
if ( register_global_construction ) {
@@ -103,10 +100,7 @@ void _POSIX_Threads_Initialize_user_threads_body(void)
NULL
);
if ( eno != 0 ) {
_Terminate(
INTERNAL_ERROR_CORE,
INTERNAL_ERROR_POSIX_INIT_THREAD_CREATE_FAILED
);
_Internal_error( INTERNAL_ERROR_POSIX_INIT_THREAD_CREATE_FAILED );
}
}
}

View File

@@ -89,18 +89,12 @@ void _RTEMS_tasks_Initialize_user_tasks_body( void )
&id
);
if ( !rtems_is_status_successful( return_value ) ) {
_Terminate(
INTERNAL_ERROR_CORE,
INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED
);
_Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED );
}
entry_point = user_tasks[ index ].entry_point;
if ( entry_point == NULL ) {
_Terminate(
INTERNAL_ERROR_CORE,
INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL
);
_Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL );
}
if ( register_global_construction ) {

View File

@@ -31,5 +31,5 @@ void _CPU_ISR_install_vector(
proc_ptr *old_handler
)
{
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR );
_Internal_error( INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR );
}

View File

@@ -235,6 +235,16 @@ void _Terminate(
Internal_errors_t the_error
) RTEMS_NO_RETURN;
/**
* @brief Terminates the system with an INTERNAL_ERROR_CORE fatal source and
* the specified core error code.
*
* @param[in] core_error The core error code.
*
* @see _Terminate().
*/
void _Internal_error( Internal_errors_Core_list core_error ) RTEMS_NO_RETURN;
#ifdef __cplusplus
}
#endif

View File

@@ -46,3 +46,8 @@ void _Terminate(
/* will not return from this routine */
while (true);
}
void _Internal_error( Internal_errors_Core_list core_error )
{
_Terminate( INTERNAL_ERROR_CORE, core_error );
}

View File

@@ -49,10 +49,7 @@ void _ISR_Handler_initialization( void )
uint32_t cpu_index;
if ( !_Stack_Is_enough( stack_size ) )
_Terminate(
INTERNAL_ERROR_CORE,
INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL
);
_Internal_error( INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL );
for ( cpu_index = 0 ; cpu_index < cpu_max; ++cpu_index ) {
Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );

View File

@@ -95,7 +95,7 @@ static void _MPCI_Handler_initialization( void )
users_mpci_table = _Configuration_MP_table->User_mpci_table;
if ( _System_state_Is_multiprocessing && !users_mpci_table )
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_NO_MPCI );
_Internal_error( INTERNAL_ERROR_NO_MPCI );
_MPCI_table = users_mpci_table;
@@ -187,7 +187,7 @@ MP_packet_Prefix *_MPCI_Get_packet ( void )
(*_MPCI_table->get_packet)( &the_packet );
if ( the_packet == NULL )
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_OUT_OF_PACKETS );
_Internal_error( INTERNAL_ERROR_OUT_OF_PACKETS );
/*
* Put in a default timeout that will be used for
@@ -367,7 +367,7 @@ void _MPCI_Receive_server(
the_function = _MPCI_Packet_processors[ the_packet->the_class ];
if ( !the_function )
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_BAD_PACKET );
_Internal_error( INTERNAL_ERROR_BAD_PACKET );
(*the_function)( the_packet );
}
@@ -449,10 +449,7 @@ void _MPCI_Internal_packets_Process_packet (
_MPCI_Return_packet( the_packet_prefix );
_Terminate(
INTERNAL_ERROR_CORE,
INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION
);
_Internal_error( INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION );
}
_MPCI_Return_packet( the_packet_prefix );

View File

@@ -74,10 +74,7 @@ void _Objects_Do_initialize_information(
* Unlimited and maximum of zero is illogical.
*/
if ( information->auto_extend && maximum_per_allocation == 0) {
_Terminate(
INTERNAL_ERROR_CORE,
INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0
);
_Internal_error( INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0 );
}
/*

View File

@@ -165,7 +165,7 @@ void _Objects_MP_Handler_early_initialization(void)
maximum_nodes = _Configuration_MP_table->maximum_nodes;
if ( node < 1 || node > maximum_nodes )
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_INVALID_NODE );
_Internal_error( INTERNAL_ERROR_INVALID_NODE );
_Objects_Local_node = node;
_Objects_Maximum_nodes = maximum_nodes;
@@ -242,7 +242,7 @@ bool _Objects_MP_Allocate_and_open (
if ( is_fatal_error == false )
return false;
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS );
_Internal_error( INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS );
}
_Objects_MP_Open( information, the_global_object, the_name, the_id );
@@ -282,7 +282,7 @@ void _Objects_MP_Close (
} else {
_Objects_MP_Global_release( &lock_context );
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_INVALID_GLOBAL_ID );
_Internal_error( INTERNAL_ERROR_INVALID_GLOBAL_ID );
}
}

View File

@@ -84,7 +84,7 @@ void _Thread_Handler_initialization(void)
if ( rtems_configuration_get_stack_allocate_hook() == NULL ||
rtems_configuration_get_stack_free_hook() == NULL)
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_BAD_STACK_HOOK );
_Internal_error( INTERNAL_ERROR_BAD_STACK_HOOK );
if ( stack_allocate_init_hook != NULL )
(*stack_allocate_init_hook)( rtems_configuration_get_stack_space_size() );

View File

@@ -154,10 +154,7 @@ void _Thread_Do_dispatch( Per_CPU_Control *cpu_self, ISR_Level level )
&& rtems_configuration_is_smp_enabled()
#endif
) {
_Terminate(
INTERNAL_ERROR_CORE,
INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT
);
_Internal_error( INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT );
}
#endif
@@ -238,10 +235,7 @@ void _Thread_Dispatch_direct( Per_CPU_Control *cpu_self )
ISR_Level level;
if ( cpu_self->thread_dispatch_disable_level != 1 ) {
_Terminate(
INTERNAL_ERROR_CORE,
INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL
);
_Internal_error( INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL );
}
_ISR_Local_disable( level );

View File

@@ -96,5 +96,5 @@ void _Thread_Handler( void )
_User_extensions_Thread_exitted( executing );
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_THREAD_EXITTED );
_Internal_error( INTERNAL_ERROR_THREAD_EXITTED );
}

View File

@@ -173,7 +173,7 @@ Thread_Control *_Thread_MP_Allocate_proxy (
_Thread_MP_Proxies_release( &lock_context );
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_OUT_OF_PROXIES );
_Internal_error( INTERNAL_ERROR_OUT_OF_PROXIES );
/*
* NOTE: The following return ensures that the compiler will

View File

@@ -372,7 +372,7 @@ void _Thread_queue_Deadlock_status( Thread_Control *the_thread )
void _Thread_queue_Deadlock_fatal( Thread_Control *the_thread )
{
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK );
_Internal_error( INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK );
}
static void _Thread_queue_Timeout(
@@ -519,8 +519,7 @@ Status_Control _Thread_queue_Enqueue_sticky(
_Thread_queue_Queue_release( queue, &queue_context->Lock_context.Lock_context );
if ( cpu_self->thread_dispatch_disable_level != 1 ) {
_Terminate(
INTERNAL_ERROR_CORE,
_Internal_error(
INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE
);
}

View File

@@ -136,7 +136,7 @@ static void _Thread_Make_zombie( Thread_Control *the_thread )
{
#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
if ( _Thread_Owns_resources( the_thread ) ) {
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_RESOURCE_IN_USE );
_Internal_error( INTERNAL_ERROR_RESOURCE_IN_USE );
}
#endif

View File

@@ -134,7 +134,7 @@ void _Workspace_Handler_initialization(
}
if ( remaining > 0 ) {
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_TOO_LITTLE_WORKSPACE );
_Internal_error( INTERNAL_ERROR_TOO_LITTLE_WORKSPACE );
}
_Heap_Protection_set_delayed_free_fraction( &_Workspace_Area, 1 );
@@ -200,7 +200,7 @@ void *_Workspace_Allocate_or_fatal_error(
#endif
if ( memory == NULL )
_Terminate( INTERNAL_ERROR_CORE, INTERNAL_ERROR_WORKSPACE_ALLOCATION );
_Internal_error( INTERNAL_ERROR_WORKSPACE_ALLOCATION );
return memory;
}