summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1998-04-15 15:08:49 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1998-04-15 15:08:49 +0000
commit71f4beb0cd6196a3dcd7d1aacb82645debe745b2 (patch)
treec9eebd3afbd0402fff7384293caab2c8f590d93e
parent9b64c2d5f7d6875cc20552b0ff3bc55cdc7d60d3 (diff)
downloadrtems-71f4beb0cd6196a3dcd7d1aacb82645debe745b2.tar.bz2
Stack check now initialized as part of initial extension set.
-rw-r--r--c/src/lib/libmisc/stackchk/README15
-rw-r--r--c/src/lib/libmisc/stackchk/check.c8
-rw-r--r--c/src/lib/libmisc/stackchk/stackchk.h42
-rw-r--r--c/src/libmisc/stackchk/README15
-rw-r--r--c/src/libmisc/stackchk/check.c8
-rw-r--r--c/src/libmisc/stackchk/stackchk.h42
-rw-r--r--cpukit/libmisc/stackchk/README15
-rw-r--r--cpukit/libmisc/stackchk/check.c8
-rw-r--r--cpukit/libmisc/stackchk/stackchk.h42
9 files changed, 195 insertions, 0 deletions
diff --git a/c/src/lib/libmisc/stackchk/README b/c/src/lib/libmisc/stackchk/README
index 20e76f07bc..0f6e2f2b10 100644
--- a/c/src/lib/libmisc/stackchk/README
+++ b/c/src/lib/libmisc/stackchk/README
@@ -2,12 +2,27 @@
# $Id$
#
+Introduction
+============
+
This directory contains a stack bounds checker. It provides two
primary features:
+ check for stack overflow at each context switch
+ provides an educated guess at each task's stack usage
+Enabling
+========
+
+Add the stack checker extension to the initial user extension set.
+If using confdefs.h to build your configuration table, this is
+as simple as adding -DSTACK_CHECK_ON to the gcc command line which
+compiles the file defining the configuration table. In the RTEMS
+test suites and samples, this is always init.c
+
+Background
+==========
+
The stack overflow check at context switch works by looking for
a 16 byte pattern at the logical end of the stack to be corrupted.
The "guesser" assumes that the entire stack was prefilled with a known
diff --git a/c/src/lib/libmisc/stackchk/check.c b/c/src/lib/libmisc/stackchk/check.c
index a226e926ea..1f1923f1d8 100644
--- a/c/src/lib/libmisc/stackchk/check.c
+++ b/c/src/lib/libmisc/stackchk/check.c
@@ -175,12 +175,14 @@ void Stack_check_Initialize( void )
p[3] = 0x600D0D06;
};
+#if 0
status = rtems_extension_create(
rtems_build_name( 'S', 'T', 'C', 'K' ),
&Stack_check_Extension_table,
&id_ignored
);
assert ( status == RTEMS_SUCCESSFUL );
+#endif
Stack_check_Blown_task = 0;
@@ -254,6 +256,9 @@ boolean Stack_check_Create_extension(
Thread_Control *the_thread
)
{
+ if (!stack_check_initialized)
+ Stack_check_Initialize();
+
if (the_thread /* XXX && (the_thread != _Thread_Executing) */ )
stack_check_dope_stack(&the_thread->Start.Initial_stack);
@@ -271,6 +276,9 @@ void Stack_check_Begin_extension(
{
Stack_check_Control *the_pattern;
+ if (!stack_check_initialized)
+ Stack_check_Initialize();
+
if ( the_thread->Object.id == 0 ) /* skip system tasks */
return;
diff --git a/c/src/lib/libmisc/stackchk/stackchk.h b/c/src/lib/libmisc/stackchk/stackchk.h
index b35251007d..1b40da5e0c 100644
--- a/c/src/lib/libmisc/stackchk/stackchk.h
+++ b/c/src/lib/libmisc/stackchk/stackchk.h
@@ -33,6 +33,48 @@ void Stack_check_Initialize( void );
void Stack_check_Dump_usage( void );
+/*
+ * Stack_check_Create_extension
+ */
+
+boolean Stack_check_Create_extension(
+ Thread_Control *running,
+ Thread_Control *the_thread
+);
+
+/*
+ * Stack_check_Begin_extension
+ */
+
+void Stack_check_Begin_extension(
+ Thread_Control *the_thread
+);
+
+/*
+ * Stack_check_Switch_extension
+ */
+
+void Stack_check_Switch_extension(
+ Thread_Control *running,
+ Thread_Control *heir
+);
+
+/*
+ * Extension set definition
+ */
+
+#define STACK_CHECKER_EXTENSION \
+{ \
+ Stack_check_Create_extension, /* rtems_task_create */ \
+ 0, /* rtems_task_start */ \
+ 0, /* rtems_task_restart */ \
+ 0, /* rtems_task_delete */ \
+ Stack_check_Switch_extension, /* task_switch */ \
+ Stack_check_Begin_extension, /* task_begin */ \
+ 0, /* task_exitted */ \
+ 0 /* Stack_check_Fatal_extension */, /* fatal */ \
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/c/src/libmisc/stackchk/README b/c/src/libmisc/stackchk/README
index 20e76f07bc..0f6e2f2b10 100644
--- a/c/src/libmisc/stackchk/README
+++ b/c/src/libmisc/stackchk/README
@@ -2,12 +2,27 @@
# $Id$
#
+Introduction
+============
+
This directory contains a stack bounds checker. It provides two
primary features:
+ check for stack overflow at each context switch
+ provides an educated guess at each task's stack usage
+Enabling
+========
+
+Add the stack checker extension to the initial user extension set.
+If using confdefs.h to build your configuration table, this is
+as simple as adding -DSTACK_CHECK_ON to the gcc command line which
+compiles the file defining the configuration table. In the RTEMS
+test suites and samples, this is always init.c
+
+Background
+==========
+
The stack overflow check at context switch works by looking for
a 16 byte pattern at the logical end of the stack to be corrupted.
The "guesser" assumes that the entire stack was prefilled with a known
diff --git a/c/src/libmisc/stackchk/check.c b/c/src/libmisc/stackchk/check.c
index a226e926ea..1f1923f1d8 100644
--- a/c/src/libmisc/stackchk/check.c
+++ b/c/src/libmisc/stackchk/check.c
@@ -175,12 +175,14 @@ void Stack_check_Initialize( void )
p[3] = 0x600D0D06;
};
+#if 0
status = rtems_extension_create(
rtems_build_name( 'S', 'T', 'C', 'K' ),
&Stack_check_Extension_table,
&id_ignored
);
assert ( status == RTEMS_SUCCESSFUL );
+#endif
Stack_check_Blown_task = 0;
@@ -254,6 +256,9 @@ boolean Stack_check_Create_extension(
Thread_Control *the_thread
)
{
+ if (!stack_check_initialized)
+ Stack_check_Initialize();
+
if (the_thread /* XXX && (the_thread != _Thread_Executing) */ )
stack_check_dope_stack(&the_thread->Start.Initial_stack);
@@ -271,6 +276,9 @@ void Stack_check_Begin_extension(
{
Stack_check_Control *the_pattern;
+ if (!stack_check_initialized)
+ Stack_check_Initialize();
+
if ( the_thread->Object.id == 0 ) /* skip system tasks */
return;
diff --git a/c/src/libmisc/stackchk/stackchk.h b/c/src/libmisc/stackchk/stackchk.h
index b35251007d..1b40da5e0c 100644
--- a/c/src/libmisc/stackchk/stackchk.h
+++ b/c/src/libmisc/stackchk/stackchk.h
@@ -33,6 +33,48 @@ void Stack_check_Initialize( void );
void Stack_check_Dump_usage( void );
+/*
+ * Stack_check_Create_extension
+ */
+
+boolean Stack_check_Create_extension(
+ Thread_Control *running,
+ Thread_Control *the_thread
+);
+
+/*
+ * Stack_check_Begin_extension
+ */
+
+void Stack_check_Begin_extension(
+ Thread_Control *the_thread
+);
+
+/*
+ * Stack_check_Switch_extension
+ */
+
+void Stack_check_Switch_extension(
+ Thread_Control *running,
+ Thread_Control *heir
+);
+
+/*
+ * Extension set definition
+ */
+
+#define STACK_CHECKER_EXTENSION \
+{ \
+ Stack_check_Create_extension, /* rtems_task_create */ \
+ 0, /* rtems_task_start */ \
+ 0, /* rtems_task_restart */ \
+ 0, /* rtems_task_delete */ \
+ Stack_check_Switch_extension, /* task_switch */ \
+ Stack_check_Begin_extension, /* task_begin */ \
+ 0, /* task_exitted */ \
+ 0 /* Stack_check_Fatal_extension */, /* fatal */ \
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/libmisc/stackchk/README b/cpukit/libmisc/stackchk/README
index 20e76f07bc..0f6e2f2b10 100644
--- a/cpukit/libmisc/stackchk/README
+++ b/cpukit/libmisc/stackchk/README
@@ -2,12 +2,27 @@
# $Id$
#
+Introduction
+============
+
This directory contains a stack bounds checker. It provides two
primary features:
+ check for stack overflow at each context switch
+ provides an educated guess at each task's stack usage
+Enabling
+========
+
+Add the stack checker extension to the initial user extension set.
+If using confdefs.h to build your configuration table, this is
+as simple as adding -DSTACK_CHECK_ON to the gcc command line which
+compiles the file defining the configuration table. In the RTEMS
+test suites and samples, this is always init.c
+
+Background
+==========
+
The stack overflow check at context switch works by looking for
a 16 byte pattern at the logical end of the stack to be corrupted.
The "guesser" assumes that the entire stack was prefilled with a known
diff --git a/cpukit/libmisc/stackchk/check.c b/cpukit/libmisc/stackchk/check.c
index a226e926ea..1f1923f1d8 100644
--- a/cpukit/libmisc/stackchk/check.c
+++ b/cpukit/libmisc/stackchk/check.c
@@ -175,12 +175,14 @@ void Stack_check_Initialize( void )
p[3] = 0x600D0D06;
};
+#if 0
status = rtems_extension_create(
rtems_build_name( 'S', 'T', 'C', 'K' ),
&Stack_check_Extension_table,
&id_ignored
);
assert ( status == RTEMS_SUCCESSFUL );
+#endif
Stack_check_Blown_task = 0;
@@ -254,6 +256,9 @@ boolean Stack_check_Create_extension(
Thread_Control *the_thread
)
{
+ if (!stack_check_initialized)
+ Stack_check_Initialize();
+
if (the_thread /* XXX && (the_thread != _Thread_Executing) */ )
stack_check_dope_stack(&the_thread->Start.Initial_stack);
@@ -271,6 +276,9 @@ void Stack_check_Begin_extension(
{
Stack_check_Control *the_pattern;
+ if (!stack_check_initialized)
+ Stack_check_Initialize();
+
if ( the_thread->Object.id == 0 ) /* skip system tasks */
return;
diff --git a/cpukit/libmisc/stackchk/stackchk.h b/cpukit/libmisc/stackchk/stackchk.h
index b35251007d..1b40da5e0c 100644
--- a/cpukit/libmisc/stackchk/stackchk.h
+++ b/cpukit/libmisc/stackchk/stackchk.h
@@ -33,6 +33,48 @@ void Stack_check_Initialize( void );
void Stack_check_Dump_usage( void );
+/*
+ * Stack_check_Create_extension
+ */
+
+boolean Stack_check_Create_extension(
+ Thread_Control *running,
+ Thread_Control *the_thread
+);
+
+/*
+ * Stack_check_Begin_extension
+ */
+
+void Stack_check_Begin_extension(
+ Thread_Control *the_thread
+);
+
+/*
+ * Stack_check_Switch_extension
+ */
+
+void Stack_check_Switch_extension(
+ Thread_Control *running,
+ Thread_Control *heir
+);
+
+/*
+ * Extension set definition
+ */
+
+#define STACK_CHECKER_EXTENSION \
+{ \
+ Stack_check_Create_extension, /* rtems_task_create */ \
+ 0, /* rtems_task_start */ \
+ 0, /* rtems_task_restart */ \
+ 0, /* rtems_task_delete */ \
+ Stack_check_Switch_extension, /* task_switch */ \
+ Stack_check_Begin_extension, /* task_begin */ \
+ 0, /* task_exitted */ \
+ 0 /* Stack_check_Fatal_extension */, /* fatal */ \
+}
+
#ifdef __cplusplus
}
#endif