arch/arm: set the SP to stack top

fix the stack imbalance

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-03-18 00:06:12 +08:00 committed by Masayuki Ishikawa
parent bfe29c8d1f
commit 19119a9c43
6 changed files with 30 additions and 30 deletions

View File

@ -82,10 +82,9 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the context registers to stack top */
xcp->regs = (FAR void *)STACK_ALIGN_DOWN(
(uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
XCPTCONTEXT_SIZE);
xcp->regs = (FAR void *)((uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
XCPTCONTEXT_SIZE);
/* Initialize the xcp registers */
@ -93,7 +92,8 @@ void up_initial_state(struct tcb_s *tcb)
/* Save the initial stack pointer */
xcp->regs[REG_SP] = (uint32_t)xcp->regs;
xcp->regs[REG_SP] = (uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size;
/* Save the task entry point */

View File

@ -83,10 +83,9 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the context registers to stack top */
xcp->regs = (FAR void *)STACK_ALIGN_DOWN(
(uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
XCPTCONTEXT_SIZE);
xcp->regs = (FAR void *)((uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
XCPTCONTEXT_SIZE);
/* Initialize the xcp registers */
@ -94,7 +93,8 @@ void up_initial_state(struct tcb_s *tcb)
/* Save the initial stack pointer */
xcp->regs[REG_SP] = (uint32_t)xcp->regs;
xcp->regs[REG_SP] = (uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size;
/* Save the task entry point (stripping off the thumb bit) */

View File

@ -82,10 +82,9 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the context registers to stack top */
xcp->regs = (FAR void *)STACK_ALIGN_DOWN(
(uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
XCPTCONTEXT_SIZE);
xcp->regs = (FAR void *)((uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
XCPTCONTEXT_SIZE);
/* Initialize the xcp registers */
@ -93,7 +92,8 @@ void up_initial_state(struct tcb_s *tcb)
/* Save the initial stack pointer */
xcp->regs[REG_SP] = (uint32_t)xcp->regs;
xcp->regs[REG_SP] = (uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size;
/* Save the task entry point */

View File

@ -84,10 +84,9 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the context registers to stack top */
xcp->regs = (FAR void *)STACK_ALIGN_DOWN(
(uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
XCPTCONTEXT_SIZE);
xcp->regs = (FAR void *)((uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
XCPTCONTEXT_SIZE);
/* Initialize the xcp registers */
@ -95,7 +94,8 @@ void up_initial_state(struct tcb_s *tcb)
/* Save the initial stack pointer */
xcp->regs[REG_SP] = (uint32_t)xcp->regs;
xcp->regs[REG_SP] = (uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size;
#ifdef CONFIG_ARMV7M_STACKCHECK
/* Set the stack limit value */

View File

@ -82,10 +82,9 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the context registers to stack top */
xcp->regs = (FAR void *)STACK_ALIGN_DOWN(
(uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
XCPTCONTEXT_SIZE);
xcp->regs = (FAR void *)((uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
XCPTCONTEXT_SIZE);
/* Initialize the xcp registers */
@ -93,7 +92,8 @@ void up_initial_state(struct tcb_s *tcb)
/* Save the initial stack pointer */
xcp->regs[REG_SP] = (uint32_t)xcp->regs;
xcp->regs[REG_SP] = (uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size;
/* Save the task entry point */

View File

@ -84,10 +84,9 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the context registers to stack top */
xcp->regs = (FAR void *)STACK_ALIGN_DOWN(
(uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
XCPTCONTEXT_SIZE);
xcp->regs = (FAR void *)((uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size -
XCPTCONTEXT_SIZE);
/* Initialize the xcp registers */
@ -95,7 +94,8 @@ void up_initial_state(struct tcb_s *tcb)
/* Save the initial stack pointer */
xcp->regs[REG_SP] = (uint32_t)xcp->regs;
xcp->regs[REG_SP] = (uint32_t)tcb->stack_base_ptr +
tcb->adj_stack_size;
#ifdef CONFIG_ARMV8M_STACKCHECK
/* Set the stack limit value */