arch: color the intstack for all the CPUs

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2024-03-29 10:14:22 +08:00 committed by Alan Carvalho de Assis
parent 3844efb5b8
commit 4e725ecd44
4 changed files with 22 additions and 26 deletions

View File

@ -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()

View File

@ -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()

View File

@ -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

View File

@ -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()