From e92c45394ab908977b855d290007fcaf3d0a4ae5 Mon Sep 17 00:00:00 2001 From: antifallobst Date: Fri, 17 Feb 2023 14:51:35 +0100 Subject: [PATCH] docs: documented syscalls --- .wiki/Kernel-documentation.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.wiki/Kernel-documentation.md b/.wiki/Kernel-documentation.md index 9e1470b..cfa6591 100644 --- a/.wiki/Kernel-documentation.md +++ b/.wiki/Kernel-documentation.md @@ -104,6 +104,38 @@ No detailed Information available (cpu_state null reference) ``` The `Error Message` could still be helpful, but good luck finding that bug. +## Syscalls +NoxOS will use interrupt based syscalls. +To perform a syscall, write its ID into the `rax` register and call interrupt 0x80. + +**Example:** +```nasm +mov rax, 0x0000 +int 0x80 +``` + +The syscalls are grouped into groups and their ID consists of a _group-ID_ (first two digits) and a _syscall-ID_ (last two digits). + +### Syscall groups + - **Misc** - 0x00 + - **File** - 0x01 + - **Proc** - 0x02 + - **Kernel** - 0xFF + +### Misc Syscalls - `0x00--` + +### File Syscalls - `0x01--` + +### Proc Syscalls - `0x02--` + +### Kernel Syscalls - `0xFF--` +The kernel syscalls can only be called by the kernel process and its childs. All other processes, won't be able to use this functions. + +| ID | Name | Description | +|--------|-----------------|------------------------------------------------------------------------------------------------------| +| 0xFF00 | scheduler_start | Initializes the Kernels main thread from the current cpu_state. This is used to start multithreading | + + ## Format strings Format strings are strings that are formatted at runtime. They are created by defining a pattern, like the following one: @@ -220,6 +252,9 @@ This variant is the `%x` standard. This is not a really a placeholder, but you can use this to mask the % sign, so it will be interpreted as just a `%` instead of a placeholder. + +## + --- **DISCLAIMER:** Only the headers are documented, because documenting the whole code itself would be very time intensive and the headers as 'public' API are the most important to document.