arch/init: call up_color_intstack before up_irq_enable

Make sure interrupt stack is colored before IRQ is enabled.

Currently, after calling irq_initialize in nx_start to
enable interrupts, there is still a period of execution
path before the interrupt stack is colored.

Signed-off-by: guoshengyuan1 <guoshengyuan1@xiaomi.com>
This commit is contained in:
guoshengyuan1 2025-10-13 10:01:49 +08:00 • committed by Xiang Xiao
parent 5874f46a5b
commit 79711737bc
112 changed files with 363 additions and 293 deletions

View file

@ -151,6 +151,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif

View file

@ -125,6 +125,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -127,6 +127,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -364,6 +364,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -158,6 +158,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_restore(PSR_MODE_SYS | PSR_F_BIT);
#endif
}

View file

@ -49,6 +49,31 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: arm_color_intstack
*
* Description:
* Set the interrupt stack to a value so that later we can determine how
* much stack space was used by interrupt handling logic
*
****************************************************************************/
#if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
void arm_color_intstack(void)
{
#ifdef CONFIG_SMP
int cpu;
for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++)
{
arm_stack_color((void *)up_get_intstackbase(cpu), INTSTACK_SIZE);
}
#else
arm_stack_color((void *)g_intstackalloc, INTSTACK_SIZE);
#endif
}
#endif
/****************************************************************************
* Name: arm_stack_check
*

View file

@ -38,37 +38,6 @@
volatile bool g_interrupt_context[CONFIG_SMP_NCPUS];
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: arm_color_intstack
*
* Description:
* Set the interrupt stack to a value so that later we can determine how
* much stack space was used by interrupt handling logic
*
****************************************************************************/
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
static inline void arm_color_intstack(void)
{
#ifdef CONFIG_SMP
int cpu;
for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++)
{
arm_stack_color((void *)up_get_intstackbase(cpu), INTSTACK_SIZE);
}
#else
arm_stack_color((void *)g_intstackalloc, INTSTACK_SIZE);
#endif
}
#else
# define arm_color_intstack()
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@ -98,10 +67,6 @@ void up_initialize(void)
arm_initialize_stack();
#endif
/* Colorize the interrupt stack */
arm_color_intstack();
/* Add any extra memory fragments to the memory manager */
arm_addregion();

View file

@ -479,6 +479,13 @@ size_t arm_stack_check(void *stackbase, size_t nbytes);
void arm_stack_color(void *stackbase, size_t nbytes);
#endif
#if defined(CONFIG_STACK_COLORATION) &&\
defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
void arm_color_intstack(void);
#else
# define arm_color_intstack()
#endif
#ifdef CONFIG_ARCH_TRUSTZONE_SECURE
int arm_gen_nonsecurefault(int irq, uint32_t *regs);
#else

View file

@ -208,6 +208,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -317,6 +317,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -368,6 +368,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -91,6 +91,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_restore(PSR_MODE_SYS | PSR_F_BIT);
#endif
}

View file

@ -366,6 +366,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -347,6 +347,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -371,6 +371,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -124,6 +124,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -63,6 +63,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_restore(PSR_MODE_SYS | PSR_F_BIT);
#endif
}

View file

@ -149,6 +149,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -510,6 +510,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -398,6 +398,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -222,6 +222,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -525,6 +525,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -371,6 +371,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -74,6 +74,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_restore(PSR_MODE_SYS | PSR_F_BIT);
#endif
}

View file

@ -87,6 +87,7 @@ void up_irqinitialize(void)
/* Enable global ARM interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_restore(PSR_MODE_SYS | PSR_F_BIT);
#endif
}

View file

@ -87,6 +87,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_restore(PSR_MODE_SYS | PSR_F_BIT);
#endif
}

View file

@ -351,6 +351,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -356,6 +356,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -356,6 +356,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -116,6 +116,7 @@ void up_irqinitialize(void)
getreg32(0x98800020));
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_restore(PSR_MODE_SYS | PSR_F_BIT);
#endif
}

View file

@ -251,6 +251,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -416,6 +416,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -362,6 +362,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -360,6 +360,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -368,6 +368,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -214,6 +214,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -345,6 +345,7 @@ void up_irqinitialize(void)
/* svc(SVC_CALL_WR); */
arm_color_intstack();
up_irq_enable();
#endif

