This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 4d2d9ecf39 arch/risc-v: fix idle stack assign order
4d2d9ecf39 is described below

commit 4d2d9ecf3905365701d134439ab0e72f7dc90405
Author: Inochi Amaoto <[email protected]>
AuthorDate: Sun May 12 08:06:12 2024 +0800

    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 <[email protected]>
---
 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 */
 

Reply via email to