summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-12-09 07:19:22 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-12-12 08:03:29 +0100
commit3a659b04818c61d9fa99edcfdff4786adb71cd3f (patch)
tree9fc034fe0df2d81e80f8d8cbd651bd139321255f
parentAdd INTERNAL_ERROR_POSIX_INIT_THREAD_CREATE_FAILED (diff)
downloadrtems-3a659b04818c61d9fa99edcfdff4786adb71cd3f.tar.bz2
score: Introduce _Internal_error()
-rw-r--r--cpukit/libcsupport/src/gxx_wrappers.c4
-rw-r--r--cpukit/libcsupport/src/malloc_initialize.c2
-rw-r--r--cpukit/posix/src/pthreadinitthreads.c10
-rw-r--r--cpukit/rtems/src/taskinitusers.c10
-rw-r--r--cpukit/score/cpu/powerpc/ppc-isr-vector-install.c2
-rw-r--r--cpukit/score/include/rtems/score/interr.h10
-rw-r--r--cpukit/score/src/interr.c5
-rw-r--r--cpukit/score/src/isr.c5
-rw-r--r--cpukit/score/src/mpci.c11
-rw-r--r--cpukit/score/src/objectinitializeinformation.c5
-rw-r--r--cpukit/score/src/objectmp.c6
-rw-r--r--cpukit/score/src/thread.c2
-rw-r--r--cpukit/score/src/threaddispatch.c10
-rw-r--r--cpukit/score/src/threadhandler.c2
-rw-r--r--cpukit/score/src/threadmp.c2
-rw-r--r--cpukit/score/src/threadqenqueue.c5
-rw-r--r--cpukit/score/src/threadrestart.c2
-rw-r--r--cpukit/score/src/wkspace.c4
18 files changed, 42 insertions, 55 deletions
diff --git a/cpukit/libcsupport/src/gxx_wrappers.c b/cpukit/libcsupport/src/gxx_wrappers.c
index 545c3af523..d30b57037e 100644
--- a/cpukit/libcsupport/src/gxx_wrappers.c
+++ b/cpukit/libcsupport/src/gxx_wrappers.c
@@ -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 );
diff --git a/cpukit/libcsupport/src/malloc_initialize.c b/cpukit/libcsupport/src/malloc_initialize.c
index e262c0ff06..dc94b489ff 100644
--- a/cpukit/libcsupport/src/malloc_initialize.c
+++ b/cpukit/libcsupport/src/malloc_initialize.c
@@ -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 );
}
}
}
diff --git a/cpukit/posix/src/pthreadinitthreads.c b/cpukit/posix/src/pthreadinitthreads.c
index 2fdfa5325d..7695879aae 100644
--- a/cpukit/posix/src/pthreadinitthreads.c
+++ b/cpukit/posix/src/pthreadinitthreads.c
@@ -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 );
}
}
}
diff --git a/cpukit/rtems/src/taskinitusers.c b/cpukit/rtems/src/taskinitusers.c
index 4a851d45b0..41b7edc1c4 100644
--- a/cpukit/rtems/src/taskinitusers.c
+++ b/cpukit/rtems/src/taskinitusers.c
@@ -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 ) {
diff --git a/cpukit/score/cpu/powerpc/ppc-isr-vector-install.c b/cpukit/score/cpu/powerpc/ppc-isr-vector-install.c
index 7d75fd8e3e..c42c2e2c51 100644
--- a/cpukit/score/cpu/powerpc/ppc-isr-vector-install.c
+++ b/cpukit/score/cpu/powerpc/ppc-isr-vector-install.c
@@ -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 );
}
diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h
index aaaacf531f..254d1f59a9 100644
--- a/cpukit/score/include/rtems/score/interr.h
+++ b/cpukit/score/include/rtems/score/interr.h
@@ -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
diff --git a/cpukit/score/src/interr.c b/cpukit/score/src/interr.c
index 5993eb9ffc..3a74f95cee 100644
--- a/cpukit/score/src/interr.c
+++ b/cpukit/score/src/interr.c
@@ -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 );
+}
diff --git a/cpukit/score/src/isr.c b/cpukit/score/src/isr.c
index aaa05137b7..1078ef6f63 100644
--- a/cpukit/score/src/isr.c
+++ b/cpukit/score/src/isr.c
@@ -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 );
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index e495eb455d..89651b93b6 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -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 );
diff --git a/cpukit/score/src/objectinitializeinformation.c b/cpukit/score/src/objectinitializeinformation.c
index 92a561a830..8b1b88db07 100644
--- a/cpukit/score/src/objectinitializeinformation.c
+++ b/cpukit/score/src/objectinitializeinformation.c
@@ -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 );
}
/*
diff --git a/cpukit/score/src/objectmp.c b/cpukit/score/src/objectmp.c
index 4e6a838b0f..75a0fdb15f 100644
--- a/cpukit/score/src/objectmp.c
+++ b/cpukit/score/src/objectmp.c
@@ -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 );
}
}
diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c
index 1fcc639da0..70bcccf70e 100644
--- a/cpukit/score/src/thread.c
+++ b/cpukit/score/src/thread.c
@@ -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() );
diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c
index 6bce046d10..5fe0843e49 100644
--- a/cpukit/score/src/threaddispatch.c
+++ b/cpukit/score/src/threaddispatch.c
@@ -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 );
diff --git a/cpukit/score/src/threadhandler.c b/cpukit/score/src/threadhandler.c
index 721dcf410b..7267577baf 100644
--- a/cpukit/score/src/threadhandler.c
+++ b/cpukit/score/src/threadhandler.c
@@ -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 );
}
diff --git a/cpukit/score/src/threadmp.c b/cpukit/score/src/threadmp.c
index 59f393f23c..4868e8fe4e 100644
--- a/cpukit/score/src/threadmp.c
+++ b/cpukit/score/src/threadmp.c
@@ -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
diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index a96fbfcacc..bf08d78b41 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -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
);
}
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index 4295bc46c2..5938dcfecf 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -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
diff --git a/cpukit/score/src/wkspace.c b/cpukit/score/src/wkspace.c
index ae48e4482a..13dfc03706 100644
--- a/cpukit/score/src/wkspace.c
+++ b/cpukit/score/src/wkspace.c
@@ -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;
}