View file

@ -130,6 +130,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -261,6 +261,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -369,6 +369,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
}

View file

@ -177,6 +177,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -391,6 +391,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -396,6 +396,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -420,6 +420,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -536,6 +536,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -170,6 +170,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -505,6 +505,7 @@ void up_irqinitialize(void)
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* And finally, enable global interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -429,6 +429,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -365,6 +365,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -223,6 +223,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -464,6 +464,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -337,6 +337,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -486,6 +486,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -352,6 +352,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -337,6 +337,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -337,6 +337,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -355,6 +355,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -350,6 +350,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -74,6 +74,7 @@ void up_irqinitialize(void)
/* Enable global ARM interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_restore(PSR_MODE_SYS | PSR_F_BIT);
#endif
}

View file

@ -480,6 +480,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -49,6 +49,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm_color_intstack();
up_irq_enable();
}

View file

@ -157,6 +157,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts globally */
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -401,6 +401,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
arm_color_intstack();
up_irq_enable();
#endif
}

View file

@ -44,6 +44,37 @@
#include "arm64_gic.h"
#include "arm64_fatal.h"
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: arm64_color_intstack
*
* Description:
* Set the interrupt stack to a value so that later we can determine how
* much stack space was used by interrupt handling logic
*
****************************************************************************/
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
static inline void arm64_color_intstack(void)
{
#ifdef CONFIG_SMP
int cpu;
for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++)
{
arm64_stack_color((void *)up_get_intstackbase(cpu), INTSTACK_SIZE);
}
#else
arm64_stack_color((void *)g_interrupt_stack, INTSTACK_SIZE);
#endif
}
#else
# define arm64_color_intstack()
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@ -149,6 +180,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
arm64_color_intstack();
up_irq_enable();
#endif
}

View file

@ -99,33 +99,6 @@ uintptr_t up_get_intstackbase(int cpu)
}
#endif
/****************************************************************************
* Name: up_color_intstack
*
* Description:
* Set the interrupt stack to a value so that later we can determine how
* much stack space was used by interrupt handling logic
*
****************************************************************************/
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
static void up_color_intstack(void)
{
#ifdef CONFIG_SMP
int cpu;
for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++)
{
arm64_stack_color((void *)up_get_intstackbase(cpu), INTSTACK_SIZE);
}
#else
arm64_stack_color((void *)g_interrupt_stack, INTSTACK_SIZE);
#endif
}
#else
# define up_color_intstack()
#endif
/****************************************************************************
* Name: arm64_panic_disable_fpu
*
@ -162,10 +135,6 @@ int arm64_panic_disable_fpu(struct notifier_block *block,
void up_initialize(void)
{
/* Initialize global variables */
up_color_intstack();
/* Add any extra memory fragments to the memory manager */
arm64_addregion();

View file

@ -221,6 +221,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
#ifndef CONFIG_SUPPRESS_INTERRUPTS
avr_color_intstack();
up_irq_restore(0);
#endif
}

View file

