![]() |
Max OS 0.3
|
Provides an API for userspace applications to interact with the kernel. More...
#include <syscalls.h>
Public Member Functions | |
| SyscallManager () | |
| Construct a new Syscall Manager object and register the syscall handlers. Registers to interrupt 0x80. | |
| cpu_status_t * | handle_interrupt (cpu_status_t *esp) final |
| Loads the args from the registers and delegates the syscall to the relevant handler if defined. | |
| void | set_syscall_handler (::MaxOS::KPI::SyscallType syscall, syscall_func_t handler) |
| Loads a syscall handler into the manager. | |
| void | remove_syscall_handler (::MaxOS::KPI::SyscallType syscall) |
| Removes a syscall handler from the manager. | |
Static Public Member Functions | |
| 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_allocate_memory (syscall_args_t *args) |
| System call to allocate a block of memory. | |
| 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_create (syscall_args_t *args) |
| System call to create 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_close (syscall_args_t *args) |
| System call to close a resource. | |
| static syscall_args_t * | syscall_resource_write (syscall_args_t *args) |
| System call to write to a resource. | |
| static syscall_args_t * | syscall_resource_read (syscall_args_t *args) |
| System call to read from a resource. | |
| static syscall_args_t * | syscall_resource_registry_create (syscall_args_t *args) |
| System call to create a new resource registry. | |
Provides an API for userspace applications to interact with the kernel.
Definition at line 59 of file syscalls.h.
| SyscallManager::SyscallManager | ( | ) |
Construct a new Syscall Manager object and register the syscall handlers. Registers to interrupt 0x80.
Definition at line 24 of file syscalls.cpp.
References MaxOS::Logger::INFO(), set_syscall_handler(), syscall_allocate_memory(), syscall_free_memory(), syscall_klog(), syscall_resource_close(), syscall_resource_create(), syscall_resource_open(), syscall_resource_read(), syscall_resource_registry_create(), and syscall_resource_write().
|
finalvirtual |
Loads the args from the registers and delegates the syscall to the relevant handler if defined.
| status | The cpu state |
Reimplemented from MaxOS::hardwarecommunication::InterruptHandler.
Definition at line 55 of file syscalls.cpp.
References MaxOS::system::SyscallArguments::arg0, MaxOS::system::SyscallArguments::arg1, MaxOS::system::SyscallArguments::arg2, MaxOS::system::SyscallArguments::arg3, MaxOS::system::SyscallArguments::arg4, MaxOS::system::SyscallArguments::arg5, MaxOS::Logger::ERROR(), MaxOS::system::SyscallArguments::return_state, and MaxOS::system::SyscallArguments::return_value.
| void SyscallManager::remove_syscall_handler | ( | ::MaxOS::KPI::SyscallType | syscall | ) |
Removes a syscall handler from the manager.
| syscall | The syscall ID number |
Definition at line 108 of file syscalls.cpp.
| void SyscallManager::set_syscall_handler | ( | ::MaxOS::KPI::SyscallType | syscall, |
| syscall_func_t | handler | ||
| ) |
Loads a syscall handler into the manager.
| syscall | The syscall ID number |
| handler | The handler to set |
Definition at line 98 of file syscalls.cpp.
Referenced by SyscallManager().
|
static |
System call to allocate a block of memory.
| args | Arg0 = size |
Definition at line 142 of file syscalls.cpp.
References MaxOS::system::SyscallArguments::arg0, MaxOS::memory::MemoryManager::malloc(), and MaxOS::system::SyscallArguments::return_value.
Referenced by SyscallManager().
|
static |
System call to free a block of memory.
| args | Arg0 = address |
Definition at line 160 of file syscalls.cpp.
References MaxOS::system::SyscallArguments::arg0, and MaxOS::memory::MemoryManager::free().
Referenced by SyscallManager().
|
static |
System call to log a message to the kernel log.
| args | Arg0 = message |
Definition at line 120 of file syscalls.cpp.
References MaxOS::system::SyscallArguments::arg0, MaxOS::Logger::INFO(), and MaxOS::Logger::Out().
Referenced by SyscallManager().
|
static |
System call to close a resource.
| args | Arg0 = Handle Arg1 = Flags |
Definition at line 216 of file syscalls.cpp.
References MaxOS::system::SyscallArguments::arg0, MaxOS::system::SyscallArguments::arg1, MaxOS::processes::resources::ResourceManager::close_resource(), MaxOS::processes::GlobalScheduler::current_process(), and MaxOS::processes::Process::resource_manager.
Referenced by SyscallManager().
|
static |
System call to create a resource.
| args | Arg0 = ResourceType Arg1 = Name Arg2 = Flags |
Definition at line 175 of file syscalls.cpp.
References MaxOS::system::SyscallArguments::arg0, MaxOS::system::SyscallArguments::arg1, MaxOS::system::SyscallArguments::arg2, MaxOS::system::SyscallArguments::arg3, MaxOS::processes::resources::BaseResourceRegistry::create_resource(), MaxOS::processes::resources::GlobalResourceRegistry::get_registry(), and MaxOS::system::SyscallArguments::return_value.
Referenced by SyscallManager().
|
static |
System call to open a resource.
| args | Arg0 = ResourceType Arg1 = Name Arg2 = Flags |
Definition at line 197 of file syscalls.cpp.
References MaxOS::system::SyscallArguments::arg0, MaxOS::system::SyscallArguments::arg1, MaxOS::system::SyscallArguments::arg2, MaxOS::processes::GlobalScheduler::current_process(), MaxOS::processes::resources::ResourceManager::open_resource(), MaxOS::processes::Process::resource_manager, and MaxOS::system::SyscallArguments::return_value.
Referenced by SyscallManager().
|
static |
System call to read from a resource.
| args | Arg0 = Handle Arg1 = Buffer Arg2 = Size Arg3 = Flags |
Definition at line 259 of file syscalls.cpp.
References MaxOS::system::SyscallArguments::arg0, MaxOS::system::SyscallArguments::arg1, MaxOS::system::SyscallArguments::arg2, MaxOS::system::SyscallArguments::arg3, MaxOS::processes::GlobalScheduler::current_process(), MaxOS::processes::resources::ResourceManager::get_resource(), MaxOS::processes::Process::resource_manager, and MaxOS::system::SyscallArguments::return_value.
Referenced by SyscallManager().
|
static |
System call to create a new resource registry.
| args | Arg0 = Name of the shared memory region Arg1 = Resource Type |
Definition at line 287 of file syscalls.cpp.
References MaxOS::system::SyscallArguments::arg0, MaxOS::system::SyscallArguments::arg1, and MaxOS::system::SyscallArguments::return_value.
Referenced by SyscallManager().
|
static |
System call to write to a resource.
| args | Arg0 = Handle Arg1 = Buffer Arg2 = Size Arg3 = Flags |
Definition at line 233 of file syscalls.cpp.
References MaxOS::system::SyscallArguments::arg0, MaxOS::system::SyscallArguments::arg1, MaxOS::system::SyscallArguments::arg2, MaxOS::system::SyscallArguments::arg3, MaxOS::processes::GlobalScheduler::current_process(), MaxOS::processes::resources::ResourceManager::get_resource(), MaxOS::processes::Process::resource_manager, and MaxOS::system::SyscallArguments::return_value.
Referenced by SyscallManager().