This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
idle_thread_stack patch
- From: "Uwe Kindler" <ukindler at htwm dot de>
- To: <ecos-patches at sources dot redhat dot com>
- Date: Mon, 12 Jan 2004 18:06:35 +0100
- Subject: idle_thread_stack patch
Hello,
if stack checking is enabled (CYGFUN_KERNEL_THREADS_STACK_CHECKING ) then
Cyg_HardwareThread::attach_stack expects a CYG_WORD aligned stack. The
idle_thread_stack is declared as static char at the moment and so the
assertions within Cyg_HardwareThread::attach_stack may fail (this already
happened to me). The following patch does not guarantee a correct aligned
stack for any platform but enables successful passing of the assertions
within Cyg_HardwareThread::attach_stack. Therefore I would like to suggest
the following patch:
Index: kernel/current/src/common/thread.cxx
===================================================================
--- old/thread.cxx 2004-01-12 17:33:56.000000000 +0100
+++ thread.cxx 2004-01-12 17:37:28.000000000 +0100
@@ -1225,7 +1225,7 @@
# endif // CYGNUM_KERNEL_THREADS_IDLE_STACK_SIZE
#endif // CYGNUM_HAL_STACK_SIZE_MINIMUM
-static char
idle_thread_stack[CYGNUM_KERNEL_CPU_MAX][CYGNUM_KERNEL_THREADS_IDLE_STACK_SI
ZE];
+static CYG_WORD
idle_thread_stack[CYGNUM_KERNEL_CPU_MAX][(CYGNUM_KERNEL_THREADS_IDLE_STACK_S
IZE + sizeof(CYG_WORD) - 1) / sizeof(CYG_WORD)];
// Loop counter for debugging/housekeeping
cyg_uint32 idle_thread_loops[CYGNUM_KERNEL_CPU_MAX];
Index: kernel/current/ChangeLog
===================================================================
--- old/ChangeLog 2004-01-12 17:33:18.000000000 +0100
+++ ChangeLog 2004-01-12 17:46:48.000000000 +0100
@@ -1,3 +1,8 @@
+2004-01-12 Uwe Kindler <uwe_kindler@web.de>
+ * src/common/thread.cxx: Changed declaration of idle_thread_stack
+ to CYG_WORD because Cyg_HardwareThread::attach_stack() expects a
+ CYG_WORD alignment.
+
2003-12-08 Dan Jakubiec <djakubiec@yahoo.com>
* src/common/kapi.cxx: Added new function cyg_thread_get_id().