kernel::debug::stack
Stack high-water marking and overflow detection.
Every task stack is painted with STACK_PAINT at spawn, except its lowest
word which holds STACK_GUARD. Stacks grow downward, so untouched memory
accumulates at the low end and the guard is the first thing an overflow
destroys.
Functions
Section titled “Functions”update_hwm
Section titled “update_hwm”fn update_hwm(sched: &mut scheduler::Scheduler, task_id: u32)Update the high-water mark for a task and check its guard word.
Takes the scheduler rather than reaching for it, because the caller already
holds the lock. Reaching for it here would mint a second &mut to data the
caller is already holding one to — sound on one core only by accident, and
aliasing UB in the language regardless.
References: Scheduler