arch/risc-v/src/common/riscv_initialstate.c: Fix stack pointer in coloration

The logical CPU index should be retrieved with this_cpu(); the
riscv_mhartid() returns the actual hart id of the SoC.

For mpfs target for example, NuttX can run on a single HART, for example on mhartid 2, but there is still just one logical CPU for the NuttX.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
Jukka Laitinen
2024-09-24 13:13:59 +03:00
committed by Xiang Xiao
parent 6d72a8d676
commit 06b3416384
+1 -1
View File
@@ -97,7 +97,7 @@ void up_initial_state(struct tcb_s *tcb)
if (tcb->pid == IDLE_PROCESS_ID)
{
tcb->stack_alloc_ptr = (void *)g_cpux_idlestack(riscv_mhartid());
tcb->stack_alloc_ptr = (void *)g_cpux_idlestack(this_cpu());
tcb->stack_base_ptr = tcb->stack_alloc_ptr;
tcb->adj_stack_size = SMP_STACK_SIZE;