xiaoxiang781216 commented on a change in pull request #5484: URL: https://github.com/apache/incubator-nuttx/pull/5484#discussion_r805683092
########## File path: arch/risc-v/src/common/riscv_cpuidlestack.c ########## @@ -28,24 +28,86 @@ #include <assert.h> #include <nuttx/arch.h> +#include <nuttx/compiler.h> #include <nuttx/sched.h> #include "riscv_internal.h" -#include "k210_memorymap.h" -#ifdef CONFIG_SMP +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ -#define SMP_STACK_MASK 7 -#define SMP_STACK_SIZE ((CONFIG_IDLETHREAD_STACKSIZE + 7) & ~7) +#define SMP_STACK_MASK 15 +#define SMP_STACK_SIZE (CONFIG_IDLETHREAD_STACKSIZE & ~15) #define STACK_ISALIGNED(a) ((uintptr_t)(a) & ~SMP_STACK_MASK) +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/** + * Note: + * 1. QEMU-RV supports up to 8 cores currently. + * 2. RISC-V requires a 16-byte stack alignment. + */ + #if CONFIG_SMP_NCPUS > 1 -static const uintptr_t g_cpu_stackalloc[CONFIG_SMP_NCPUS] = +static uint8_t aligned_data(16) cpu1_idlestack[CONFIG_IDLETHREAD_STACKSIZE]; +#endif + +#if CONFIG_SMP_NCPUS > 2 +static uint8_t aligned_data(16) cpu2_idlestack[CONFIG_IDLETHREAD_STACKSIZE]; +#endif + +#if CONFIG_SMP_NCPUS > 3 +static uint8_t aligned_data(16) cpu3_idlestack[CONFIG_IDLETHREAD_STACKSIZE]; +#endif + +#if CONFIG_SMP_NCPUS > 4 +static uint8_t aligned_data(16) cpu4_idlestack[CONFIG_IDLETHREAD_STACKSIZE]; +#endif + +#if CONFIG_SMP_NCPUS > 5 +static uint8_t aligned_data(16) cpu5_idlestack[CONFIG_IDLETHREAD_STACKSIZE]; +#endif + +#if CONFIG_SMP_NCPUS > 6 +static uint8_t aligned_data(16) cpu6_idlestack[CONFIG_IDLETHREAD_STACKSIZE]; +#endif + +#if CONFIG_SMP_NCPUS > 7 +static uint8_t aligned_data(16) cpu7_idlestack[CONFIG_IDLETHREAD_STACKSIZE]; +#endif + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +uint8_t *g_cpu_basestack[CONFIG_SMP_NCPUS] = Review comment: the problem can be fixed it by add const instead. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org