From 69a6072946d1a98b3aa4f89380e2e55426a828f6 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Thu, 17 Feb 2022 03:10:19 +0800 Subject: [PATCH] arch/ceva: Replace adj_stack_ptr with stack_base_ptr Signed-off-by: Xiang Xiao --- arch/ceva/src/common/up_assert.c | 2 +- arch/ceva/src/common/up_createstack.c | 4 ++-- arch/ceva/src/common/up_initialize.c | 2 +- arch/ceva/src/common/up_stackframe.c | 8 ++++---- arch/ceva/src/common/up_usestack.c | 4 ++-- arch/ceva/src/common/up_vfork.c | 20 ++++++++++---------- arch/ceva/src/xc5/up_initialstate.c | 4 ++-- arch/ceva/src/xm6/up_initialstate.c | 4 ++-- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/arch/ceva/src/common/up_assert.c b/arch/ceva/src/common/up_assert.c index 3d5d8ad00b..4f13cb22af 100644 --- a/arch/ceva/src/common/up_assert.c +++ b/arch/ceva/src/common/up_assert.c @@ -195,7 +195,7 @@ static void up_dumpstate(void) /* Get the limits on the user stack memory */ - ustackbase = (uint32_t)rtcb->adj_stack_ptr; + ustackbase = (uint32_t)rtcb->stack_base_ptr; ustacksize = rtcb->adj_stack_size; /* Get the limits on the interrupt stack memory */ diff --git a/arch/ceva/src/common/up_createstack.c b/arch/ceva/src/common/up_createstack.c index aa0dd241da..864f861a86 100644 --- a/arch/ceva/src/common/up_createstack.c +++ b/arch/ceva/src/common/up_createstack.c @@ -68,7 +68,7 @@ * - adj_stack_size: Stack size after adjustment for hardware, processor, * etc. This value is retained only for debug purposes. * - stack_alloc_ptr: Pointer to allocated stack - * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The initial value of + * - stack_base_ptr: Adjusted stack_alloc_ptr for HW. The initial value of * the stack pointer. * * Inputs: @@ -203,7 +203,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) /* Save the adjusted stack values in the struct tcb_s */ - tcb->adj_stack_ptr = top_of_stack; + tcb->stack_base_ptr = top_of_stack; tcb->adj_stack_size = size_of_stack; #ifdef CONFIG_STACK_COLORATION diff --git a/arch/ceva/src/common/up_initialize.c b/arch/ceva/src/common/up_initialize.c index 4f1fa97de7..8a82cf88eb 100644 --- a/arch/ceva/src/common/up_initialize.c +++ b/arch/ceva/src/common/up_initialize.c @@ -108,7 +108,7 @@ void up_initialize(void) idle = this_task(); /* It should be idle task */ idle->stack_alloc_ptr = g_idle_basestack; - idle->adj_stack_ptr = g_idle_topstack; + idle->stack_base_ptr = g_idle_topstack; idle->adj_stack_size = g_idle_topstack - g_idle_basestack; /* Colorize the interrupt stack */ diff --git a/arch/ceva/src/common/up_stackframe.c b/arch/ceva/src/common/up_stackframe.c index 4d8a3a5a85..d17697c683 100644 --- a/arch/ceva/src/common/up_stackframe.c +++ b/arch/ceva/src/common/up_stackframe.c @@ -65,7 +65,7 @@ * * - adj_stack_size: Stack size after removal of the stack frame from * the stack - * - adj_stack_ptr: Adjusted initial stack pointer after the frame has + * - stack_base_ptr: Adjusted initial stack pointer after the frame has * been removed from the stack. This will still be the initial value * of the stack pointer when the task is started. * @@ -97,9 +97,9 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = topaddr; - tcb->adj_stack_size -= frame_size; + topaddr = tcb->stack_base_ptr - frame_size; + tcb->stack_base_ptr = topaddr; + tcb->adj_stack_size -= frame_size; /* Reinitialize the task state after the stack is adjusted */ diff --git a/arch/ceva/src/common/up_usestack.c b/arch/ceva/src/common/up_usestack.c index 6fc4b780cc..880edc233c 100644 --- a/arch/ceva/src/common/up_usestack.c +++ b/arch/ceva/src/common/up_usestack.c @@ -59,7 +59,7 @@ * processor, etc. This value is retained only for debug * purposes. * - stack_alloc_ptr: Pointer to allocated stack - * - adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The + * - stack_base_ptr: Adjusted stack_alloc_ptr for HW. The * initial value of the stack pointer. * * Inputs: @@ -115,7 +115,7 @@ int up_use_stack(FAR struct tcb_s *tcb, FAR void *stack, size_t stack_size) /* Save the adjusted stack values in the struct tcb_s */ - tcb->adj_stack_ptr = top_of_stack; + tcb->stack_base_ptr = top_of_stack; tcb->adj_stack_size = size_of_stack; #ifdef CONFIG_STACK_COLORATION diff --git a/arch/ceva/src/common/up_vfork.c b/arch/ceva/src/common/up_vfork.c index 00fbb5dc6e..b57ba8db25 100644 --- a/arch/ceva/src/common/up_vfork.c +++ b/arch/ceva/src/common/up_vfork.c @@ -123,7 +123,7 @@ pid_t up_vfork(const uint32_t *regs) /* Allocate the memory and copy argument from parent task */ argv = up_stack_frame((FAR struct tcb_s *)child, argsize); - memcpy(argv, parent->adj_stack_ptr, argsize); + memcpy(argv, parent->stack_base_ptr, argsize); /* How much of the parent's stack was utilized? The CEVA uses * a push-down stack so that the current stack pointer should @@ -131,8 +131,8 @@ pid_t up_vfork(const uint32_t *regs) * stack usage should be the difference between those two. */ - DEBUGASSERT(parent->adj_stack_ptr >= sp); - stackutil = parent->adj_stack_ptr - sp; + DEBUGASSERT(parent->stack_base_ptr >= sp); + stackutil = parent->stack_base_ptr - sp; sinfo("Parent: stacksize:%d stackutil:%d\n", stacksize, stackutil); @@ -143,7 +143,7 @@ pid_t up_vfork(const uint32_t *regs) * effort is overkill. */ - newsp = child->cmn.adj_stack_ptr - stackutil; + newsp = child->cmn.stack_base_ptr - stackutil; memcpy(newsp, sp, stackutil); /* Allocate the context and copy the parent snapshot */ @@ -154,11 +154,11 @@ pid_t up_vfork(const uint32_t *regs) /* Was there a frame pointer in place before? */ - if (regs[REG_FP] <= (uint32_t)parent->adj_stack_ptr && - regs[REG_FP] >= (uint32_t)parent->adj_stack_ptr - stacksize) + if (regs[REG_FP] <= (uint32_t)parent->stack_base_ptr && + regs[REG_FP] >= (uint32_t)parent->stack_base_ptr - stacksize) { - uint32_t frameutil = (uint32_t)parent->adj_stack_ptr - regs[REG_FP]; - newfp = (uint32_t)child->cmn.adj_stack_ptr - frameutil; + uint32_t frameutil = (uint32_t)parent->stack_base_ptr - regs[REG_FP]; + newfp = (uint32_t)child->cmn.stack_base_ptr - frameutil; } else { @@ -166,9 +166,9 @@ pid_t up_vfork(const uint32_t *regs) } sinfo("Parent: stack base:%08x SP:%08x FP:%08x\n", - parent->adj_stack_ptr, sp, regs[REG_FP]); + parent->stack_base_ptr, sp, regs[REG_FP]); sinfo("Child: stack base:%08x SP:%08x FP:%08x\n", - child->cmn.adj_stack_ptr, newsp, newfp); + child->cmn.stack_base_ptr, newsp, newfp); /* Update the stack pointer, frame pointer, and the return value in A0 * should be cleared to zero, providing the indication to the newly started diff --git a/arch/ceva/src/xc5/up_initialstate.c b/arch/ceva/src/xc5/up_initialstate.c index 8a86f98e21..6c94a2d68f 100644 --- a/arch/ceva/src/xc5/up_initialstate.c +++ b/arch/ceva/src/xc5/up_initialstate.c @@ -55,9 +55,9 @@ void up_initial_state(struct tcb_s *tcb) memset(xcp, 0, sizeof(struct xcptcontext)); - if (tcb->adj_stack_ptr) + if (tcb->stack_base_ptr) { - xcp->regs = tcb->adj_stack_ptr - XCPTCONTEXT_SIZE; + xcp->regs = tcb->stack_base_ptr - XCPTCONTEXT_SIZE; memset(xcp->regs, 0, XCPTCONTEXT_SIZE); /* Save the initial stack pointer */ diff --git a/arch/ceva/src/xm6/up_initialstate.c b/arch/ceva/src/xm6/up_initialstate.c index 651a6c3e4f..d9f7025aff 100644 --- a/arch/ceva/src/xm6/up_initialstate.c +++ b/arch/ceva/src/xm6/up_initialstate.c @@ -61,9 +61,9 @@ void up_initial_state(struct tcb_s *tcb) memset(xcp, 0, sizeof(struct xcptcontext)); - if (tcb->adj_stack_ptr) + if (tcb->stack_base_ptr) { - xcp->regs = tcb->adj_stack_ptr - XCPTCONTEXT_SIZE; + xcp->regs = tcb->stack_base_ptr - XCPTCONTEXT_SIZE; memset(xcp->regs, 0, XCPTCONTEXT_SIZE); /* Save the initial stack pointer */