mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
arch: Colorize the idle thread stack in an unified way
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: Idae8da53e5a4799a8edc0e882f17fd515b70cb14
This commit is contained in:
committed by
David Sidrane
parent
dbf9c87a42
commit
fa0d123f87
@@ -225,7 +225,8 @@ void up_stack_color(FAR void *stackbase, size_t nbytes)
|
||||
/* Take extra care that we do not write outsize the stack boundaries */
|
||||
|
||||
uint32_t *stkptr = (uint32_t *)(((uintptr_t)stackbase + 3) & ~3);
|
||||
uintptr_t stkend = (((uintptr_t)stackbase + nbytes) & ~3);
|
||||
uintptr_t stkend = nbytes ? (((uintptr_t)stackbase + nbytes) & ~3) :
|
||||
up_getsp(); /* 0: colorize the running stack */
|
||||
size_t nwords = (stkend - (uintptr_t)stackbase) >> 2;
|
||||
|
||||
/* Set the entire stack to the coloration value */
|
||||
|
||||
@@ -79,8 +79,17 @@ void up_initial_state(struct tcb_s *tcb)
|
||||
{
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_base_ptr = tcb->stack_alloc_ptr;
|
||||
tcb->stack_base_ptr = tcb->stack_alloc_ptr;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
|
||||
#ifdef CONFIG_STACK_COLORATION
|
||||
/* If stack debug is enabled, then fill the stack with a
|
||||
* recognizable value that we can use later to test for high
|
||||
* water marks.
|
||||
*/
|
||||
|
||||
up_stack_color(tcb->stack_alloc_ptr, 0);
|
||||
#endif /* CONFIG_STACK_COLORATION */
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
||||
Reference in New Issue
Block a user