• David Gibson's avatar
    coroutine: Stack allocation · b4f0767d
    David Gibson authored
    At present, coroutine stacks must be allocated explicitly by the user,
    then initialized with coroutine_stack_init().  This adds a new
    coroutine_stack_alloc() function which allocates a stack, making life
    easier for users.  coroutine_stack_release() will automatically determine
    if the given stack was set up with _init() or alloc() and act
    accordingly.
    
    The stacks are allocate with mmap() rather than a plain malloc(), and a
    guard page is added, so an overflow of the stack should result in a
    relatively debuggable SEGV instead of random data corruption.
    Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
    b4f0767d
api-1.c 1.17 KB