summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1996-04-24 17:36:35 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1996-04-24 17:36:35 +0000
commit1543932387be5fd7618f9d90c2b937efbe23f31d (patch)
tree850e67012f66f43ce32e16b3ae746e94e33ea482 /cpukit/score
parentLowered number of messages created to reduce burden on workspace. (diff)
downloadrtems-1543932387be5fd7618f9d90c2b937efbe23f31d.tar.bz2
added comment regarding stack alignment issues to thread stack allocation
routine.
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/src/thread.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c
index 2fae302cc2..afd36a0fd8 100644
--- a/cpukit/score/src/thread.c
+++ b/cpukit/score/src/thread.c
@@ -318,10 +318,23 @@ static unsigned32 _Thread_Stack_Allocate(
* the RTEMS workspace allocate. This is so the stack free
* routine can call the correct deallocation routine.
*/
+
if ( _CPU_Table.stack_allocate_hook )
{
stack_addr = (*_CPU_Table.stack_allocate_hook)( stack_size );
} else {
+
+ /*
+ * First pad the requested size so we allocate enough memory
+ * so the context initialization can align it properly. The address
+ * returned the workspace allocate must be directly stored in the
+ * stack control block because it is later used in the free sequence.
+ *
+ * Thus it is the responsibility of the CPU dependent code to
+ * get and keep the stack adjust factor, the stack alignment, and
+ * the context initialization sequence in sync.
+ */
+
stack_size = _Stack_Adjust_size( stack_size );
stack_addr = _Workspace_Allocate( stack_size );
}
@@ -347,6 +360,7 @@ static void _Thread_Stack_Free(void *stack_addr)
* the RTEMS workspace free. This is so the free
* routine properly matches the allocation of the stack.
*/
+
if ( _CPU_Table.stack_free_hook )
(*_CPU_Table.stack_free_hook)( stack_addr );
else