-
Notifications
You must be signed in to change notification settings - Fork 0
System Calls Table
Adam Mathlay edited this page Nov 25, 2024
·
6 revisions
ID (S1) | System Call Name | Description | Argument 1 | Argument 2 | Argument 3 | Return Value (R2) | Notes |
---|---|---|---|---|---|---|---|
1 | newFile |
Creates a new file (File Name ) in the VFS. |
File Name (String pointer) |
- | - | - | Throws a VM halting error if file is not found. A work around is planed |
2 | readFile |
Reads data from a file (File Name ) in the VFS into memory. Returns the Address stored |
File Name (String pointer) |
- | - | File content pointer | - |
3 | writeFile |
Writes data from File Content to a file,File Name in the VFS. |
File Name (String pointer) |
File Content (String Pointer) |
- | Writes Length bytes. Returns an error code if the file is not found or writable. |
|
4 | listFiles |
Lists all files and directories in the VFS. | - | - | - | Array of names (pointer) | Not yet implemented!!!! |
5 | deleteFile |
Deletes a file or directory, Path from the VFS. |
Path (String pointer) |
- | - | - | Returns an error code if the path does not exist or if deletion fails. The order of deletion is not guaranteed. |
6 | exit |
Terminates the current process with exit code, Exit Code . |
Exit Code (Long) |
- | - | - | this is a system-wide halt. Planed to only halt the process |
7 | exec |
Executes a new program, Program Path using the host OS. |
Program Path (String pointer) |
- | - | - | - |
8 | fork |
Creates a child process (a copy of the current process, the MVM instance). | - | - | - | Child Process ID (Long) | The child process will have a separate address space but shares the same initial code. |
9 | spawn |
Creates a new process and runs a program file, KAR Program Path . |
KAR Program Path (String pointer) |
- | - | Process ID (Long) | The parent process continues execution concurrently with the new child process. |
10 | share_m |
Establishes a shared memory region between the current process and Wanted Process ID . Shares memory address's from Start Address to End Address
|
Wanted Process ID (Long) |
Start Address (Long) |
End Address (Long) |
Shared Memory ID (Long) | IMPORTANT These syscalls are being reworked and are unstable | Returns the ID of the shared memory region. Shared memory regions are managed by the kernel. |
11 | pause_t |
Pauses the specified process, Process ID . |
Process ID (Long) |
- | - | - |
IMPORTANT These syscalls are being reworked and are unstable | The process will remain paused until resumed with continue_t . |
12 | continue_t |
Resumes a paused process, Process ID . |
Process ID (Long) |
- | - | - | IMPORTANT These syscalls are being reworked and are unstable | The process will resume execution from where it left off. |
14 | time |
Gets the current system time in milliseconds. | - | - | - | Time (Long) | - |
16 | getpid |
Gets the process ID of the current process. | - | - | - | Process ID (Long) | - |
17 | getuid |
Gets the user ID of the current process. | - | - | - | User ID (Long) | - |
18 | handleSignals |
Registers a signal handler. When a signal is received, execution jumps to a specified line. |
Signal Number (Long) |
Jump Address (Long) |
- | - | Signal handling is performed with signals generated from the host OS. The handling of signals in this way is not guaranteed. |
19 | sendSignal |
Sends a signal to another process. |
Target Process ID (Long) |
Signal Number (Long) |
- | - | Sends a signal to the specified process. The sending and receiving of signals is not guaranteed. |
24 | writeIo |
Writes a null-terminated string to the console. |
String Address (String Pointer) |
- | - | - | The string is printed to the console. |
25 | readIo |
Reads a line from standard input. | - | - | - | String Address (String pointer) | The string is read from standard input, but it allocates memory; make sure to deallocate memory once you're done with it. |
26 | createArray |
Creates a new array. |
Size (Long) |
- | - | Array Address (Long) | - |
27 | arraySet |
Sets an element in an array. |
Array Address (Long) |
Index (Long) |
Value (Long) |
- | Performs bounds checking. |
28 | arrayGet |
Gets an element from an array. |
Array Address (Long) |
Index (Long) |
- | Value (Long) | Performs bounds checking. |
Built with ❤️ & Kotlin
Getting Started
Assembly Language
Standard Library
- Standard Library Overview
- String Functions
- Array Functions
- Maths Functions
- Clean Functions
- I/O Functions
- System Functions
- Conversion Functions
System Calls
- System Call Overview
- File System Calls
- Process Management Calls
- IPC Calls
- Host OS Calls
- Other System Calls
Kernel + OS
Error Handling
Advanced Topics
Appendix
Project Information