@ -51,6 +51,30 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: avr_color_intstack
*
* Description:
* Set the interrupt stack to a value so that later we can determine how
* much stack space was used by interrupt handling logic
*
****************************************************************************/
#if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
void avr_color_intstack(void)
{
uint8_t *ptr = g_intstackalloc;
ssize_t size;
for (size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
size > 0;
size -= sizeof(uint8_t))
{
*ptr++ = STACK_COLOR;
}
}
#endif
/****************************************************************************
* Name: avr_stack_check
*

View file

@ -86,36 +86,6 @@ volatile uint32_t *g_current_regs;
volatile uint8_t *g_current_regs;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_color_intstack
*
* Description:
* Set the interrupt stack to a value so that later we can determine how
* much stack space was used by interrupt handling logic
*
****************************************************************************/
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
static inline void up_color_intstack(void)
{
uint8_t *ptr = g_intstackalloc;
ssize_t size;
for (size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
size > 0;
size -= sizeof(uint8_t))
{
*ptr++ = INTSTACK_COLOR;
}
}
#else
# define up_color_intstack()
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@ -139,10 +109,6 @@ static inline void up_color_intstack(void)
void up_initialize(void)
{
/* Colorize the interrupt stack */
up_color_intstack();
/* Add any extra memory fragments to the memory manager */
avr_addregion();

View file

@ -176,5 +176,12 @@ void avr_usbuninitialize(void);
size_t avr_stack_check(uintptr_t alloc, size_t size);
#endif
#if defined(CONFIG_STACK_COLORATION) && \
defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
void avr_color_intstack(void);
#else
# define avr_color_intstack()
#endif
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_AVR_SRC_COMMON_UP_INTERNAL_H */

View file

@ -44,6 +44,30 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: ceva_color_intstack
*
* Description:
* Set the interrupt stack to a value so that later we can determine how
* much stack space was used by interrupt handling logic
*
****************************************************************************/
#if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
void ceva_color_intstack(void)
{
uint32_t *ptr = (uint32_t *)g_intstackalloc;
ssize_t size;
for (size = g_intstackbase - g_intstackalloc;
size > 0;
size -= sizeof(uint32_t))
{
*ptr++ = STACK_COLOR;
}
}
#endif
/****************************************************************************
* Name: ceva_stack_check
*

View file

@ -28,32 +28,6 @@
#include "ceva_internal.h"
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_color_intstack
*
* Description:
* Set the interrupt stack to a value so that later we can determine how
* much stack space was used by interrupt handling logic
*
****************************************************************************/
static inline void up_color_intstack(void)
{
uint32_t *ptr = (uint32_t *)g_intstackalloc;
ssize_t size;
for (size = g_intstackbase - g_intstackalloc;
size > 0;
size -= sizeof(uint32_t))
{
*ptr++ = INTSTACK_COLOR;
}
}
/****************************************************************************
* Public Functions
****************************************************************************/
@ -77,10 +51,6 @@ static inline void up_color_intstack(void)
void up_initialize(void)
{
/* Colorize the interrupt stack */
up_color_intstack();
/* Add any extra memory fragments to the memory manager */
ceva_addregion();

View file

@ -307,6 +307,13 @@ size_t ceva_stack_check(uintptr_t alloc, size_t size);
void ceva_stack_color(void *stackbase, size_t nbytes);
#endif
#if defined(CONFIG_STACK_COLORATION) && \
defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
void ceva_color_intstack(void);
#else
# define ceva_color_intstack()
#endif
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -199,5 +199,6 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
ceva_color_intstack();
up_irq_enable();
}

View file

@ -215,5 +215,6 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
ceva_color_intstack();
up_irq_enable();
}

View file

@ -52,6 +52,30 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: or1k_color_intstack
*
* Description:
* Set the interrupt stack to a value so that later we can determine how
* much stack space was used by interrupt handling logic
*
****************************************************************************/
#if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
void or1k_color_intstack(void)
{
uint32_t *ptr = (uint32_t *)g_intstackalloc;
ssize_t size;
for (size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
size > 0;
size -= sizeof(uint32_t))
{
*ptr++ = STACK_COLOR;
}
}
#endif
/****************************************************************************
* Name: or1k_stack_check
*

View file

@ -106,32 +106,6 @@ void up_enable_dcache(void)
}
#endif
/****************************************************************************
* Name: up_color_intstack
*
* Description:
* Set the interrupt stack to a value so that later we can determine how
* much stack space was used by interrupt handling logic
*
****************************************************************************/
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
static inline void up_color_intstack(void)
{
uint32_t *ptr = (uint32_t *)g_intstackalloc;
ssize_t size;
for (size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
size > 0;
size -= sizeof(uint32_t))
{
*ptr++ = INTSTACK_COLOR;
}
}
#else
# define up_color_intstack()
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@ -155,10 +129,6 @@ static inline void up_color_intstack(void)
void up_initialize(void)
{
/* Colorize the interrupt stack */
up_color_intstack();
/* Add any extra memory fragments to the memory manager */
or1k_addregion();

View file

@ -325,6 +325,13 @@ size_t or1k_stack_check(uintptr_t alloc, size_t size);
void or1k_stack_color(void *stackbase, size_t nbytes);
#endif
#if defined(CONFIG_STACK_COLORATION) && \
defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
void or1k_color_intstack(void);
#else
# define or1k_color_intstack()
#endif
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -53,6 +53,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
or1k_color_intstack();
up_irq_enable();
}

