mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
arch/ceva: Replace adj_stack_ptr with stack_base_ptr
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Masayuki Ishikawa
parent
814cab1cd1
commit
69a6072946
@@ -195,7 +195,7 @@ static void up_dumpstate(void)
|
|||||||
|
|
||||||
/* Get the limits on the user stack memory */
|
/* 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;
|
ustacksize = rtcb->adj_stack_size;
|
||||||
|
|
||||||
/* Get the limits on the interrupt stack memory */
|
/* Get the limits on the interrupt stack memory */
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
* - adj_stack_size: Stack size after adjustment for hardware, processor,
|
* - adj_stack_size: Stack size after adjustment for hardware, processor,
|
||||||
* etc. This value is retained only for debug purposes.
|
* etc. This value is retained only for debug purposes.
|
||||||
* - stack_alloc_ptr: Pointer to allocated stack
|
* - 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.
|
* the stack pointer.
|
||||||
*
|
*
|
||||||
* Inputs:
|
* 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 */
|
/* 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;
|
tcb->adj_stack_size = size_of_stack;
|
||||||
|
|
||||||
#ifdef CONFIG_STACK_COLORATION
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ void up_initialize(void)
|
|||||||
|
|
||||||
idle = this_task(); /* It should be idle task */
|
idle = this_task(); /* It should be idle task */
|
||||||
idle->stack_alloc_ptr = g_idle_basestack;
|
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;
|
idle->adj_stack_size = g_idle_topstack - g_idle_basestack;
|
||||||
|
|
||||||
/* Colorize the interrupt stack */
|
/* Colorize the interrupt stack */
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
*
|
*
|
||||||
* - adj_stack_size: Stack size after removal of the stack frame from
|
* - adj_stack_size: Stack size after removal of the stack frame from
|
||||||
* the stack
|
* 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
|
* been removed from the stack. This will still be the initial value
|
||||||
* of the stack pointer when the task is started.
|
* of the stack pointer when the task is started.
|
||||||
*
|
*
|
||||||
@@ -97,8 +97,8 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size)
|
|||||||
|
|
||||||
/* Save the adjusted stack values in the struct tcb_s */
|
/* Save the adjusted stack values in the struct tcb_s */
|
||||||
|
|
||||||
topaddr = tcb->adj_stack_ptr - frame_size;
|
topaddr = tcb->stack_base_ptr - frame_size;
|
||||||
tcb->adj_stack_ptr = topaddr;
|
tcb->stack_base_ptr = topaddr;
|
||||||
tcb->adj_stack_size -= frame_size;
|
tcb->adj_stack_size -= frame_size;
|
||||||
|
|
||||||
/* Reinitialize the task state after the stack is adjusted */
|
/* Reinitialize the task state after the stack is adjusted */
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
* processor, etc. This value is retained only for debug
|
* processor, etc. This value is retained only for debug
|
||||||
* purposes.
|
* purposes.
|
||||||
* - stack_alloc_ptr: Pointer to allocated stack
|
* - 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.
|
* initial value of the stack pointer.
|
||||||
*
|
*
|
||||||
* Inputs:
|
* 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 */
|
/* 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;
|
tcb->adj_stack_size = size_of_stack;
|
||||||
|
|
||||||
#ifdef CONFIG_STACK_COLORATION
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ pid_t up_vfork(const uint32_t *regs)
|
|||||||
/* Allocate the memory and copy argument from parent task */
|
/* Allocate the memory and copy argument from parent task */
|
||||||
|
|
||||||
argv = up_stack_frame((FAR struct tcb_s *)child, argsize);
|
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
|
/* How much of the parent's stack was utilized? The CEVA uses
|
||||||
* a push-down stack so that the current stack pointer should
|
* 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.
|
* stack usage should be the difference between those two.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEBUGASSERT(parent->adj_stack_ptr >= sp);
|
DEBUGASSERT(parent->stack_base_ptr >= sp);
|
||||||
stackutil = parent->adj_stack_ptr - sp;
|
stackutil = parent->stack_base_ptr - sp;
|
||||||
|
|
||||||
sinfo("Parent: stacksize:%d stackutil:%d\n", stacksize, stackutil);
|
sinfo("Parent: stacksize:%d stackutil:%d\n", stacksize, stackutil);
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ pid_t up_vfork(const uint32_t *regs)
|
|||||||
* effort is overkill.
|
* effort is overkill.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
newsp = child->cmn.adj_stack_ptr - stackutil;
|
newsp = child->cmn.stack_base_ptr - stackutil;
|
||||||
memcpy(newsp, sp, stackutil);
|
memcpy(newsp, sp, stackutil);
|
||||||
|
|
||||||
/* Allocate the context and copy the parent snapshot */
|
/* 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? */
|
/* Was there a frame pointer in place before? */
|
||||||
|
|
||||||
if (regs[REG_FP] <= (uint32_t)parent->adj_stack_ptr &&
|
if (regs[REG_FP] <= (uint32_t)parent->stack_base_ptr &&
|
||||||
regs[REG_FP] >= (uint32_t)parent->adj_stack_ptr - stacksize)
|
regs[REG_FP] >= (uint32_t)parent->stack_base_ptr - stacksize)
|
||||||
{
|
{
|
||||||
uint32_t frameutil = (uint32_t)parent->adj_stack_ptr - regs[REG_FP];
|
uint32_t frameutil = (uint32_t)parent->stack_base_ptr - regs[REG_FP];
|
||||||
newfp = (uint32_t)child->cmn.adj_stack_ptr - frameutil;
|
newfp = (uint32_t)child->cmn.stack_base_ptr - frameutil;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -166,9 +166,9 @@ pid_t up_vfork(const uint32_t *regs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sinfo("Parent: stack base:%08x SP:%08x FP:%08x\n",
|
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",
|
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
|
/* Update the stack pointer, frame pointer, and the return value in A0
|
||||||
* should be cleared to zero, providing the indication to the newly started
|
* should be cleared to zero, providing the indication to the newly started
|
||||||
|
|||||||
@@ -55,9 +55,9 @@ void up_initial_state(struct tcb_s *tcb)
|
|||||||
|
|
||||||
memset(xcp, 0, sizeof(struct xcptcontext));
|
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);
|
memset(xcp->regs, 0, XCPTCONTEXT_SIZE);
|
||||||
|
|
||||||
/* Save the initial stack pointer */
|
/* Save the initial stack pointer */
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ void up_initial_state(struct tcb_s *tcb)
|
|||||||
|
|
||||||
memset(xcp, 0, sizeof(struct xcptcontext));
|
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);
|
memset(xcp->regs, 0, XCPTCONTEXT_SIZE);
|
||||||
|
|
||||||
/* Save the initial stack pointer */
|
/* Save the initial stack pointer */
|
||||||
|
|||||||
Reference in New Issue
Block a user