diff --git a/arch/arm/src/common/arm_initialize.c b/arch/arm/src/common/arm_initialize.c index cda1d3cd19..13d99269f3 100644 --- a/arch/arm/src/common/arm_initialize.c +++ b/arch/arm/src/common/arm_initialize.c @@ -57,18 +57,15 @@ volatile uint32_t *g_current_regs[CONFIG_SMP_NCPUS]; static inline void arm_color_intstack(void) { #ifdef CONFIG_SMP - uint32_t *ptr = (uint32_t *)arm_intstack_alloc(up_cpu_index()); -#else - uint32_t *ptr = (uint32_t *)g_intstackalloc; -#endif - ssize_t size; + int cpu; - for (size = ((CONFIG_ARCH_INTERRUPTSTACK & ~3) * CONFIG_SMP_NCPUS); - size > 0; - size -= sizeof(uint32_t)) + for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++) { - *ptr++ = INTSTACK_COLOR; + arm_stack_color((void *)arm_intstack_alloc(cpu), INTSTACK_SIZE); } +#else + arm_stack_color((void *)g_intstackalloc, INTSTACK_SIZE); +#endif } #else # define arm_color_intstack() diff --git a/arch/arm64/src/common/arm64_initialize.c b/arch/arm64/src/common/arm64_initialize.c index 72c5346fff..0502d7872d 100644 --- a/arch/arm64/src/common/arm64_initialize.c +++ b/arch/arm64/src/common/arm64_initialize.c @@ -137,11 +137,15 @@ uintptr_t arm64_intstack_top(int cpu) static void up_color_intstack(void) { #ifdef CONFIG_SMP - void *ptr = (void *)g_interrupt_stacks[up_cpu_index()]; + int cpu; + + for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++) + { + arm64_stack_color((void *)arm64_intstack_alloc(cpu), INTSTACK_SIZE); + } #else - void *ptr = (void *)g_interrupt_stack; + arm64_stack_color((void *)g_interrupt_stack, INTSTACK_SIZE); #endif - arm64_stack_color(ptr, INTSTACK_SIZE); } #else # define up_color_intstack() diff --git a/arch/sparc/src/common/sparc_initialize.c b/arch/sparc/src/common/sparc_initialize.c index e20b6315ab..6189670653 100644 --- a/arch/sparc/src/common/sparc_initialize.c +++ b/arch/sparc/src/common/sparc_initialize.c @@ -103,14 +103,11 @@ volatile uint32_t *g_current_regs[CONFIG_SMP_NCPUS]; #if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 7 static inline void up_color_intstack(void) { - uint32_t *ptr = (uint32_t *)sparc_intstack_alloc(up_cpu_index()); - ssize_t size; + int cpu; - for (size = ((CONFIG_ARCH_INTERRUPTSTACK & ~7) * CONFIG_SMP_NCPUS); - size > 0; - size -= sizeof(uint32_t)) + for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++) { - *ptr++ = INTSTACK_COLOR; + sparc_stack_color((void *)sparc_intstack_alloc(cpu), INTSTACK_SIZE); } } #else diff --git a/arch/xtensa/src/common/xtensa_initialize.c b/arch/xtensa/src/common/xtensa_initialize.c index 7635121c9e..981f8af593 100644 --- a/arch/xtensa/src/common/xtensa_initialize.c +++ b/arch/xtensa/src/common/xtensa_initialize.c @@ -61,17 +61,15 @@ volatile uint32_t *g_current_regs[CONFIG_SMP_NCPUS]; static inline void xtensa_color_intstack(void) { #ifdef CONFIG_SMP - uint32_t *ptr = (uint32_t *)xtensa_intstack_alloc(up_cpu_index()); -#else - uint32_t *ptr = (uint32_t *)g_intstackalloc; -#endif - ssize_t size; + int cpu; - for (size = INTSTACK_SIZE * CONFIG_SMP_NCPUS; - size > 0; size -= sizeof(uint32_t)) + for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++) { - *ptr++ = INTSTACK_COLOR; + xtensa_stack_color((void *)xtensa_intstack_alloc(cpu), INTSTACK_SIZE); } +#else + xtensa_stack_color((void *)g_intstackalloc, INTSTACK_SIZE); +#endif } #else # define xtensa_color_intstack()