![]() |
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 (::syscore::SyscallType syscall, syscall_func_t handler) |
| Loads a syscall handler into the manager. | |
| void | remove_syscall_handler (::syscore::SyscallType syscall) |
| Removes a syscall handler from the manager. | |
Provides an API for userspace applications to interact with the kernel.
Definition at line 58 of file syscalls.h.
| SyscallManager::SyscallManager | ( | ) |
Construct a new Syscall Manager object and register the syscall handlers. Registers to interrupt 0x80.
Definition at line 23 of file syscalls.cpp.
References MaxOS::Logger::INFO(), set_syscall_handler(), syscall_allocate_memory(), syscall_close_process(), syscall_free_memory(), syscall_klog(), syscall_resource_close(), syscall_resource_create(), syscall_resource_open(), syscall_resource_read(), syscall_resource_write(), syscall_thread_close(), syscall_thread_sleep(), and syscall_thread_yield().
|
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 52 of file syscalls.cpp.
References MaxOS::Logger::ERROR().
| void SyscallManager::remove_syscall_handler | ( | ::syscore::SyscallType | syscall | ) |
Removes a syscall handler from the manager.
| syscall | The syscall ID number |
Definition at line 105 of file syscalls.cpp.
| void SyscallManager::set_syscall_handler | ( | ::syscore::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 95 of file syscalls.cpp.
Referenced by SyscallManager().
|
static |
System call to allocate a block of memory.
| args | Arg0 = size |
Definition at line 169 of file syscalls.cpp.
References MaxOS::memory::MemoryManager::malloc().
Referenced by SyscallManager().
|
static |
System call to close a process.
| args | Arg0 = pid Arg1 = exit code |
Definition at line 117 of file syscalls.cpp.
References MaxOS::processes::GlobalScheduler::core_scheduler(), MaxOS::processes::GlobalScheduler::current_process(), MaxOS::processes::GlobalScheduler::get_process(), and MaxOS::processes::GlobalScheduler::system_scheduler().
Referenced by SyscallManager().
|
static |
System call to free a block of memory.
| args | Arg0 = address |
Definition at line 186 of file syscalls.cpp.
References MaxOS::memory::MemoryManager::free().
Referenced by SyscallManager().
|
static |
System call to log a message to the kernel log.
| args | Arg0 = message |
Definition at line 141 of file syscalls.cpp.
References 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 240 of file syscalls.cpp.
References MaxOS::processes::GlobalScheduler::current_process().
Referenced by SyscallManager().
|
static |
System call to create a resource.
| args | Arg0 = ResourceType Arg1 = Name Arg2 = Flags |
Definition at line 201 of file syscalls.cpp.
References MaxOS::processes::GlobalResourceRegistry::get_registry().
Referenced by SyscallManager().
|
static |
System call to open a resource.
| args | Arg0 = ResourceType Arg1 = Name Arg2 = Flags |
Definition at line 222 of file syscalls.cpp.
References MaxOS::processes::GlobalScheduler::current_process().
Referenced by SyscallManager().
|
static |
System call to read from a resource.
| args | Arg0 = Handle Arg1 = Buffer Arg2 = Size Arg3 = Flags |
Definition at line 283 of file syscalls.cpp.
References MaxOS::processes::GlobalScheduler::current_process().
Referenced by SyscallManager().
|
static |
System call to write to a resource.
| args | Arg0 = Handle Arg1 = Buffer Arg2 = Size Arg3 = Flags |
Definition at line 257 of file syscalls.cpp.
References MaxOS::processes::GlobalScheduler::current_process().
Referenced by SyscallManager().
|
static |
System call to close a thread.
| args | Arg0 = tid Arg1 = exit code |
Definition at line 342 of file syscalls.cpp.
References MaxOS::processes::GlobalScheduler::core_scheduler(), MaxOS::processes::GlobalScheduler::current_thread(), and MaxOS::processes::GlobalScheduler::get_thread().
Referenced by SyscallManager().
|
static |
System call to sleep the current process.
| args | Arg0 = milliseconds |
Definition at line 323 of file syscalls.cpp.
References MaxOS::processes::GlobalScheduler::current_thread(), and MaxOS::processes::GlobalScheduler::yield().
Referenced by SyscallManager().
|
static |
System call to yield the current process.
| args | Nothing |
Definition at line 309 of file syscalls.cpp.
References MaxOS::processes::GlobalScheduler::yield().
Referenced by SyscallManager().