From 2fd25d7ea7733276efcfcbca00be93c7c6ed226e Mon Sep 17 00:00:00 2001 From: Jiuzhu Dong Date: Fri, 11 Jun 2021 11:47:37 +0800 Subject: [PATCH] arch/armv7-a: Colorize the idle thread stack for other cpu(SMP) Keep previous modification. Signed-off-by: Jiuzhu Dong --- arch/arm/src/armv7-a/arm_cpuhead.S | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/arm/src/armv7-a/arm_cpuhead.S b/arch/arm/src/armv7-a/arm_cpuhead.S index 7d9db6b7aa..9c480c307a 100644 --- a/arch/arm/src/armv7-a/arm_cpuhead.S +++ b/arch/arm/src/armv7-a/arm_cpuhead.S @@ -396,6 +396,22 @@ __cpu3_start: .Lcpu_vstart: +#ifdef CONFIG_STACK_COLORATION + /* Write a known value to the IDLE thread stack to support stack + * monitoring logic + */ + + adr r3, .Lstkinit + mov r0, sp /* R0 = end of IDLE stack */ + ldmia r3, {r1, r2} /* R1 = Size of stack; R2 = coloration */ + +1: /* Top of the loop */ + sub r1, r1, #1 /* R1 = Number of words remaining */ + cmp r1, #0 /* Check (nwords == 0) */ + str r2, [r0, #-4]! /* Save stack color word, increment stack address */ + bne 1b /* Bottom of the loop */ +#endif + /* Branch to continue C level CPU initialization */ mov fp, #0 /* Clear framepointer */ @@ -410,6 +426,14 @@ __cpu3_start: /* Text-section constants: */ +#ifdef CONFIG_STACK_COLORATION + .type .Lstkinit, %object +.Lstkinit: + .long SMP_STACK_WORDS + .long STACK_COLOR /* Stack coloration word */ + .size .Lstkinit, . -.Lstkinit +#endif + /*************************************************************************** * .noinit section data ***************************************************************************/