This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

minor kernel fix


The testcase stack monitoring code did not allow for
CYGFUN_KERNEL_THREADS_STACK_CHECKING, so if you were running a debug
build tm_basic would always report 100% stack usage.

2003-07-06  Bart Veer  <bartv@ecoscentric.com>

	* include/test/stackmon.h (cyg_test_size_a_stack):
	If stack checking is enabled, look for 0xdeadbeef rather than 0x0
	to determine usage. Also reset the interrupt stack to that value.

Index: include/test/stackmon.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/include/test/stackmon.h,v
retrieving revision 1.7
diff -u -r1.7 stackmon.h
--- include/test/stackmon.h	16 Oct 2002 14:28:43 -0000	1.7
+++ include/test/stackmon.h	6 Jul 2003 14:30:34 -0000
@@ -84,11 +84,22 @@
 inline void cyg_test_size_a_stack( char *comment, char *format,
                                    char *base, char *top )
 {
+#ifdef CYGFUN_KERNEL_THREADS_STACK_CHECKING
+    cyg_uint32* cur32   = (cyg_uint32*) ((((CYG_ADDRWORD)&(base[CYGNUM_KERNEL_THREADS_STACK_CHECK_DATA_SIZE])) + 3) & ~3);
+    cyg_uint32* top32   = (cyg_uint32*) ((((CYG_ADDRWORD)top) + 3) & ~3);
+    for ( ; cur32 < top32; cur32++) {
+        if (*cur32 != 0xDEADBEEF) {
+            break;
+        }
+    }
+    STACKMON_PRINTF( format, comment, (CYG_ADDRWORD)top32 - (CYG_ADDRWORD)cur32, top - base );
+#else    
     register char *p;
     for ( p = base; p < top; p++ )
         if ( *p )
             break;
     STACKMON_PRINTF( format, comment, top - p, top - base );
+#endif    
 }
 
 // ------------------------------------------------------------------------
@@ -200,10 +211,22 @@
 #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
 #if defined(HAL_INTERRUPT_STACK_BASE) && defined(HAL_INTERRUPT_STACK_TOP)
     cyg_uint32  old_intr;
-    register char *p;
     HAL_DISABLE_INTERRUPTS(old_intr);
-    for ( p = HAL_INTERRUPT_STACK_BASE; p < HAL_INTERRUPT_STACK_TOP; p++ )
-        *p = 0;                         // zero it for checking later
+# ifdef CYGFUN_KERNEL_THREADS_STACK_CHECKING
+    {
+        cyg_uint32* cur32   = (cyg_uint32*) ((((CYG_ADDRWORD)HAL_INTERRUPT_STACK_BASE) + 3) & ~3);
+        cyg_uint32* top32   = (cyg_uint32*) ((((CYG_ADDRWORD)HAL_INTERRUPT_STACK_TOP) + 3) & ~3);
+        for ( ; cur32 < top32; cur32++) {
+            *cur32 = 0xDEADBEEF;
+        }
+    }
+# else
+    {
+        register char *p;
+        for ( p = HAL_INTERRUPT_STACK_BASE; p < HAL_INTERRUPT_STACK_TOP; p++ )
+            *p = 0;                         // zero it for checking later
+    }
+# endif    
     HAL_RESTORE_INTERRUPTS(old_intr);
 #endif
 #endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]