9#ifndef MAXOS_SYSTEM_SYSCALLS_H
10#define MAXOS_SYSTEM_SYSCALLS_H
14#include <libkpi/syscalls.h>
15#include <libcommon/vector.h>
16#include <libcommon/colour.h>
25namespace MaxOS::system {
Defines BlockingLock class for thread synchronization.
Handles a certain interrupt number.
virtual void handle_interrupt()
Handles an interrupt.
Provides an API for userspace applications to interact with the kernel.
static syscall_args_t * syscall_klog(syscall_args_t *args)
System call to log a message to the kernel log.
static syscall_args_t * syscall_resource_create(syscall_args_t *args)
System call to create a resource.
static syscall_args_t * syscall_resource_close(syscall_args_t *args)
System call to close a resource.
static syscall_args_t * syscall_resource_open(syscall_args_t *args)
System call to open a resource.
static syscall_args_t * syscall_resource_registry_create(syscall_args_t *args)
System call to create a new resource registry.
SyscallManager()
Construct a new Syscall Manager object and register the syscall handlers. Registers to interrupt 0x80...
void set_syscall_handler(::MaxOS::KPI::SyscallType syscall, syscall_func_t handler)
Loads a syscall handler into the manager.
static syscall_args_t * syscall_free_memory(syscall_args_t *args)
System call to free a block of memory.
static syscall_args_t * syscall_resource_write(syscall_args_t *args)
System call to write to a resource.
void remove_syscall_handler(::MaxOS::KPI::SyscallType syscall)
Removes a syscall handler from the manager.
static syscall_args_t * syscall_allocate_memory(syscall_args_t *args)
System call to allocate a block of memory.
static syscall_args_t * syscall_resource_read(syscall_args_t *args)
System call to read from a resource.
struct PACKED MaxOS::system::CPUStatus cpu_status_t
Alias for CPUStatus struct.
Defines a InterruptManager and InterruptHandler for managing hardware and software interrupts.
Defines a MemoryManager class for handling memory allocation and deallocation.
Defines scheduler resource classes for wrapping userspace bridge Resources in the Global Scheduler,...
Defines a GlobalScheduler and Scheduler for managing processes and threads.
The arguments passed to a syscall (simplified representation of values in registers)
uint64_t arg0
First argument (in rdi)
uint64_t arg1
Second argument (in rsi)
uint64_t return_value
The return value of the syscall (in rax)
uint64_t arg4
Fifth argument (in r8)
uint64_t arg3
Fourth argument (in rcx)
uint64_t arg2
Third argument (in rdx)
cpu_status_t * return_state
The CPU state to return to after the syscall.
uint64_t arg5
Sixth argument (in r9)
syscall_args_t *(* syscall_func_t)(syscall_args_t *args)