| STACK(9) | Kernel Developer's Manual | STACK(9) | 
STACK —
#include <sys/param.h>
type
  
  STACK_ALLOC(sp,
    size);
type
  
  STACK_MAX(sp,
    size);
type
  
  STACK_ALIGN(sp,
    bytes);
type
  
  STACK_GROW(sp,
    size);
type
  
  STACK_SHRINK(sp,
    size);
The STACK_ALLOC() macro returns a pointer
    to allocated stack space of some size. Given the
    returned pointer sp and size,
    STACK_MAX() returns the maximum stack address of the
    allocated stack space. The STACK_ALIGN() macro can
    be used to align the stack pointer sp by the specified
    amount of bytes.
Two basic operations are common to all stacks: a data item is
    added (“push”) to the location pointed by
    sp or a data item is removed (“pop”)
    from the stack. The stack pointer must be subsequently adjusted by the size
    of the data item. The STACK_GROW() and
    STACK_SHRINK() macros adjust the stack pointer
    sp by given size.
A stack may grow either up or down. The described macros take this
    into account by using the __MACHINE_STACK_GROWS_UP
    preprocessor define.
| April 8, 2011 | NetBSD 10.0 |