PatchworkOS
Loading...
Searching...
No Matches
syscalls.h File Reference

Go to the source code of this file.

Data Structures

struct  syscall_ctx_t
 Per thread syscall context. More...
 
struct  syscall_descriptor_t
 A syscall descriptor. More...
 

Macros

#define SYS_PROCESS_EXIT   0
 
#define SYS_THREAD_EXIT   1
 
#define SYS_SPAWN   2
 
#define SYS_NANOSLEEP   3
 
#define SYS_ERRNO   4
 
#define SYS_GETPID   5
 
#define SYS_GETTID   6
 
#define SYS_UPTIME   7
 
#define SYS_UNIX_EPOCH   8
 
#define SYS_OPEN   9
 
#define SYS_OPEN2   10
 
#define SYS_CLOSE   11
 
#define SYS_READ   12
 
#define SYS_WRITE   13
 
#define SYS_SEEK   14
 
#define SYS_IOCTL   15
 
#define SYS_CHDIR   16
 
#define SYS_POLL   17
 
#define SYS_STAT   18
 
#define SYS_MMAP   19
 
#define SYS_MUNMAP   20
 
#define SYS_MPROTECT   21
 
#define SYS_GETDENTS   22
 
#define SYS_THREAD_CREATE   23
 
#define SYS_YIELD   24
 
#define SYS_DUP   25
 
#define SYS_DUP2   26
 
#define SYS_FUTEX   27
 
#define SYS_REMOVE   28
 
#define SYS_LINK   29
 
#define SYS_SHARE   30
 
#define SYS_CLAIM   31
 
#define SYS_BIND   32
 
#define SYS_TOTAL_AMOUNT   33
 
#define SYSCALL_DEFINE(num, returnType, ...)
 Macro to define a syscall.
 

Functions

void syscall_entry (void)
 Assembly entry point for syscalls.
 
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_table_init (void)
 Initialize the syscall table.
 
void syscalls_cpu_init (void)
 Initalize syscalls on the current CPU.
 
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.
 

Variables

syscall_descriptor_t _syscallTableStart []
 Linker defined start of the syscall table.
 
syscall_descriptor_t _syscallTableEnd []
 Linker defined end of the syscall table.