Index: cpukit/libmisc/stackchk/check.c
===================================================================
--- cpukit/libmisc/stackchk/check.c	(revision bba988d313e53f5ccfba01e3b2a58bc2175300cf)
+++ cpukit/libmisc/stackchk/check.c	(revision 8bb9d4100c42a0f0554e8f8f3f0138177f2c21f2)
@@ -51,11 +51,11 @@
  */
 
-#ifdef CPU_STACK_CHECK_SIZE
-#define PATTERN_SIZE_WORDS      (((CPU_STACK_CHECK_SIZE / 4) + 3) & ~0x3)
-#else
-#define PATTERN_SIZE_WORDS      (4)
+#if !defined(CPU_STACK_CHECK_PATTERN_INITIALIZER)
+#define CPU_STACK_CHECK_PATTERN_INITIALIZER \
+  { \
+    0xFEEDF00D, 0x0BAD0D06, /* FEED FOOD to  BAD DOG */ \
+    0xDEADF00D, 0x600D0D06  /* DEAD FOOD but GOOD DOG */ \
+  }
 #endif
-
-#define PATTERN_SIZE_BYTES      (PATTERN_SIZE_WORDS * sizeof(uint32_t))
 
 /*
@@ -66,8 +66,4 @@
 #define U32_PATTERN 0xA5A5A5A5
 
-typedef struct {
-   uint32_t    pattern[ PATTERN_SIZE_WORDS ];
-} Stack_check_Control;
-
 /*
  *  Variable to indicate when the stack checker has been initialized.
@@ -78,5 +74,10 @@
  *  The "magic pattern" used to mark the end of the stack.
  */
