Skip to main content

alloc_stack

Function alloc_stack 

Source
pub fn alloc_stack(size: usize) -> Option<&'static mut [u8]>
Expand description

Allocate a size-aligned stack of size bytes from the pool, with a guard band (usually 64 bytes — see [guard_size]) at its low end (plan.md §3.2). size must be a power of two (the MPU/PMP region alignment requires it) and at least as large as the guard band.

Each stack’s guard band is registered via crate::port::arch::guard_register (a no-op on arches whose memory guard doesn’t need one, e.g. Cortex-M). Returns None when the pool is exhausted or on the host test backend (no linker-provided pool).