Skip to content

Commit

Permalink
arch/risc-v/src/common/riscv_initialstate.c: Fix stack pointer in col…
Browse files Browse the repository at this point in the history
…oration

The logical CPU index should be retrieved with up_cpu_index(); 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 <[email protected]>
  • Loading branch information
jlaitine committed Sep 25, 2024
1 parent e96174d commit 85fe8fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/risc-v/src/common/riscv_initialstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(up_cpu_index());
tcb->stack_base_ptr = tcb->stack_alloc_ptr;
tcb->adj_stack_size = SMP_STACK_SIZE;

Expand Down

0 comments on commit 85fe8fc

Please sign in to comment.