Serene Runtime 1.0.0
C runtime for the Serene programming language
Loading...
Searching...
No Matches
srn_fiber_stack_t Struct Reference

One stack per fiber, mapped with a guard page at the low end so an overflow faults deterministically instead of corrupting a neighbour. More...

#include <fiber.h>

Data Fields

void * start
 High end, stack pointer initialises to this address.
 
void * limit
 Low end of usable region.
 
void * guard
 The protected page to detect stack overflows.
 

Detailed Description

One stack per fiber, mapped with a guard page at the low end so an overflow faults deterministically instead of corrupting a neighbour.

the layout is like:

|... frames ...|... guard page ...| ^ start ^ limit ^ guard

It is a bit unintuitive to see the guard pointing at the end of the the region, but conventionally, the guard is an OS page and since the stack grows downward and allocations normally grow upward, guard is actually the address that OS (POSIX in this example) will return to us as the starting point of the memory region. Or to put it in different terms, we store the stack frames, starting from the end of the allocated memory for the region and move toward the start of the allocated memory.

Definition at line 168 of file fiber.h.

Field Documentation

◆ guard

void* srn_fiber_stack_t::guard

The protected page to detect stack overflows.

Definition at line 174 of file fiber.h.

◆ limit

void* srn_fiber_stack_t::limit

Low end of usable region.

Definition at line 172 of file fiber.h.

◆ start

void* srn_fiber_stack_t::start

High end, stack pointer initialises to this address.

Definition at line 170 of file fiber.h.


The documentation for this struct was generated from the following file: