diff --git a/arch/arm/src/arm/arm_head.S b/arch/arm/src/arm/arm_head.S index 0cfa6d507b..6c33467700 100644 --- a/arch/arm/src/arm/arm_head.S +++ b/arch/arm/src/arm/arm_head.S @@ -603,22 +603,6 @@ __start: bl arm_boot -#ifdef CONFIG_STACK_COLORATION - /* Write a known value to the IDLE thread stack to support stack - * monitoring logic - */ - - adr r3, .Lstkinit - ldmia r3, {r0, r1, r2} /* R0 = start of IDLE stack; R1 = Size of tack; R2 = coloration */ - -2: /* 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 2b /* Bottom of the loop */ - -#endif - /* Finally branch to the OS entry point */ mov lr, #0 /* LR = return address (none) */ @@ -674,15 +658,6 @@ __start: .long _sdata /* Where .data needs to reside in SDRAM */ .long _edata #endif - -#ifdef CONFIG_STACK_COLORATION - .type .Lstkinit, %object -.Lstkinit: - .long _ebss /* Beginning of the IDLE stack, then words of IDLE stack */ - .long (CONFIG_IDLETHREAD_STACKSIZE >> 2) - .long STACK_COLOR /* Stack coloration word */ - .size .Lstkinit, . -.Lstkinit -#endif .size .Lvstart, .-.Lvstart /*************************************************************************** diff --git a/arch/arm/src/arm/arm_nommuhead.S b/arch/arm/src/arm/arm_nommuhead.S index 27c53b9ffe..6ddc3c6955 100644 --- a/arch/arm/src/arm/arm_nommuhead.S +++ b/arch/arm/src/arm/arm_nommuhead.S @@ -112,22 +112,6 @@ __start: bl board_autoled_initialize #endif -#ifdef CONFIG_STACK_COLORATION - /* Write a known value to the IDLE thread stack to support stack - * monitoring logic - */ - - adr r3, .Lstkinit - ldmia r3, {r0, r1, r2} /* R0 = start of IDLE stack; R1 = Size of tack; R2 = coloration */ - -2: /* 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 2b /* Bottom of the loop */ - -#endif - /* Finally branch to the OS entry point */ mov lr, #0 /* LR = return address (none) */ @@ -154,14 +138,6 @@ __start: .long _edata #endif -#ifdef CONFIG_STACK_COLORATION - .type .Lstkinit, %object -.Lstkinit: - .long _ebss /* Beginning of the IDLE stack, then words of IDLE stack */ - .long (CONFIG_IDLETHREAD_STACKSIZE >> 2) - .long STACK_COLOR /* Stack coloration word */ - .size .Lstkinit, . -.Lstkinit -#endif .size __start, .-__start /* This global variable is unsigned long g_idle_topstack and is diff --git a/arch/arm/src/armv7-a/arm_cpuhead.S b/arch/arm/src/armv7-a/arm_cpuhead.S index 9c480c307a..7d9db6b7aa 100644 --- a/arch/arm/src/armv7-a/arm_cpuhead.S +++ b/arch/arm/src/armv7-a/arm_cpuhead.S @@ -396,22 +396,6 @@ __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 */ @@ -426,14 +410,6 @@ __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 ***************************************************************************/ diff --git a/arch/arm/src/armv7-a/arm_head.S b/arch/arm/src/armv7-a/arm_head.S index 30f910b5cb..25362634e6 100644 --- a/arch/arm/src/armv7-a/arm_head.S +++ b/arch/arm/src/armv7-a/arm_head.S @@ -632,21 +632,6 @@ __start: bl arm_boot -#ifdef CONFIG_STACK_COLORATION - /* Write a known value to the IDLE thread stack to support stack - * monitoring logic - */ - - adr r3, .Lstkinit - ldmia r3, {r0, r1, r2} /* R0 = start of IDLE stack; R1 = Size of tack; 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 - /* Finally branch to the OS entry point */ mov lr, #0 /* LR = return address (none) */ @@ -753,21 +738,6 @@ arm_data_initialize: .size .Ldatainit, . -.Ldatainit #endif -#ifdef CONFIG_STACK_COLORATION - .type .Lstkinit, %object -.Lstkinit: -#ifdef CONFIG_BOOT_SDRAM_DATA - .long IDLE_STACK_VBASE /* Beginning of the IDLE stack, then words of IDLE stack */ -#elif defined(CONFIG_SMP) - .long _enoinit -#else - .long _ebss /* Beginning of the IDLE stack, then words of IDLE stack */ -#endif - .long (CONFIG_IDLETHREAD_STACKSIZE >> 2) - .long STACK_COLOR /* Stack coloration word */ - .size .Lstkinit, . -.Lstkinit -#endif - /*************************************************************************** * Data section variables ***************************************************************************/ diff --git a/arch/arm/src/armv7-a/arm_pghead.S b/arch/arm/src/armv7-a/arm_pghead.S index 2d74403252..09089285cd 100644 --- a/arch/arm/src/armv7-a/arm_pghead.S +++ b/arch/arm/src/armv7-a/arm_pghead.S @@ -668,21 +668,6 @@ __start: bl arm_boot -#ifdef CONFIG_STACK_COLORATION - /* Write a known value to the IDLE thread stack to support stack - * monitoring logic - */ - - adr r3, .Lstkinit - ldmia r3, {r0, r1, r2} /* R0 = start of IDLE stack; R1 = Size of tack; 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 - /* Finally branch to the OS entry point */ mov lr, #0 /* LR = return address (none) */ @@ -792,19 +777,6 @@ arm_data_initialize: .long _edata .size .Ldatainit, . -.Ldatainit -#ifdef CONFIG_STACK_COLORATION - .type .Lstkinit, %object -.Lstkinit: -#ifdef CONFIG_BOOT_SDRAM_DATA - .long IDLE_STACK_VBASE /* Beginning of the IDLE stack, then words of IDLE stack */ -#else - .long _ebss /* Beginning of the IDLE stack, then words of IDLE stack */ -#endif - .long (CONFIG_IDLETHREAD_STACKSIZE >> 2) - .long STACK_COLOR /* Stack coloration word */ - .size .Lstkinit, . -.Lstkinit -#endif - /*************************************************************************** * Data section variables ***************************************************************************/ diff --git a/arch/arm/src/cxd56xx/cxd56_start.c b/arch/arm/src/cxd56xx/cxd56_start.c index d85f484860..b66f2dafe6 100644 --- a/arch/arm/src/cxd56xx/cxd56_start.c +++ b/arch/arm/src/cxd56xx/cxd56_start.c @@ -75,15 +75,6 @@ void weak_function up_cpuctxload(void); -/**************************************************************************** - * Private Function prototypes - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__((naked, no_instrument_function, noreturn)); -#endif - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -116,46 +107,6 @@ extern uint32_t _vectors[]; * Private Functions ****************************************************************************/ -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -354,17 +305,9 @@ void __start(void) showprogress('\r'); showprogress('\n'); -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); -#else - /* Call nx_start() */ - nx_start(); /* Shouldn't get here */ for (; ; ); -#endif } diff --git a/arch/arm/src/efm32/efm32_start.c b/arch/arm/src/efm32/efm32_start.c index 090df585ca..f65fbd7f02 100644 --- a/arch/arm/src/efm32/efm32_start.c +++ b/arch/arm/src/efm32/efm32_start.c @@ -79,10 +79,6 @@ const uintptr_t g_idle_topstack = HEAP_BASE; #ifdef CONFIG_ARCH_FPU static inline void efm32_fpuconfig(void); #endif -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__ ((naked, no_instrument_function, noreturn)); -#endif /**************************************************************************** * Private Functions @@ -198,47 +194,6 @@ static inline void efm32_fpuconfig(void) # define efm32_fpuconfig() #endif -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the coloration value and jump into nx_start() - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -319,17 +274,9 @@ void __start(void) showprogress('\r'); showprogress('\n'); -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); -#else - /* Call nx_start() */ - nx_start(); /* Shouldn't get here */ for (; ; ); -#endif } diff --git a/arch/arm/src/eoss3/eoss3_start.c b/arch/arm/src/eoss3/eoss3_start.c index a3e36b68a4..57a3a83aac 100644 --- a/arch/arm/src/eoss3/eoss3_start.c +++ b/arch/arm/src/eoss3/eoss3_start.c @@ -72,10 +72,6 @@ const uintptr_t g_idle_topstack = HEAP_BASE; #ifdef CONFIG_ARCH_FPU static inline void eoss3_fpuconfig(void); #endif -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__ ((naked, no_instrument_function, noreturn)); -#endif /**************************************************************************** * Private Functions @@ -196,47 +192,6 @@ static inline void eoss3_fpuconfig(void) # define eoss3_fpuconfig() #endif -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the coloration value and jump into nx_start() - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -332,17 +287,9 @@ void __start(void) showprogress('\r'); showprogress('\n'); -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); -#else - /* Call nx_start() */ - nx_start(); /* Shouldn't get here */ for (; ; ); -#endif } diff --git a/arch/arm/src/imxrt/imxrt_start.c b/arch/arm/src/imxrt/imxrt_start.c index 205d46e74c..681910d776 100644 --- a/arch/arm/src/imxrt/imxrt_start.c +++ b/arch/arm/src/imxrt/imxrt_start.c @@ -73,10 +73,6 @@ #ifdef CONFIG_ARCH_FPU static inline void imxrt_fpuconfig(void); #endif -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__ ((naked, no_instrument_function, noreturn)); -#endif /**************************************************************************** * Private Functions @@ -226,47 +222,6 @@ static inline void imxrt_tcmenable(void) #endif } -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the coloration value and jump into nx_start() - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -375,17 +330,9 @@ void __start(void) /* Then start NuttX */ -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); -#else - /* Call nx_start() */ - nx_start(); /* Shouldn't get here */ for (; ; ); -#endif } diff --git a/arch/arm/src/kinetis/kinetis_start.c b/arch/arm/src/kinetis/kinetis_start.c index 23c0c24de8..13ea9f1753 100644 --- a/arch/arm/src/kinetis/kinetis_start.c +++ b/arch/arm/src/kinetis/kinetis_start.c @@ -50,13 +50,6 @@ static inline void kinetis_fpuconfig(void); #endif -#if 0 /* Not used */ -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__ ((naked, no_instrument_function, noreturn)); -#endif -#endif - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -195,49 +188,6 @@ static inline void kinetis_fpuconfig(void) # define kinetis_fpuconfig() #endif -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the coloration value and jump into nx_start() - * - ****************************************************************************/ - -#if 0 /* Not used */ -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/arm/src/lc823450/lc823450_start.c b/arch/arm/src/lc823450/lc823450_start.c index 6bfe2fa1b9..952f48a550 100644 --- a/arch/arm/src/lc823450/lc823450_start.c +++ b/arch/arm/src/lc823450/lc823450_start.c @@ -105,15 +105,6 @@ extern uint32_t _etext_sram; extern uint32_t _ftext; extern uint32_t _svect; -/**************************************************************************** - * Private Function prototypes - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__ ((naked, no_instrument_function, noreturn)); -#endif - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -132,47 +123,6 @@ static void go_nx_start(void *pv, unsigned int nbytes) # define showprogress(c) #endif -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the coloration value and jump into nx_start() - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmov r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -385,17 +335,9 @@ void __start(void) CURRENT_REGS = NULL; -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); -#else - /* Call nx_start() */ - nx_start(); /* Shouldn't get here */ for (; ; ); -#endif } diff --git a/arch/arm/src/nrf52/nrf52_start.c b/arch/arm/src/nrf52/nrf52_start.c index 11bd545fac..58edc37aef 100644 --- a/arch/arm/src/nrf52/nrf52_start.c +++ b/arch/arm/src/nrf52/nrf52_start.c @@ -72,11 +72,6 @@ void __start(void) __attribute__ ((no_instrument_function)); #endif -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__ ((naked, no_instrument_function, noreturn)); -#endif - /**************************************************************************** * Name: nrf52_fpuconfig * @@ -164,47 +159,6 @@ static inline void nrf52_fpuconfig(void) # define nrf52_fpuconfig() #endif -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the coloration value and jump into nx_start() - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -311,15 +265,9 @@ void __start(void) showprogress('\r'); showprogress('\n'); -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); -#else nx_start(); /* Shouldn't get here */ for (; ; ); -#endif } diff --git a/arch/arm/src/rp2040/rp2040_start.c b/arch/arm/src/rp2040/rp2040_start.c index 8952e68040..48fe9b0733 100644 --- a/arch/arm/src/rp2040/rp2040_start.c +++ b/arch/arm/src/rp2040/rp2040_start.c @@ -51,14 +51,6 @@ const uintptr_t g_idle_topstack = IDLE_STACK; -/**************************************************************************** - * Private Function prototypes - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static inline void go_nx_start(void *pv, unsigned int nbytes); -#endif - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -77,51 +69,6 @@ static inline void go_nx_start(void *pv, unsigned int nbytes); # define showprogress(c) #endif -/**************************************************************************** - * Name: go_nx_start - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static inline void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - * NOTE: this function must be inlined so that SRAM boot can work. - */ - - __asm__ __volatile__ - ( - "\t.global nx_start\n" - "\tlsr %1, %1, #2\n" /* %1 = nwords = nbytes >> 2 */ - "\tcmp %1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tmov r2, #3\n" - "\tadd %0, %0, #3\n" - "\tbic %0, r2\n" /* %0 = Aligned stackptr */ - "\tldr r2, =0xdeadbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - - "1:\n" /* Top of the loop */ - "\tstr r2, [%0, #0]\n" /* Save stack color word */ - "\tadd %0, %0, #4\n" /* Increment stackptr */ - "\tsub %1, %1, #1\n" /* %1 nwords-- */ - "\tcmp %1, #0\n" /* Check (nwords == 0) */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r2, #0\n" - "\tmov r14, r2\n" /* LR = return address (none) */ - "\tbl nx_start\n" /* Branch to nx_start */ - : - : "r" (pv), "r" (nbytes) - : "r2" - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -223,13 +170,7 @@ void __start(void) showprogress('\r'); showprogress('\n'); -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); -#else nx_start(); -#endif /* Shouldn't get here */ diff --git a/arch/arm/src/sam34/sam_start.c b/arch/arm/src/sam34/sam_start.c index 2cbca1c159..c251498f01 100644 --- a/arch/arm/src/sam34/sam_start.c +++ b/arch/arm/src/sam34/sam_start.c @@ -75,10 +75,6 @@ const uintptr_t g_idle_topstack = HEAP_BASE; #ifdef CONFIG_ARCH_FPU static inline void sam_fpuconfig(void); #endif -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__ ((naked, no_instrument_function, noreturn)); -#endif #ifdef CONFIG_ARMV7M_STACKCHECK /* We need to get r10 set before we can allow instrumentation calls */ @@ -194,47 +190,6 @@ static inline void sam_fpuconfig(void) # define sam_fpuconfig() #endif -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the coloration value and jump into nx_start() - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -346,18 +301,9 @@ void __start(void) showprogress('\r'); showprogress('\n'); -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); - -#else - /* Call nx_start() */ - nx_start(); /* Shouldn't get here */ for (; ; ); -#endif } diff --git a/arch/arm/src/samd5e5/sam_start.c b/arch/arm/src/samd5e5/sam_start.c index fbabe0c0c9..5dc64767db 100644 --- a/arch/arm/src/samd5e5/sam_start.c +++ b/arch/arm/src/samd5e5/sam_start.c @@ -77,10 +77,6 @@ const uintptr_t g_idle_topstack = HEAP_BASE; #ifdef CONFIG_ARCH_FPU static inline void sam_fpu_configure(void); #endif -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__ ((naked, no_instrument_function, noreturn)); -#endif #ifdef CONFIG_ARMV7M_STACKCHECK /* We need to get r10 set before we can allow instrumentation calls */ @@ -196,47 +192,6 @@ static inline void sam_fpu_configure(void) # define sam_fpu_configure() #endif -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the coloration value and jump into nx_start() - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -342,18 +297,9 @@ void __start(void) showprogress('\r'); showprogress('\n'); -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); - -#else - /* Call nx_start() */ - nx_start(); /* Shouldn't get here */ for (; ; ); -#endif } diff --git a/arch/arm/src/samv7/sam_start.c b/arch/arm/src/samv7/sam_start.c index baa596b697..f20eb01f7f 100644 --- a/arch/arm/src/samv7/sam_start.c +++ b/arch/arm/src/samv7/sam_start.c @@ -86,10 +86,6 @@ const uintptr_t g_idle_topstack = HEAP_BASE; #ifdef CONFIG_ARCH_FPU static inline void sam_fpuconfig(void); #endif -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__ ((naked, no_instrument_function, noreturn)); -#endif /**************************************************************************** * Private Functions @@ -240,47 +236,6 @@ static inline void sam_tcmenable(void) #endif } -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the coloration value and jump into nx_start() - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -386,17 +341,9 @@ void __start(void) /* Then start NuttX */ -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); -#else - /* Call nx_start() */ - nx_start(); /* Shouldn't get here */ for (; ; ); -#endif } diff --git a/arch/arm/src/stm32/stm32_start.c b/arch/arm/src/stm32/stm32_start.c index 1618eea7ac..38c0330aa5 100644 --- a/arch/arm/src/stm32/stm32_start.c +++ b/arch/arm/src/stm32/stm32_start.c @@ -74,10 +74,6 @@ const uintptr_t g_idle_topstack = HEAP_BASE; #ifdef CONFIG_ARCH_FPU static inline void stm32_fpuconfig(void); #endif -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__ ((naked, no_instrument_function, noreturn)); -#endif /**************************************************************************** * Private Functions @@ -197,47 +193,6 @@ static inline void stm32_fpuconfig(void) # define stm32_fpuconfig() #endif -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the coloration value and jump into nx_start() - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -328,17 +283,9 @@ void __start(void) showprogress('\r'); showprogress('\n'); -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); -#else - /* Call nx_start() */ - nx_start(); /* Shouldn't get here */ for (; ; ); -#endif } diff --git a/arch/arm/src/stm32f7/stm32_start.c b/arch/arm/src/stm32f7/stm32_start.c index 280771f048..f5753f1b84 100644 --- a/arch/arm/src/stm32f7/stm32_start.c +++ b/arch/arm/src/stm32f7/stm32_start.c @@ -86,10 +86,6 @@ const uintptr_t g_idle_topstack = HEAP_BASE; #ifdef CONFIG_ARCH_FPU static inline void stm32_fpuconfig(void); #endif -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__ ((naked, no_instrument_function, noreturn)); -#endif /**************************************************************************** * Private Functions @@ -241,47 +237,6 @@ static inline void stm32_tcmenable(void) #endif } -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the coloration value and jump into nx_start() - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -383,17 +338,9 @@ void __start(void) /* Then start NuttX */ -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); -#else - /* Call nx_start() */ - nx_start(); /* Shouldn't get here */ for (; ; ); -#endif } diff --git a/arch/arm/src/stm32h7/stm32_start.c b/arch/arm/src/stm32h7/stm32_start.c index b42cb3f5ca..9da6a4dfa0 100644 --- a/arch/arm/src/stm32h7/stm32_start.c +++ b/arch/arm/src/stm32h7/stm32_start.c @@ -87,10 +87,6 @@ const uintptr_t g_idle_topstack = HEAP_BASE; #ifdef CONFIG_ARCH_FPU static inline void stm32_fpuconfig(void); #endif -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__ ((naked, no_instrument_function, noreturn)); -#endif /**************************************************************************** * Name: showprogress @@ -256,47 +252,6 @@ static inline void stm32_tcmenable(void) #endif } -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the coloration value and jump into nx_start() - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -400,17 +355,9 @@ void __start(void) showprogress('\r'); showprogress('\n'); -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); -#else - /* Call nx_start() */ - nx_start(); /* Shouldn't get here */ for (; ; ); -#endif } diff --git a/arch/arm/src/stm32l4/stm32l4_start.c b/arch/arm/src/stm32l4/stm32l4_start.c index bbd38b6ee1..eacb5bd4c5 100644 --- a/arch/arm/src/stm32l4/stm32l4_start.c +++ b/arch/arm/src/stm32l4/stm32l4_start.c @@ -83,10 +83,6 @@ const uintptr_t g_idle_topstack = HEAP_BASE; #ifdef CONFIG_ARCH_FPU static inline void stm32l4_fpuconfig(void); #endif -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__ ((naked, no_instrument_function, noreturn)); -#endif /**************************************************************************** * Private Functions @@ -206,47 +202,6 @@ static inline void stm32l4_fpuconfig(void) # define stm32l4_fpuconfig() #endif -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the coloration value and jump into nx_start() - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -349,17 +304,9 @@ void __start(void) showprogress('\r'); showprogress('\n'); -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); -#else - /* Call nx_start() */ - nx_start(); /* Shouldn't get here */ for (; ; ); -#endif } diff --git a/arch/arm/src/stm32l5/stm32l5_start.c b/arch/arm/src/stm32l5/stm32l5_start.c index 715e8bea4f..689fb2bc51 100644 --- a/arch/arm/src/stm32l5/stm32l5_start.c +++ b/arch/arm/src/stm32l5/stm32l5_start.c @@ -85,10 +85,6 @@ const uintptr_t g_idle_topstack = HEAP_BASE; #ifdef CONFIG_ARCH_FPU static inline void stm32l5_fpuconfig(void); #endif -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__ ((naked, no_instrument_function, noreturn)); -#endif /**************************************************************************** * Private Functions @@ -209,47 +205,6 @@ static inline void stm32l5_fpuconfig(void) # define stm32l5_fpuconfig() #endif -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the coloration value and jump into nx_start() - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -352,17 +307,9 @@ void __start(void) showprogress('\r'); showprogress('\n'); -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); -#else - /* Call nx_start() */ - nx_start(); /* Shoulnd't get here */ for (; ; ); -#endif } diff --git a/arch/arm/src/tms570/tms570_boot.c b/arch/arm/src/tms570/tms570_boot.c index f83f680353..3b1f1ec972 100644 --- a/arch/arm/src/tms570/tms570_boot.c +++ b/arch/arm/src/tms570/tms570_boot.c @@ -203,69 +203,6 @@ static void tms570_memory_initialize(uint32_t ramset) putreg32(SYS_MINITGCR_DISABLE, TMS570_SYS_MINITGCR); } -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Re-initialize the stack and frame pointers and branch to OS start. - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - naked_function noreturn_function; - -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tldr ip, =g_idle_topstack\n" /* IP=address of g_idle_topstack */ - "\tldr sp, [ip]\n" /* Reset the stack pointer */ - "\tmov fp, #0\n" /* Reset the frame pointer */ - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} - -#else -static void go_nx_start(void) naked_function noreturn_function; - -static void go_nx_start(void) -{ - /* Reset the stack/frame pointer and jump to nx_start(). */ - - __asm__ __volatile__ - ( - "\tldr ip, =g_idle_topstack\n" /* IP=address of g_idle_topstack */ - "\tldr sp, [ip]\n" /* Reset the stack pointer */ - "\tmov fp, #0\n" /* Reset the frame pointer */ - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -478,13 +415,5 @@ void arm_boot(void) /* Then start NuttX */ -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); -#else - /* Branch to nx_start(), resetting the stack and frame pointers. */ - - go_nx_start(); -#endif + nx_start(); } diff --git a/arch/arm/src/xmc4/xmc4_start.c b/arch/arm/src/xmc4/xmc4_start.c index 2de7700c13..5b400704a8 100644 --- a/arch/arm/src/xmc4/xmc4_start.c +++ b/arch/arm/src/xmc4/xmc4_start.c @@ -50,10 +50,6 @@ static inline void xmc4_fpu_config(void); #endif static inline void xmc4_unaligned(void); static inline void xmc4_flash_waitstates(void); -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) - __attribute__ ((naked, no_instrument_function, noreturn)); -#endif /**************************************************************************** * Pre-processor Definitions @@ -250,47 +246,6 @@ static inline void xmc4_flash_waitstates(void) putreg32(regval, XMC4_FLASH_FCON); } -/**************************************************************************** - * Name: go_nx_start - * - * Description: - * Set the IDLE stack to the coloration value and jump into nx_start() - * - ****************************************************************************/ - -#ifdef CONFIG_STACK_COLORATION -static void go_nx_start(void *pv, unsigned int nbytes) -{ - /* Set the IDLE stack to the stack coloration value then jump to - * nx_start(). We take extreme care here because were currently - * executing on this stack. - * - * We want to avoid sneak stack access generated by the compiler. - */ - - __asm__ __volatile__ - ( - "\tmovs r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tbeq 2f\n" /* (should not happen) */ - - "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ - "\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */ - "\tmovt r2, #0xdead\n" - - "1:\n" /* Top of the loop */ - "\tsub r1, r1, #1\n" /* R1 nwords-- */ - "\tcmp r1, #0\n" /* Check (nwords == 0) */ - "\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */ - "\tbne 1b\n" /* Bottom of the loop */ - - "2:\n" - "\tmov r14, #0\n" /* LR = return address (none) */ - "\tb nx_start\n" /* Branch to nx_start */ - ); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -405,17 +360,9 @@ void __start(void) /* Then start NuttX */ -#ifdef CONFIG_STACK_COLORATION - /* Set the IDLE stack to the coloration value and jump into nx_start() */ - - go_nx_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE); -#else - /* Call nx_start() */ - nx_start(); /* Shouldn't get here */ for (; ; ); -#endif } diff --git a/arch/misoc/src/lm32/lm32.h b/arch/misoc/src/lm32/lm32.h index 3442cd5f09..7715d30f42 100644 --- a/arch/misoc/src/lm32/lm32.h +++ b/arch/misoc/src/lm32/lm32.h @@ -37,14 +37,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* This is the value used to mark the stack for subsequent stack monitoring - * logic. - */ - -#define STACK_COLOR 0xdeadbeef -#define INTSTACK_COLOR 0xdeadbeef -#define HEAP_COLOR 'h' - /* In the LM32 model, the state is copied from the stack to the TCB, but * only a referenced is passed to get the state from the TCB. */ diff --git a/arch/misoc/src/minerva/minerva.h b/arch/misoc/src/minerva/minerva.h index 25aae003f2..6754ad1c01 100644 --- a/arch/misoc/src/minerva/minerva.h +++ b/arch/misoc/src/minerva/minerva.h @@ -37,14 +37,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* This is the value used to mark the stack for subsequent stack monitoring - * logic. - */ - -#define STACK_COLOR 0xdeadbeef -#define INTSTACK_COLOR 0xdeadbeef -#define HEAP_COLOR 'h' - /* In the MINERVA model, the state is copied from the stack to the TCB, but * only a referenced is passed to get the state from the TCB. */ diff --git a/arch/risc-v/src/bl602/bl602_entry.S b/arch/risc-v/src/bl602/bl602_entry.S index a7e94cbfc4..283103648b 100644 --- a/arch/risc-v/src/bl602/bl602_entry.S +++ b/arch/risc-v/src/bl602/bl602_entry.S @@ -51,16 +51,6 @@ bl602_start: add sp, sp, t0 andi sp, sp, ~0xF - la t0, g_idle_stack - li t1, CONFIG_IDLETHREAD_STACKSIZE - li t2, 0xdeadbeef -color_idle_stack: - addi t1, t1, -4 - add t3, t1, t0 - sw t2, 0(t3) - bnez t1, color_idle_stack - - #ifndef RUN_IN_RAM /* Load boot2 partition address */ diff --git a/arch/risc-v/src/c906/c906_head.S b/arch/risc-v/src/c906/c906_head.S index 0bd0f6d83e..f7a585365b 100644 --- a/arch/risc-v/src/c906/c906_head.S +++ b/arch/risc-v/src/c906/c906_head.S @@ -93,33 +93,6 @@ __start: la t0, __trap_vec csrw mtvec, t0 -#ifdef CONFIG_STACK_COLORATION - - /* Write a known value to the IDLE thread stack to support stack - * monitoring logic - */ - - lui t0, %hi(C906_IDLESTACK_BASE) - addi t0, t0, %lo(C906_IDLESTACK_BASE) - - lui t1, %hi(C906_IDLESTACK_TOP) - addi t1, t1, %lo(C906_IDLESTACK_TOP) - - lui t2, %hi(STACK_COLOR) - addi t2, t2, %lo(STACK_COLOR) - - bgeu t0, t1, 2f - - /* t0 = start of IDLE stack; t1 = Size of tack; t2 = coloration */ - -1: - sw t2, 0(t0) - addi t0, t0, 4 - bne t0, t1, 1b -2: - -#endif - /* Jump to __c906_start with mhartid */ j __c906_start diff --git a/arch/risc-v/src/fe310/fe310_head.S b/arch/risc-v/src/fe310/fe310_head.S index 5cf81a30f1..5e74364e47 100644 --- a/arch/risc-v/src/fe310/fe310_head.S +++ b/arch/risc-v/src/fe310/fe310_head.S @@ -57,19 +57,6 @@ __start: la t0, __trap_vec csrw mtvec, t0 -#ifdef CONFIG_STACK_COLORATION - /* t0 = start of IDLE stack; t1 = top of the stack; t2 = coloration */ - - la t0, FE310_IDLESTACK_BASE - la t1, FE310_IDLESTACK_TOP - li t2, STACK_COLOR - -1: - sw t2, 0(t0) - addi t0, t0, 4 - bne t0, t1, 1b -#endif - /* Jump to __fe310_start */ jal x1, __fe310_start diff --git a/arch/risc-v/src/k210/k210_head.S b/arch/risc-v/src/k210/k210_head.S index 852c53bcf0..10f48f7733 100644 --- a/arch/risc-v/src/k210/k210_head.S +++ b/arch/risc-v/src/k210/k210_head.S @@ -72,25 +72,6 @@ __start: la t0, __trap_vec csrw mtvec, t0 -#ifdef CONFIG_STACK_COLORATION - /* t0 = start of IDLE stack; t1 = top of the stack; t2 = coloration */ - - bnez a0, 3f /* a0: hartid */ - la t0, K210_IDLESTACK0_BASE - j 4f -3: - la t0, K210_IDLESTACK1_BASE -4: - - mv t1, sp - li t2, STACK_COLOR - -5: - sw t2, 0(t0) - addi t0, t0, 4 - bne t0, t1, 5b -#endif - /* Jump to __k210_start with mhartid */ j __k210_start diff --git a/arch/risc-v/src/mpfs/mpfs_head.S b/arch/risc-v/src/mpfs/mpfs_head.S index c99cd9f40a..14e7650640 100755 --- a/arch/risc-v/src/mpfs/mpfs_head.S +++ b/arch/risc-v/src/mpfs/mpfs_head.S @@ -147,27 +147,6 @@ __start_mpfs: .option pop -#ifdef CONFIG_STACK_COLORATION - - /* Write a known value to the IDLE thread stack to support stack - * monitoring logic - */ - - la t0, MPFS_IDLESTACK_BASE - la t1, MPFS_IDLESTACK_TOP - li t2, STACK_COLOR - bgeu t0, t1, 2f - - /* t0 = start of IDLE stack; t1 = top of stack; t2 = coloration */ - -1: - sw t2, 0(t0) - addi t0, t0, 4 - bne t0, t1, 1b -2: - -#endif - /* Jump to __mpfs_start with mhartid in a0 */ j __mpfs_start diff --git a/arch/xtensa/src/esp32/esp32_start.c b/arch/xtensa/src/esp32/esp32_start.c index ac3d650103..4587f7da6b 100644 --- a/arch/xtensa/src/esp32/esp32_start.c +++ b/arch/xtensa/src/esp32/esp32_start.c @@ -100,22 +100,6 @@ void IRAM_ATTR __start(void) up_irq_disable(); -#ifdef CONFIG_STACK_COLORATION - { - register uint32_t *ptr; - register int i; - - /* If stack debug is enabled, then fill the stack with a recognizable - * value that we can use later to test for high water marks. - */ - - for (i = 0, ptr = g_idlestack; i < IDLETHREAD_STACKWORDS; i++) - { - *ptr++ = STACK_COLOR; - } - } -#endif - /* Move the stack to a known location. Although we were given a stack * pointer at start-up, we don't know where that stack pointer is * positioned with respect to our memory map. The only safe option is to diff --git a/arch/xtensa/src/esp32s2/esp32s2_start.c b/arch/xtensa/src/esp32s2/esp32s2_start.c index a272c81a6d..76f73d8cd8 100644 --- a/arch/xtensa/src/esp32s2/esp32s2_start.c +++ b/arch/xtensa/src/esp32s2/esp32s2_start.c @@ -108,22 +108,6 @@ void IRAM_ATTR __start(void) xtensa_earlyserialinit(); #endif -#ifdef CONFIG_STACK_COLORATION - { - register uint32_t *ptr; - register int i; - - /* If stack debug is enabled, then fill the stack with a recognizable - * value that we can use later to test for high water marks. - */ - - for (i = 0, ptr = g_idlestack; i < IDLETHREAD_STACKWORDS; i++) - { - *ptr++ = STACK_COLOR; - } - } -#endif - /* Move the stack to a known location. Although we were given a stack * pointer at start-up, we don't know where that stack pointer is * positioned with respect to our memory map. The only safe option is to