score: Add SYSTEM_STATE_TERMINATED

Merge systems states SYSTEM_STATE_SHUTDOWN and SYSTEM_STATE_FAILED into
new system state SYSTEM_STATE_TERMINATED.  This reflects that all system
termination paths end up in _Internal_error_Occurred().
This commit is contained in:
Sebastian Huber
2014-02-17 09:47:12 +01:00
parent 801b5d8032
commit 92f50c3b29
6 changed files with 9 additions and 22 deletions

View File

@@ -44,7 +44,6 @@ void rtems_shutdown_executive(
#endif #endif
_Thread_Set_global_exit_status( result ); _Thread_Set_global_exit_status( result );
_System_state_Set( SYSTEM_STATE_SHUTDOWN );
_Thread_Stop_multitasking(); _Thread_Stop_multitasking();
/******************************************************************* /*******************************************************************

View File

@@ -192,7 +192,7 @@ extern Internal_errors_Information _Internal_errors_What_happened;
* *
* Once all fatal handler executed the error information will be stored to * Once all fatal handler executed the error information will be stored to
* _Internal_errors_What_happened and the system state is set to * _Internal_errors_What_happened and the system state is set to
* SYSTEM_STATE_FAILED. * SYSTEM_STATE_TERMINATED.
* *
* The final step is to call the CPU specific _CPU_Fatal_halt(). * The final step is to call the CPU specific _CPU_Fatal_halt().
* *

View File

@@ -54,19 +54,14 @@ typedef enum {
SYSTEM_STATE_UP, SYSTEM_STATE_UP,
/** /**
* @brief The system is in the midst of a shutdown. * @brief The system reached its terminal state.
*/ */
SYSTEM_STATE_SHUTDOWN, SYSTEM_STATE_TERMINATED
/**
* @brief A fatal error has occurred.
*/
SYSTEM_STATE_FAILED
} System_state_Codes; } System_state_Codes;
#define SYSTEM_STATE_CODES_FIRST SYSTEM_STATE_BEFORE_INITIALIZATION #define SYSTEM_STATE_CODES_FIRST SYSTEM_STATE_BEFORE_INITIALIZATION
#define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_FAILED #define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_TERMINATED
#if defined(RTEMS_MULTIPROCESSING) #if defined(RTEMS_MULTIPROCESSING)
SCORE_EXTERN bool _System_state_Is_multiprocessing; SCORE_EXTERN bool _System_state_Is_multiprocessing;
@@ -114,13 +109,6 @@ RTEMS_INLINE_ROUTINE bool _System_state_Is_before_multitasking (
return (state == SYSTEM_STATE_BEFORE_MULTITASKING); return (state == SYSTEM_STATE_BEFORE_MULTITASKING);
} }
RTEMS_INLINE_ROUTINE bool _System_state_Is_shutdown (
System_state_Codes state
)
{
return (state == SYSTEM_STATE_SHUTDOWN);
}
RTEMS_INLINE_ROUTINE bool _System_state_Is_up ( RTEMS_INLINE_ROUTINE bool _System_state_Is_up (
System_state_Codes state System_state_Codes state
) )
@@ -128,11 +116,11 @@ RTEMS_INLINE_ROUTINE bool _System_state_Is_up (
return (state == SYSTEM_STATE_UP); return (state == SYSTEM_STATE_UP);
} }
RTEMS_INLINE_ROUTINE bool _System_state_Is_failed ( RTEMS_INLINE_ROUTINE bool _System_state_Is_terminated (
System_state_Codes state System_state_Codes state
) )
{ {
return (state == SYSTEM_STATE_FAILED); return (state == SYSTEM_STATE_TERMINATED);
} }
/** @} */ /** @} */

View File

@@ -38,7 +38,7 @@ void _Internal_error_Occurred(
_Internal_errors_What_happened.is_internal = is_internal; _Internal_errors_What_happened.is_internal = is_internal;
_Internal_errors_What_happened.the_error = the_error; _Internal_errors_What_happened.the_error = the_error;
_System_state_Set( SYSTEM_STATE_FAILED ); _System_state_Set( SYSTEM_STATE_TERMINATED );
_CPU_Fatal_halt( the_error ); _CPU_Fatal_halt( the_error );

View File

@@ -94,7 +94,7 @@ static void test_system_not_up(void)
rtems_interrupt_disable( level ); rtems_interrupt_disable( level );
System_state_Codes state = _System_state_Get(); System_state_Codes state = _System_state_Get();
_System_state_Set( SYSTEM_STATE_FAILED ); _System_state_Set( SYSTEM_STATE_TERMINATED );
test_call_heap_walk( true ); test_call_heap_walk( true );
_System_state_Set( state ); _System_state_Set( state );
rtems_interrupt_enable( level ); rtems_interrupt_enable( level );

View File

@@ -17,7 +17,7 @@
void force_error() void force_error()
{ {
_System_state_Set( SYSTEM_STATE_SHUTDOWN ); _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
rtems_shutdown_executive( 0 ); rtems_shutdown_executive( 0 );
/* we will not run this far */ /* we will not run this far */
} }