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:
parent
c9ac95a43a
commit
4fe98a46f5
5 changed files with 12 additions and 8 deletions
|
@ -124,6 +124,10 @@ void _NewContext(
|
|||
|
||||
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 init_stack_frame *)(STACK_ROUND_DOWN(stackEnd) -
|
||||
|
|
|
@ -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) -
|
||||
|
|
|
@ -301,6 +301,10 @@ void _NewContext(
|
|||
{
|
||||
unsigned long *pInitialContext;
|
||||
|
||||
#ifdef CONFIG_INIT_STACKS
|
||||
k_memset(pStackMem, 0xaa, stackSize);
|
||||
#endif
|
||||
|
||||
/* carve the context entry struct from the "base" of the stack */
|
||||
|
||||
pInitialContext =
|
||||
|
|
|
@ -208,10 +208,6 @@ void start_task(struct k_proc *X, /* ptr to task control block */
|
|||
|
||||
/* Note: the field X->worksize now represents the task size in bytes */
|
||||
|
||||
#ifdef CONFIG_INIT_STACKS
|
||||
memset(X->workspace, 0xaa, X->worksize);
|
||||
#endif
|
||||
|
||||
contextOptions = 0;
|
||||
_START_TASK_ARCH(X, &contextOptions);
|
||||
|
||||
|
|
|
@ -79,10 +79,6 @@ void _fiber_start(char *pStack,
|
|||
tCCS *ccs;
|
||||
unsigned int imask;
|
||||
|
||||
#ifdef CONFIG_INIT_STACKS
|
||||
memset((char *)pStack, 0xaa, stackSize);
|
||||
#endif
|
||||
|
||||
ccs = (tCCS *) pStack;
|
||||
_NewContext(pStack,
|
||||
stackSize,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue