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:
parent
dbf9c87a42
commit
fa0d123f87
@ -62,8 +62,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.
|
||||
*/
|
||||
|
||||
arm_stack_color(tcb->stack_alloc_ptr, 0);
|
||||
#endif /* CONFIG_STACK_COLORATION */
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
@ -64,8 +64,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.
|
||||
*/
|
||||
|
||||
arm_stack_color(tcb->stack_alloc_ptr, 0);
|
||||
#endif /* CONFIG_STACK_COLORATION */
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
@ -62,8 +62,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.
|
||||
*/
|
||||
|
||||
arm_stack_color(tcb->stack_alloc_ptr, 0);
|
||||
#endif /* CONFIG_STACK_COLORATION */
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
@ -65,8 +65,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.
|
||||
*/
|
||||
|
||||
arm_stack_color(tcb->stack_alloc_ptr, 0);
|
||||
#endif /* CONFIG_STACK_COLORATION */
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
@ -62,8 +62,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.
|
||||
*/
|
||||
|
||||
arm_stack_color(tcb->stack_alloc_ptr, 0);
|
||||
#endif /* CONFIG_STACK_COLORATION */
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
@ -65,8 +65,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.
|
||||
*/
|
||||
|
||||
arm_stack_color(tcb->stack_alloc_ptr, 0);
|
||||
#endif /* CONFIG_STACK_COLORATION */
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
@ -173,7 +173,8 @@ void arm_stack_color(FAR void *stackbase, size_t nbytes)
|
||||
/* Take extra care that we do not write outside the stack boundaries */
|
||||
|
||||
start = INT32_ALIGN_UP((uintptr_t)stackbase);
|
||||
end = INT32_ALIGN_DOWN((uintptr_t)stackbase + nbytes);
|
||||
end = nbytes ? INT32_ALIGN_DOWN((uintptr_t)stackbase + nbytes) :
|
||||
up_getsp(); /* 0: colorize the running stack */
|
||||
|
||||
/* Get the adjusted size based on the top and bottom of the stack */
|
||||
|
||||
|
@ -61,9 +61,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 *)avr_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 = STACK_COLOR;
|
||||
}
|
||||
#endif /* CONFIG_STACK_COLORATION */
|
||||
|
||||
tcb->stack_alloc_ptr = stack_ptr;
|
||||
tcb->stack_base_ptr = stack_ptr;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
|
@ -58,9 +58,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 *)avr_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 = STACK_COLOR;
|
||||
}
|
||||
#endif /* CONFIG_STACK_COLORATION */
|
||||
|
||||
tcb->stack_alloc_ptr = stack_ptr;
|
||||
tcb->stack_base_ptr = stack_ptr;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
|
@ -58,9 +58,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;
|
||||
}
|
||||
|
||||
|
@ -62,9 +62,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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -60,9 +60,24 @@ void up_initial_state(FAR 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;
|
||||
}
|
||||
|
||||
|
@ -65,9 +65,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;
|
||||
}
|
||||
|
||||
|
@ -77,9 +77,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;
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,8 @@ void riscv_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 */
|
||||
|
@ -63,8 +63,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.
|
||||
*/
|
||||
|
||||
riscv_stack_color(tcb->stack_alloc_ptr, 0);
|
||||
#endif /* CONFIG_STACK_COLORATION */
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
@ -63,8 +63,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.
|
||||
*/
|
||||
|
||||
riscv_stack_color(tcb->stack_alloc_ptr, 0);
|
||||
#endif /* CONFIG_STACK_COLORATION */
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
@ -156,7 +156,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 */
|
||||
|
@ -55,8 +55,17 @@ void up_initial_state(struct tcb_s *tcb)
|
||||
{
|
||||
tcb->stack_alloc_ptr = (void *)(up_getsp() -
|
||||
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 */
|
||||
}
|
||||
|
||||
memset(&tcb->xcp, 0, sizeof(struct xcptcontext));
|
||||
|
@ -58,9 +58,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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,8 @@ void up_stack_color(FAR void *stackbase, size_t nbytes)
|
||||
/* Take extra care that we do not write outside the stack boundaries */
|
||||
|
||||
start = STACK_ALIGN_UP((uintptr_t)stackbase);
|
||||
end = STACK_ALIGN_DOWN((uintptr_t)stackbase + nbytes);
|
||||
end = nbytes ? STACK_ALIGN_DOWN((uintptr_t)stackbase + nbytes) :
|
||||
up_getsp(); /* 0: colorize the running stack */
|
||||
|
||||
/* Get the adjusted size based on the top and bottom of the stack */
|
||||
|
||||
|
@ -63,8 +63,17 @@ void up_initial_state(struct tcb_s *tcb)
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
tcb->stack_alloc_ptr = g_idlestack;
|
||||
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 */
|
||||
|
@ -57,8 +57,23 @@ void up_initial_state(struct tcb_s *tcb)
|
||||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
tcb->stack_alloc_ptr = (void *)CONFIG_STACK_BASE;
|
||||
tcb->stack_base_ptr = tcb->stack_alloc_ptr;
|
||||
char *stack_ptr = (char *)CONFIG_STACK_BASE;
|
||||
#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;
|
||||
}
|
||||
|
||||
|
@ -57,8 +57,23 @@ void up_initial_state(struct tcb_s *tcb)
|
||||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
tcb->stack_alloc_ptr = (void *)CONFIG_STACK_BASE;
|
||||
tcb->stack_base_ptr = tcb->stack_alloc_ptr;
|
||||
char *stack_ptr = (char *)CONFIG_STACK_BASE;
|
||||
#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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user