diff --git a/arch/risc-v/src/common/riscv_initialstate.c b/arch/risc-v/src/common/riscv_initialstate.c index 014ad62280c3c..95183904ce841 100644 --- a/arch/risc-v/src/common/riscv_initialstate.c +++ b/arch/risc-v/src/common/riscv_initialstate.c @@ -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;