arch/ceva: Move the idle stack initialization to up_initial_state
to follow other arch's implementation Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
4cc28882f9
commit
f94093bc2e
@ -30,6 +30,8 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <arch/irq.h>
|
||||||
#include <arch/chip/chip.h>
|
#include <arch/chip/chip.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -230,8 +230,12 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
|||||||
#ifdef CONFIG_STACK_COLORATION
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
void up_stack_color(FAR void *stackbase, size_t nbytes)
|
void up_stack_color(FAR void *stackbase, size_t nbytes)
|
||||||
{
|
{
|
||||||
uint32_t *stkptr = stackbase;
|
/* Take extra care that we do not write outsize the stack boundaries */
|
||||||
size_t nwords = nbytes / sizeof(uint32_t);
|
|
||||||
|
uint32_t *stkptr = (uint32_t *)(((uintptr_t)stackbase + 3) & ~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 */
|
/* Set the entire stack to the coloration value */
|
||||||
|
|
||||||
|
@ -47,8 +47,6 @@
|
|||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
|
|
||||||
#include "sched/sched.h"
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -98,19 +96,10 @@ static inline void up_color_intstack(void)
|
|||||||
|
|
||||||
void up_initialize(void)
|
void up_initialize(void)
|
||||||
{
|
{
|
||||||
struct tcb_s *idle;
|
|
||||||
|
|
||||||
/* Initialize global variables */
|
/* Initialize global variables */
|
||||||
|
|
||||||
CURRENT_REGS = NULL;
|
CURRENT_REGS = NULL;
|
||||||
|
|
||||||
/* Initialize the idle task stack info */
|
|
||||||
|
|
||||||
idle = this_task(); /* It should be idle task */
|
|
||||||
idle->stack_alloc_ptr = g_idle_basestack;
|
|
||||||
idle->stack_base_ptr = g_idle_topstack;
|
|
||||||
idle->adj_stack_size = g_idle_topstack - g_idle_basestack;
|
|
||||||
|
|
||||||
/* Colorize the interrupt stack */
|
/* Colorize the interrupt stack */
|
||||||
|
|
||||||
up_color_intstack();
|
up_color_intstack();
|
||||||
|
@ -243,10 +243,6 @@ static void init_kernelspace(void)
|
|||||||
|
|
||||||
mpu_priv_data(g_idle_basestack,
|
mpu_priv_data(g_idle_basestack,
|
||||||
g_idle_topstack - g_idle_basestack);
|
g_idle_topstack - g_idle_basestack);
|
||||||
#ifdef CONFIG_STACK_COLORATION
|
|
||||||
up_stack_color(g_idle_basestack,
|
|
||||||
g_idle_topstack - g_idle_basestack - 256);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_BUILD_PROTECTED
|
#ifdef CONFIG_BUILD_PROTECTED
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
|
|
||||||
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -51,6 +53,23 @@ void up_initial_state(struct tcb_s *tcb)
|
|||||||
{
|
{
|
||||||
struct xcptcontext *xcp = &tcb->xcp;
|
struct xcptcontext *xcp = &tcb->xcp;
|
||||||
|
|
||||||
|
/* Initialize the idle thread stack */
|
||||||
|
|
||||||
|
if (tcb->pid == 0)
|
||||||
|
{
|
||||||
|
tcb->stack_alloc_ptr = g_idle_basestack;
|
||||||
|
tcb->stack_base_ptr = tcb->stack_alloc_ptr;
|
||||||
|
tcb->adj_stack_size = g_idle_topstack - g_idle_basestack;
|
||||||
|
#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 */
|
/* Initialize the initial exception register context structure */
|
||||||
|
|
||||||
memset(xcp, 0, sizeof(struct xcptcontext));
|
memset(xcp, 0, sizeof(struct xcptcontext));
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
|
|
||||||
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -57,6 +59,23 @@ void up_initial_state(struct tcb_s *tcb)
|
|||||||
{
|
{
|
||||||
struct xcptcontext *xcp = &tcb->xcp;
|
struct xcptcontext *xcp = &tcb->xcp;
|
||||||
|
|
||||||
|
/* Initialize the idle thread stack */
|
||||||
|
|
||||||
|
if (tcb->pid == 0)
|
||||||
|
{
|
||||||
|
tcb->stack_alloc_ptr = g_idle_basestack;
|
||||||
|
tcb->stack_base_ptr = tcb->stack_alloc_ptr;
|
||||||
|
tcb->adj_stack_size = g_idle_topstack - g_idle_basestack;
|
||||||
|
#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 */
|
/* Initialize the initial exception register context structure */
|
||||||
|
|
||||||
memset(xcp, 0, sizeof(struct xcptcontext));
|
memset(xcp, 0, sizeof(struct xcptcontext));
|
||||||
|
Loading…
Reference in New Issue
Block a user