[PATCH 03/17] score: Add SYSTEM_STATE_FATAL

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Feb 17 15:51:28 UTC 2014


Merge systems states SYSTEM_STATE_SHUTDOWN and SYSTEM_STATE_FAILED into
new system state SYSTEM_STATE_FATAL.  This reflects that all system
termination paths end up in _Internal_error_Occurred().
---
 cpukit/sapi/src/exshutdown.c                |    1 -
 cpukit/score/include/rtems/score/interr.h   |    2 +-
 cpukit/score/include/rtems/score/sysstate.h |   22 +++++-----------------
 cpukit/score/src/interr.c                   |    2 +-
 testsuites/libtests/heapwalk/init.c         |    2 +-
 testsuites/sptests/spfatal23/testcase.h     |    2 +-
 6 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/cpukit/sapi/src/exshutdown.c b/cpukit/sapi/src/exshutdown.c
index 7a96869..44c5a09 100644
--- a/cpukit/sapi/src/exshutdown.c
+++ b/cpukit/sapi/src/exshutdown.c
@@ -44,7 +44,6 @@ void rtems_shutdown_executive(
     #endif
 
     _Thread_Set_global_exit_status( result );
-    _System_state_Set( SYSTEM_STATE_SHUTDOWN );
     _Thread_Stop_multitasking();
 
     /*******************************************************************
diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h
index 79edc21..8f8d905 100644
--- a/cpukit/score/include/rtems/score/interr.h
+++ b/cpukit/score/include/rtems/score/interr.h
@@ -192,7 +192,7 @@ extern Internal_errors_Information _Internal_errors_What_happened;
  *
  * Once all fatal handler executed the error information will be stored to
  * _Internal_errors_What_happened and the system state is set to
- * SYSTEM_STATE_FAILED.
+ * SYSTEM_STATE_FATAL.
  *
  * The final step is to call the CPU specific _CPU_Fatal_halt().
  *
diff --git a/cpukit/score/include/rtems/score/sysstate.h b/cpukit/score/include/rtems/score/sysstate.h
index 304b952..e41a85f 100644
--- a/cpukit/score/include/rtems/score/sysstate.h
+++ b/cpukit/score/include/rtems/score/sysstate.h
@@ -54,19 +54,14 @@ typedef enum {
   SYSTEM_STATE_UP,
 
   /**
-   * @brief The system is in the midst of a shutdown.
+   * @brief The system reached its terminal state.
    */
-  SYSTEM_STATE_SHUTDOWN,
-
-  /**
-   * @brief A fatal error has occurred.
-   */
-  SYSTEM_STATE_FAILED
+  SYSTEM_STATE_FATAL
 } System_state_Codes;
 
 #define SYSTEM_STATE_CODES_FIRST SYSTEM_STATE_BEFORE_INITIALIZATION
 
-#define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_FAILED
+#define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_FATAL
 
 #if defined(RTEMS_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);
 }
 
-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 (
   System_state_Codes state
 )
@@ -128,11 +116,11 @@ RTEMS_INLINE_ROUTINE bool _System_state_Is_up (
   return (state == SYSTEM_STATE_UP);
 }
 
-RTEMS_INLINE_ROUTINE bool _System_state_Is_failed (
+RTEMS_INLINE_ROUTINE bool _System_state_Is_fatal (
   System_state_Codes state
 )
 {
-  return (state == SYSTEM_STATE_FAILED);
+  return (state == SYSTEM_STATE_FATAL);
 }
 
 /** @} */
diff --git a/cpukit/score/src/interr.c b/cpukit/score/src/interr.c
index 1b895d6..69e7681 100644
--- a/cpukit/score/src/interr.c
+++ b/cpukit/score/src/interr.c
@@ -38,7 +38,7 @@ void _Internal_error_Occurred(
   _Internal_errors_What_happened.is_internal = is_internal;
   _Internal_errors_What_happened.the_error   = the_error;
 
-  _System_state_Set( SYSTEM_STATE_FAILED );
+  _System_state_Set( SYSTEM_STATE_FATAL );
 
   _CPU_Fatal_halt( the_error );
 
diff --git a/testsuites/libtests/heapwalk/init.c b/testsuites/libtests/heapwalk/init.c
index f00b9b8..99153e8 100644
--- a/testsuites/libtests/heapwalk/init.c
+++ b/testsuites/libtests/heapwalk/init.c
@@ -94,7 +94,7 @@ static void test_system_not_up(void)
 
   rtems_interrupt_disable( level );
   System_state_Codes state = _System_state_Get();
-  _System_state_Set( SYSTEM_STATE_FAILED );
+  _System_state_Set( SYSTEM_STATE_FATAL );
   test_call_heap_walk( true );
   _System_state_Set( state );
   rtems_interrupt_enable( level );
diff --git a/testsuites/sptests/spfatal23/testcase.h b/testsuites/sptests/spfatal23/testcase.h
index 28010e1..6be7d3a 100644
--- a/testsuites/sptests/spfatal23/testcase.h
+++ b/testsuites/sptests/spfatal23/testcase.h
@@ -17,7 +17,7 @@
 
 void force_error()
 {
-  _System_state_Set( SYSTEM_STATE_SHUTDOWN );
+  _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
   rtems_shutdown_executive( 0 );
   /* we will not run this far */
 }
-- 
1.7.7




More information about the devel mailing list