49#define SYSCALL_CTX_SYSCALL_RSP_OFFSET 0x0
56#define SYSCALL_CTX_USER_RSP_OFFSET 0x8
172#define SYSCALL_DEFINE(num, returnType, ...) \
173 returnType syscall_handler_##num(__VA_ARGS__); \
174 const syscall_descriptor_t __syscall_##num __attribute__((used, section("._syscall_table"))) = { \
176 .handler = (void*)syscall_handler_##num, \
178 returnType syscall_handler_##num(__VA_ARGS__)
void syscall_ctx_init(syscall_ctx_t *ctx, const stack_pointer_t *syscallStack)
Initialize a syscall context.
void syscall_table_init(void)
Sort the syscall table and verify that all syscalls are present.
syscall_number_t
System Call Numbers.
syscall_descriptor_t _syscall_table_start[]
Linker defined start of the syscall table.
syscall_descriptor_t _syscall_table_end[]
Linker defined end of the syscall table.
syscall_flags_t
Syscall flags.
void syscall_handler(interrupt_frame_t *frame)
Main C syscall handler.
void syscall_ctx_load(syscall_ctx_t *ctx)
Load the syscall context into the MSR_KERNEL_GS_BASE MSR.
void syscall_entry(void)
Assembly entry point for syscalls.
@ SYSCALL_FORCE_FAKE_INTERRUPT
__UINTPTR_TYPE__ uintptr_t
Structure to define a stack in memory.
Per thread syscall context.
uintptr_t userRsp
Used to avoid clobbering registers when switching stacks.
interrupt_frame_t * frame
If a fake interrupt is generated, this is the interrupt frame to return to.
uintptr_t syscallRsp
The stack pointer to use when handling syscalls.
syscall_flags_t flags
Flags for the current syscall.