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

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 3be03008ac41585fe7720fc43824eba7d4e710f8
Author: raiden00pl <[email protected]>
AuthorDate: Mon Aug 24 10:00:11 2026 +0200

    arch/x86_64: drop unused gap below the intel64 idle stacks
    
    The idle stack area started at _ebss + CONFIG_IDLETHREAD_STACKSIZE *
    CONFIG_SMP_NCPUS, so the first CONFIG_SMP_NCPUS stack slots after .bss
    were never used - 16MiB on a 4-CPU configuration with a 4MiB idle
    stack.  Start the area at _ebss and let the heap begin that much
    earlier.
    
    The -16 offset is kept: it is what places the AP initial RSP set up in
    intel64_head.S below the xcp->regs block that up_cpu_idlestack()
    reserves at the top of the same stack.  Without it both land on the
    same 64-byte slot and the first context save corrupts the AP stack.
    
    Signed-off-by: raiden00pl <[email protected]>
    Assisted-by: Claude Code
---
 arch/x86_64/src/common/x86_64_allocateheap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86_64/src/common/x86_64_allocateheap.c 
b/arch/x86_64/src/common/x86_64_allocateheap.c
index 762be0ad461..f75aa4c6494 100644
--- a/arch/x86_64/src/common/x86_64_allocateheap.c
+++ b/arch/x86_64/src/common/x86_64_allocateheap.c
@@ -56,7 +56,7 @@
  ****************************************************************************/
 
 const uintptr_t g_idle_topstack = (uintptr_t)_ebss +
-  (uintptr_t)CONFIG_IDLETHREAD_STACKSIZE * (CONFIG_SMP_NCPUS + 1) - 16;
+                                  CONFIG_IDLETHREAD_STACKSIZE - 16;
 
 /****************************************************************************
  * Name: up_allocate_heap

Reply via email to