fn capture_stack<const SIZE: usize>(stack_pointer: u32, stack: &mut ArrayMemoryRegion<SIZE>) {
    extern "C" {
        static mut _stack_start: core::ffi::c_void;
    }

    /// Get the start address of the stack. The stack grows to lower addresses,
    /// so this should be the highest stack address you can get.
    fn stack_start() -> u32 {
        unsafe { &_stack_start as *const _ as u32 }
    }

    let stack_size = stack_start().saturating_sub(stack_pointer).min(SIZE as u32);
    unsafe {
        stack.copy_from_memory(stack_pointer as *const u8, stack_size as usize);
    }
}
/// Capture the stack from the current given stack pointer until the start of the stack into the given stack memory region.
/// The captured stack will be the smallest of the sizes of the current stack size or the memory region size.
///
/// If the memory region is too small, it will contain the top stack space and miss the bottom stack space.
/// This is done because the top of the stack is often more interesting than the bottom.
Capture the stack from the current given stack pointer until the start of the stack into the given stack memory region.
The captured stack will be the smallest of the sizes of the current stack size or the memory region size.

If the memory region is too small, it will contain the top stack space and miss the bottom stack space.
This is done because the top of the stack is often more interesting than the bottom.
Capture the stack from the current given stack pointer until the start of the stack into the given stack memory region . The captured stack will be the smallest of the sizes of the current stack size or the memory region size . If the memory region is too small it will contain the top stack space and miss the bottom stack space . This is done because the top of the stack is often more interesting than the bottom .
fn capture_stack<const SIZE: usize>(stack_pointer: u32, stack: &mut ArrayMemoryRegion<SIZE>) {
    extern "C" {
        static mut _stack_start: core::ffi::c_void;
    }
    /// Get the start address of the stack. The stack grows to lower addresses,
    /// so this should be the highest stack address you can get.
    fn stack_start() -> u32 {
        unsafe { &_stack_start as *const _ as u32 }
    }
    let stack_size = stack_start().saturating_sub(stack_pointer).min(SIZE as u32);
    unsafe {
        stack.copy_from_memory(stack_pointer as *const u8, stack_size as usize);
    }
}
fn capture_stack < const SIZE : usize > ( stack_pointer : u32 , stack : & mut ArrayMemoryRegion < SIZE > ) { extern " " { static mut _stack_start : core :: ffi :: c_void ; } /// Get the start address of the stack. The stack grows to lower addresses, /// so this should be the highest stack address you can get. fn stack_start ( ) -> u32 { unsafe { & _stack_start as * const _ as u32 } } let stack_size = stack_start ( ) . saturating_sub ( stack_pointer ) . min ( SIZE as u32 ) ; unsafe { stack . copy_from_memory ( stack_pointer as * const u8 , stack_size as usize ) ; } }
Capture the stack from the current given stack pointer until the start of the stack into the given stack memory region.
Capture the stack from the current given stack pointer until the start of the stack into the given stack memory region .
stack_pointer
u32
stack
&mut ArrayMemoryRegion<SIZE>
stack_pointer
u32
stack
&mut ArrayMemoryRegion<SIZE>