[PATCH 16/16] score: Add RTEMS_FATAL_SOURCE_STACK_CHECKER

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Nov 14 15:47:10 UTC 2012


---
 cpukit/libmisc/stackchk/check.c           |    5 ++++-
 cpukit/score/include/rtems/score/interr.h |    7 +++++++
 testsuites/libtests/stackchk/init.c       |    7 ++-----
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/cpukit/libmisc/stackchk/check.c b/cpukit/libmisc/stackchk/check.c
index 69120a4..c14b52c 100644
--- a/cpukit/libmisc/stackchk/check.c
+++ b/cpukit/libmisc/stackchk/check.c
@@ -260,7 +260,10 @@ void Stack_check_report_blown_task(Thread_Control *running, bool pattern_ok)
     }
   #endif
 
-  rtems_fatal_error_occurred(0x81);
+  rtems_fatal(
+    RTEMS_FATAL_SOURCE_STACK_CHECKER,
+    running->Object.name.name_u32
+  );
 }
 
 /*
diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h
index 20efcb3..94306b5 100644
--- a/cpukit/score/include/rtems/score/interr.h
+++ b/cpukit/score/include/rtems/score/interr.h
@@ -91,6 +91,13 @@ typedef enum {
   RTEMS_FATAL_SOURCE_ASSERT,
 
   /**
+   * @brief Fatal source of the stack checker.
+   *
+   * The fatal code is the object name of the executing task.
+   */
+  RTEMS_FATAL_SOURCE_STACK_CHECKER,
+
+  /**
    * @brief The last available fatal source.
    *
    * This enum value ensures that the enum type needs at least 32-bits for
diff --git a/testsuites/libtests/stackchk/init.c b/testsuites/libtests/stackchk/init.c
index a545812..1551eec 100644
--- a/testsuites/libtests/stackchk/init.c
+++ b/testsuites/libtests/stackchk/init.c
@@ -88,16 +88,13 @@ rtems_task Init(
 
 void Fatal_extension( uint32_t source, bool is_internal, uint32_t error )
 {
-  if ( source != INTERNAL_ERROR_RTEMS_API ) {
+  if ( source != RTEMS_FATAL_SOURCE_STACK_CHECKER ) {
     printk( "unexpected fatal source\n" );
   } else if ( is_internal ) {
     printk( "unexpected fatal is internal\n" );
-  } else if ( error != 0x81 ) {
+  } else if ( error != rtems_build_name( 'T', 'A', '1', ' ' ) ) {
     printk( "unexpected fatal error\n" );
   } else {
     printk( "*** END OF TEST STACK CHECKER ***\n" );
   }
-
-  if ( _System_state_Is_up( _System_state_Get() ) )
-    _Thread_Stop_multitasking();
 }
-- 
1.7.7




More information about the devel mailing list