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 <raiden00@railab.me>
Assisted-by: Claude Code
This commit is contained in:
raiden00pl 2026-08-24 10:00:11 +02:00 committed by Alin Jerpelea
parent 1a0586826e
commit 3be03008ac

View file

@ -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