View file

@ -92,6 +92,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -187,6 +187,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -93,6 +93,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -374,6 +374,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -48,6 +48,30 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: riscv_color_intstack
*
* Description:
* Set the interrupt stack to a value so that later we can determine how
* much stack space was used by interrupt handling logic
*
****************************************************************************/
#if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 15
void riscv_color_intstack(void)
{
uint32_t *ptr = (uint32_t *)g_intstackalloc;
ssize_t size;
for (size = (CONFIG_ARCH_INTERRUPTSTACK & ~15);
size > 0;
size -= sizeof(uint32_t))
{
*ptr++ = STACK_COLOR;
}
}
#endif
/****************************************************************************
* Name: riscv_stack_check
*

View file

@ -38,36 +38,6 @@
volatile bool g_interrupt_context[CONFIG_SMP_NCPUS];
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_color_intstack
*
* Description:
* Set the interrupt stack to a value so that later we can determine how
* much stack space was used by interrupt handling logic
*
****************************************************************************/
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 15
static inline void up_color_intstack(void)
{
uint32_t *ptr = (uint32_t *)g_intstackalloc;
ssize_t size;
for (size = (CONFIG_ARCH_INTERRUPTSTACK & ~15);
size > 0;
size -= sizeof(uint32_t))
{
*ptr++ = INTSTACK_COLOR;
}
}
#else
# define up_color_intstack()
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@ -91,10 +61,6 @@ static inline void up_color_intstack(void)
void up_initialize(void)
{
/* Colorize the interrupt stack */
up_color_intstack();
/* Add any extra memory fragments to the memory manager */
riscv_addregion();

View file

@ -364,6 +364,13 @@ size_t riscv_stack_check(uintptr_t alloc, size_t size);
void riscv_stack_color(void *stackbase, size_t nbytes);
#endif
#if defined(CONFIG_STACK_COLORATION) && \
defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 15
void riscv_color_intstack(void);
#else
# define riscv_color_intstack()
#endif
#ifdef CONFIG_SMP
void riscv_cpu_boot(int cpu);
int riscv_smp_call_handler(int irq, void *c, void *arg);

View file

@ -245,6 +245,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -86,6 +86,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -90,6 +90,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -90,6 +90,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -93,6 +93,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -99,6 +99,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -105,6 +105,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -93,6 +93,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -88,6 +88,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -154,6 +154,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -118,6 +118,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -100,6 +100,7 @@ void up_irqinitialize(void)
/* And finally, enable interrupts */
riscv_color_intstack();
up_irq_enable();
#endif
}

View file

@ -93,6 +93,7 @@ void up_irqinitialize(void)
* register
*/
sparc_color_intstack();
up_irq_enable();
}

View file

@ -98,6 +98,7 @@ void up_irqinitialize(void)
* register
*/
sparc_color_intstack();
up_irq_enable();
}

View file

@ -49,6 +49,27 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: sparc_color_intstack
*
* Description:
* Set the interrupt stack to a value so that later we can determine how
* much stack space was used by interrupt handling logic
*
****************************************************************************/
#if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 7
void sparc_color_intstack(void)
{
int cpu;
for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++)
{
sparc_stack_color((void *)up_get_intstackbase(cpu), INTSTACK_SIZE);
}
}
#endif
/****************************************************************************
* Name: sparc_stack_check
*

Some files were not shown because too many files have changed in this diff Show more