From 3be03008ac41585fe7720fc43824eba7d4e710f8 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Mon, 24 Aug 2026 10:00:11 +0200 Subject: [PATCH] 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 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