-Stack_check_Control Stack_check_Pattern;
+static const uint32_t Stack_check_Pattern[] =
+  CPU_STACK_CHECK_PATTERN_INITIALIZER;
+
+#define PATTERN_SIZE_BYTES sizeof(Stack_check_Pattern)
+
+#define PATTERN_SIZE_WORDS RTEMS_ARRAY_SIZE(Stack_check_Pattern)
 
 /*
@@ -86,9 +87,10 @@
  */
 static inline bool Stack_check_Frame_pointer_in_range(
-  Stack_Control *the_stack
+  const Thread_Control *the_thread
 )
 {
   #if defined(__GNUC__)
     void *sp = __builtin_frame_address(0);
+    const Stack_Control *the_stack = &the_thread->Start.Initial_stack;
 
     if ( sp < the_stack->area ) {
@@ -111,5 +113,5 @@
   #define Stack_check_Get_pattern( _the_stack ) \
     ((char *)(_the_stack)->area + \
-         (_the_stack)->size - sizeof( Stack_check_Control ) )
+         (_the_stack)->size - PATTERN_SIZE_BYTES )
 
   #define Stack_check_Calculate_used( _low, _size, _high_water ) \
@@ -133,13 +135,7 @@
 
   #define Stack_check_usable_stack_start(_the_stack) \
-      ((char *)(_the_stack)->area + sizeof(Stack_check_Control))
+      ((char *)(_the_stack)->area + PATTERN_SIZE_BYTES)
 
 #endif
-
-/*
- *  Obtain a properly typed pointer to the area to check.
- */
-#define Stack_check_Get_pattern_area( _the_stack ) \
-  (Stack_check_Control *) Stack_check_Get_pattern( _the_stack )
 
 /*
@@ -148,5 +144,5 @@
  */
 #define Stack_check_usable_stack_size(_the_stack) \
-    ((_the_stack)->size - sizeof(Stack_check_Control))
+    ((_the_stack)->size - PATTERN_SIZE_BYTES)
 
 #if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE)
@@ -170,21 +166,6 @@
 static void Stack_check_Initialize( void )
 {
-  int       i;
-  uint32_t *p;
-  static    uint32_t pattern[ 4 ] = {
-    0xFEEDF00D, 0x0BAD0D06,  /* FEED FOOD to  BAD DOG */
-    0xDEADF00D, 0x600D0D06   /* DEAD FOOD but GOOD DOG */
-  };
-
   if ( Stack_check_Initialized )
     return;
-
-  /*
-   * Dope the pattern and fill areas
-   */
-  p = Stack_check_Pattern.pattern;
-  for ( i = 0; i < PATTERN_SIZE_WORDS; i++ ) {
-      p[i] = pattern[ i%4 ];
-  }
 
   /*
@@ -204,4 +185,13 @@
 }
 
+static bool Stack_check_Is_pattern_valid(const Thread_Control *the_thread)
+{
+  return memcmp(
+    Stack_check_Get_pattern(&the_thread->Start.Initial_stack),
+    Stack_check_Pattern,
+    PATTERN_SIZE_BYTES
+  ) == 0;
+}
+
 /*
  *  rtems_stack_checker_create_extension
@@ -227,12 +217,12 @@
 )
 {
-  Stack_check_Control  *the_pattern;
-
   if ( the_thread->Object.id == 0 )        /* skip system tasks */
     return;
 
-  the_pattern = Stack_check_Get_pattern_area(&the_thread->Start.Initial_stack);
-
-  *the_pattern = Stack_check_Pattern;
+  memcpy(
+    Stack_check_Get_pattern(&the_thread->Start.Initial_stack),
+    Stack_check_Pattern,
+    PATTERN_SIZE_BYTES
+  );
 }
 
@@ -246,14 +236,12 @@
  *        the following message out.
  */
-void Stack_check_report_blown_task(
-  Thread_Control *running,
+static void Stack_check_report_blown_task(
+  const Thread_Control *running,
   bool pattern_ok
-) RTEMS_NO_RETURN;
-
-void Stack_check_report_blown_task(Thread_Control *running, bool pattern_ok)
-{
-  Stack_Control *stack = &running->Start.Initial_stack;
-  void          *pattern_area = Stack_check_Get_pattern(stack);
-  char           name[32];
+)
+{
+  const Stack_Control *stack = &running->Start.Initial_stack;
+  void                *pattern_area = Stack_check_Get_pattern(stack);
+  char                 name[32];
 
   printk("BLOWN STACK!!!\n");
@@ -306,18 +294,13 @@
 )
 {
-  Stack_Control *the_stack = &running->Start.Initial_stack;
-  void          *pattern;
-  bool           sp_ok;
-  bool           pattern_ok = true;
-
-  pattern = Stack_check_Get_pattern_area(the_stack);
+  bool sp_ok;
+  bool pattern_ok;
 
   /*
    *  Check for an out of bounds stack pointer or an overwrite
    */
-  sp_ok = Stack_check_Frame_pointer_in_range( the_stack );
-
-  pattern_ok = (!memcmp( pattern,
-            (void *) Stack_check_Pattern.pattern, PATTERN_SIZE_BYTES));
+  sp_ok = Stack_check_Frame_pointer_in_range( running );
+
+  pattern_ok = Stack_check_Is_pattern_valid( running );
 
   if ( !sp_ok || !pattern_ok ) {
@@ -331,35 +314,5 @@
 bool rtems_stack_checker_is_blown( void )
 {
-  Thread_Control *executing = _Thread_Get_executing();
-  Stack_Control  *the_stack = &executing->Start.Initial_stack;
-  bool            sp_ok;
-  bool            pattern_ok = true;
-
-  /*
-   *  Check for an out of bounds stack pointer
-   */
-
-  sp_ok = Stack_check_Frame_pointer_in_range( the_stack );
-
-  /*
-   * The stack checker must be initialized before the pattern is there
-   * to check.
-   */
-  if ( Stack_check_Initialized ) {
-    pattern_ok = (!memcmp(
-      Stack_check_Get_pattern(the_stack),
-      (void *) Stack_check_Pattern.pattern,
-      PATTERN_SIZE_BYTES
-    ));
-  }
-
-
-  /*
-   * Let's report as much as we can.
-   */
-  if ( !sp_ok || !pattern_ok ) {
-    Stack_check_report_blown_task( executing, pattern_ok );
-    /* DOES NOT RETURN */
-  }
+  rtems_stack_checker_switch_extension( _Thread_Get_executing(), NULL );
 
   /*
Index: cpukit/score/cpu/powerpc/rtems/score/cpu.h
===================================================================
--- cpukit/score/cpu/powerpc/rtems/score/cpu.h	(revision bba988d313e53f5ccfba01e3b2a58bc2175300cf)
+++ cpukit/score/cpu/powerpc/rtems/score/cpu.h	(revision 8bb9d4100c42a0f0554e8f8f3f0138177f2c21f2)
@@ -650,5 +650,13 @@
  */
 
-#define CPU_STACK_CHECK_SIZE    (128)
+#define CPU_STACK_CHECK_PATTERN_INITIALIZER \
+  { 0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06, \
+    0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06, \
+    0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06, \
+    0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06, \
+    0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06, \
+    0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06, \
+    0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06, \
+    0xFEEDF00D, 0x0BAD0D06, 0xDEADF00D, 0x600D0D06 }
 
 /*
