forked from nuttx/nuttx-update
arch: Initialize the idle thread stack info directly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
29c6f11239
commit
efee1c6ded
24 changed files with 104 additions and 55 deletions
|
@ -75,8 +75,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -77,8 +77,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -75,8 +75,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -63,8 +63,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -75,8 +75,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -63,8 +63,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -75,8 +75,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure. Zeroing
|
||||
|
|
|
@ -73,8 +73,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure. Zeroing
|
||||
|
|
|
@ -72,8 +72,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
@ -98,14 +100,14 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
/* Condition code register:
|
||||
*
|
||||
* Bit 0: C — Carry/Borrow status bit
|
||||
* Bit 1: V — Two’s complement overflow status bit
|
||||
* Bit 2: Z — Zero status bit
|
||||
* Bit 3: N — Negative status bit
|
||||
* Bit 4: I — Maskable interrupt control bit
|
||||
* Bit 5: H — Half-carry status bit
|
||||
* Bit 6: X — Non-maskable interrupt control bit
|
||||
* Bit 7: S — STOP instruction control bit
|
||||
* Bit 0: C Carry/Borrow status bit
|
||||
* Bit 1: V Two's complement overflow status bit
|
||||
* Bit 2: Z Zero status bit
|
||||
* Bit 3: N Negative status bit
|
||||
* Bit 4: I Maskable interrupt control bit
|
||||
* Bit 5: H Half-carry status bit
|
||||
* Bit 6: X Non-maskable interrupt control bit
|
||||
* Bit 7: S STOP instruction control bit
|
||||
*/
|
||||
|
||||
# ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||
|
|
|
@ -77,8 +77,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -75,8 +75,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -79,8 +79,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -77,8 +77,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -74,8 +74,10 @@ void up_initial_state(FAR struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (FAR void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -65,8 +65,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -92,8 +92,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -76,8 +76,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -76,8 +76,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -68,8 +68,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
{
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(sim_getsp() -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(sim_getsp() -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)sim_getsp();
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
memset(&tcb->xcp, 0, sizeof(struct xcptcontext));
|
||||
|
|
|
@ -73,8 +73,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -62,8 +62,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE), CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_ptr = (void *)g_idle_topstack;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -77,7 +77,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb, g_idlestack, IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = g_idlestack;
|
||||
tcb->adj_stack_ptr = (char *)g_idlestack +
|
||||
CONFIG_IDLETHREAD_STACKSIZE;
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -57,8 +57,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb,
|
||||
(void *)CONFIG_STACK_BASE, CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)CONFIG_STACK_BASE;
|
||||
tcb->adj_stack_ptr = (void *)(CONFIG_STACK_BASE +
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
|
@ -57,8 +57,10 @@ void up_initial_state(struct tcb_s *tcb)
|
|||
|
||||
if (tcb->pid == 0)
|
||||
{
|
||||
up_use_stack(tcb,
|
||||
(void *)CONFIG_STACK_BASE, CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->stack_alloc_ptr = (void *)CONFIG_STACK_BASE;
|
||||
tcb->adj_stack_ptr = (void *)(CONFIG_STACK_BASE +
|
||||
CONFIG_IDLETHREAD_STACKSIZE);
|
||||
tcb->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
|
||||
}
|
||||
|
||||
/* Initialize the initial exception register context structure */
|
||||
|
|
Loading…
Reference in a new issue