Serene Runtime 1.0.0
C runtime for the Serene programming language
Loading...
Searching...
No Matches
stack_x86_64.h File Reference
#include <stddef.h>
#include <stdint.h>
Include dependency graph for stack_x86_64.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  srn_fiber_frame
 srn_fiber_frame is the exact frame srn_fiber_swap (switch_x86_64.S) pushes and pops, and that srn_fiber_ctx_make (ctx_x86_64.c) fabricates for a fresh fiber. More...
 

Macros

#define SRN_FIBER_STACK_ALIGN   16U
 SysV AMD64 requires 16-byte stack alignment at a call; srn_fiber_ctx_make rounds the frame's base down to this so the trampoline's entry rsp is aligned.
 
#define SRN_FIBER_MXCSR_DEFAULT   0x1F80U
 Control-register values a fresh fiber starts with: all FP exceptions masked, round-to-nearest, extended precision – the environment a freshly started C program runs with.
 
#define SRN_FIBER_FCW_DEFAULT   0x037FU
 x87 control word
 

Typedefs

typedef struct srn_fiber_frame srn_fiber_frame_t
 srn_fiber_frame is the exact frame srn_fiber_swap (switch_x86_64.S) pushes and pops, and that srn_fiber_ctx_make (ctx_x86_64.c) fabricates for a fresh fiber.
 

Functions

void srn_fiber_trampoline (void)
 Defined in switch_x86_64.S.
 

Macro Definition Documentation

◆ SRN_FIBER_FCW_DEFAULT

#define SRN_FIBER_FCW_DEFAULT   0x037FU

x87 control word

Definition at line 69 of file stack_x86_64.h.

◆ SRN_FIBER_MXCSR_DEFAULT

#define SRN_FIBER_MXCSR_DEFAULT   0x1F80U

Control-register values a fresh fiber starts with: all FP exceptions masked, round-to-nearest, extended precision – the environment a freshly started C program runs with.

srn_fiber_ctx_make seeds them into the frame above.

SSE control/status word (MXCSR)

Definition at line 67 of file stack_x86_64.h.

◆ SRN_FIBER_STACK_ALIGN

#define SRN_FIBER_STACK_ALIGN   16U

SysV AMD64 requires 16-byte stack alignment at a call; srn_fiber_ctx_make rounds the frame's base down to this so the trampoline's entry rsp is aligned.

Definition at line 60 of file stack_x86_64.h.

Typedef Documentation

◆ srn_fiber_frame_t

srn_fiber_frame is the exact frame srn_fiber_swap (switch_x86_64.S) pushes and pops, and that srn_fiber_ctx_make (ctx_x86_64.c) fabricates for a fresh fiber.

Its field order and offsets ARE the contract with that assembly; the static asserts pin them so the C side and the assembly cannot drift apart. Only the matching x86-64 sources include this header.

Function Documentation

◆ srn_fiber_trampoline()

void srn_fiber_trampoline ( void )
extern

Defined in switch_x86_64.S.

Not callable from C; only its address is taken, to seed the initial return address of a fresh fiber.

Here is the caller graph for this function: