This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch releases/12.7
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit f5a449487c93f4b3607c005b8d629f62713e2fc6
Author: p-szafonimateusz <[email protected]>
AuthorDate: Thu Sep 26 13:58:54 2024 +0200

    arch/intel64: colorize IDLE stack for AP cores
    
    colorize IDLE stack for AP cores in x86_64
    
    Signed-off-by: p-szafonimateusz <[email protected]>
---
 arch/x86_64/src/intel64/intel64_cpustart.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/arch/x86_64/src/intel64/intel64_cpustart.c 
b/arch/x86_64/src/intel64/intel64_cpustart.c
index 2fe404349a..7a71125527 100644
--- a/arch/x86_64/src/intel64/intel64_cpustart.c
+++ b/arch/x86_64/src/intel64/intel64_cpustart.c
@@ -32,6 +32,7 @@
 #include <nuttx/arch.h>
 #include <nuttx/spinlock.h>
 
+#include "sched/sched.h"
 #include "init/init.h"
 
 #include "intel64_lowsetup.h"
@@ -128,8 +129,11 @@ static int x86_64_ap_startup(int cpu)
 
 void x86_64_ap_boot(void)
 {
+  struct tcb_s *tcb = this_task();
   uint8_t cpu = 0;
 
+  UNUSED(tcb);
+
   /* Do some checking on CPU compatibilities at the top of this function */
 
   x86_64_check_and_enable_capability();
@@ -153,7 +157,7 @@ void x86_64_ap_boot(void)
 #ifdef CONFIG_SCHED_INSTRUMENTATION
   /* Notify that this CPU has started */
 
-  sched_note_cpu_started(this_task());
+  sched_note_cpu_started(tcb);
 #endif
 
   sinfo("cpu=%d\n", cpu);
@@ -165,6 +169,15 @@ void x86_64_ap_boot(void)
   up_enable_irq(SMP_IPI_IRQ);
   up_enable_irq(SMP_IPI_ASYNC_IRQ);
 
+#ifdef CONFIG_STACK_COLORATION
+  /* If stack debug is enabled, then fill the stack with a
+   * recognizable value that we can use later to test for high
+   * water marks.
+   */
+
+  x86_64_stack_color(tcb->stack_alloc_ptr, 0);
+#endif
+
   /* CPU ready */
 
   x86_64_cpu_ready_set(cpu);

Reply via email to