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:
Xiang Xiao
2021-06-08 17:55:04 +08:00
committed by David Sidrane
parent dbf9c87a42
commit fa0d123f87
29 changed files with 352 additions and 53 deletions
+18 -3
View File
@@ -59,9 +59,24 @@ void up_initial_state(struct tcb_s *tcb)
if (tcb->pid == 0)
{
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE);
tcb->stack_base_ptr = tcb->stack_alloc_ptr;
char *stack_ptr = (char *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE);
#ifdef CONFIG_STACK_COLORATION
char *stack_end = (char *)up_getsp();
/* If stack debug is enabled, then fill the stack with a
* recognizable value that we can use later to test for high
* water marks.
*/
while (stack_ptr < stack_end)
{
*--stack_end = 0xaa;
}
#endif /* CONFIG_STACK_COLORATION */
tcb->stack_alloc_ptr = stack_ptr;
tcb->stack_base_ptr = stack_ptr;
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
}
+18 -3
View File
@@ -63,9 +63,24 @@ void up_initial_state(struct tcb_s *tcb)
if (tcb->pid == 0)
{
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE);
tcb->stack_base_ptr = tcb->stack_alloc_ptr;
char *stack_ptr = (char *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE);
#ifdef CONFIG_STACK_COLORATION
char *stack_end = (char *)up_getsp();
/* If stack debug is enabled, then fill the stack with a
* recognizable value that we can use later to test for high
* water marks.
*/
while (stack_ptr < stack_end)
{
*--stack_end = 0xaa;
}
#endif /* CONFIG_STACK_COLORATION */
tcb->stack_alloc_ptr = stack_ptr;
tcb->stack_base_ptr = stack_ptr;
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
}