1#ifndef COROUTINE_ARM64_CONTEXT_H
2#define COROUTINE_ARM64_CONTEXT_H 1
18#define COROUTINE __attribute__((noreturn)) void
20enum {COROUTINE_REGISTERS = 0xb0 / 8};
31 context->stack_pointer = NULL;
34static inline void coroutine_initialize(
36 coroutine_start start,
40 assert(start && stack && size >= 1024);
43 char * top = (
char*)stack + size;
44 context->stack_pointer = (
void**)((uintptr_t)top & ~0xF);
46 context->stack_pointer -= COROUTINE_REGISTERS;
47 memset(context->stack_pointer, 0,
sizeof(
void*) * COROUTINE_REGISTERS);
49 context->stack_pointer[0xa0 / 8] = (
void*)start;