22#define SYS_PROCESS_EXIT 0
23#define SYS_THREAD_EXIT 1
25#define SYS_NANOSLEEP 3
30#define SYS_UNIX_EPOCH 8
43#define SYS_MPROTECT 21
44#define SYS_GETDENTS 22
45#define SYS_THREAD_CREATE 23
56#define SYS_TOTAL_AMOUNT 33
100#define SYSCALL_DEFINE(num, returnType, ...) \
101 returnType syscall_handler_##num(__VA_ARGS__); \
102 const syscall_descriptor_t __syscall_##num __attribute__((used, section(".syscall_table"))) = { \
104 .handler = (void*)syscall_handler_##num, \
106 returnType syscall_handler_##num(__VA_ARGS__)
syscall_descriptor_t _syscallTableEnd[]
Linker defined end of the syscall table.
void syscall_table_init(void)
Initialize the syscall table.
syscall_descriptor_t _syscallTableStart[]
Linker defined start of the syscall table.
void syscalls_cpu_init(void)
Initalize syscalls on the current CPU.
void syscall_ctx_init(syscall_ctx_t *ctx, stack_pointer_t *kernelStack)
Initialize a per-thread syscall context.
void syscall_ctx_load(syscall_ctx_t *ctx)
Load a syscall context into the CPU.
void syscall_entry(void)
Assembly entry point for syscalls.
uint64_t syscall_handler(uint64_t rdi, uint64_t rsi, uint64_t rdx, uint64_t rcx, uint64_t r8, uint64_t r9, uint64_t number)
C syscall handler.
__UINTPTR_TYPE__ uintptr_t
Structure to define a stack in memory.
Per thread syscall context.