rt/include/rt/context.h

24 lines
619 B
C

#pragma once
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
// Initialize the given stack with a new context that will execute fn().
void *rt_context_init(void (*fn)(void), void *stack, size_t stack_size);
// Initialize the given stack with a new context that will execute fn(arg).
void *rt_context_init_arg(void (*fn)(uintptr_t), uintptr_t arg, void *stack,
size_t stack_size);
/* Pointer to the previous task's context field, used to store the suspending
* context during a context switch. */
extern void **rt_context_prev;
#ifdef __cplusplus
}
#endif