From 4d2d9ecf3905365701d134439ab0e72f7dc90405 Mon Sep 17 00:00:00 2001 From: Inochi Amaoto Date: Sun, 12 May 2024 08:06:12 +0800 Subject: [PATCH] arch/risc-v: fix idle stack assign order The bc022f8cd8 introduces a static way to calculate idle stack address for risc-v platform. However, it uses the reverse order to access idle stack, which breaks boards with smp configuration. Correct the idle stack order of g_cpux_idlestack. Fixes: bc022f8cd8 ("arch/risc-v: unify idle stack calculation") Signed-off-by: Inochi Amaoto --- arch/risc-v/src/common/riscv_common_memorymap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/risc-v/src/common/riscv_common_memorymap.h b/arch/risc-v/src/common/riscv_common_memorymap.h index efe3e050d6..f6352fb48e 100644 --- a/arch/risc-v/src/common/riscv_common_memorymap.h +++ b/arch/risc-v/src/common/riscv_common_memorymap.h @@ -68,7 +68,7 @@ EXTERN uintptr_t g_idle_topstack; /* Address of per-cpu idle stack base */ #define g_cpux_idlestack(cpuid) \ - (g_idle_topstack - SMP_STACK_SIZE * ((cpuid) + 1)) + (g_idle_topstack - SMP_STACK_SIZE * (CONFIG_SMP_NCPUS - (cpuid))) /* Address of the saved user stack pointer */