Initialize stack area in _NewContext()

Instead of initializing the stack (when INIT_STACKS is enabled) in start_task()
and _fiber_start(), do it in _NewContext().  This helps to both reduce code
duplication AND ensure that all contexts get an initialized stack (previously
the background/idle task's was missed).

Change-Id: If2d50309d2be48fac937f5d0ae96b9de185c0fe2
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
This commit is contained in:
Peter Mitsis 2015-05-25 14:31:59 -04:00 committed by Anas Nashif
commit 4fe98a46f5
5 changed files with 12 additions and 8 deletions

View file

@ -117,6 +117,10 @@ void _NewContext(
struct __esf *pInitCtx;
tCCS *pCcs = (tCCS *) pStackMem;
#ifdef CONFIG_INIT_STACKS
k_memset(pStackMem, 0xaa, stackSize);
#endif
/* carve the context entry struct from the "base" of the stack */
pInitCtx = (struct __esf *)(STACK_ROUND_DOWN(stackEnd) -