-
Notifications
You must be signed in to change notification settings - Fork 0
System Calls
System calls provide a mechanism for MVM (Micro Virtual Machine) programs to request services from the operating system
(kernel).
All system calls use the stack for arguments and return values.
The system call ID is passed in register S1.
The system calls are categorised for clarity:
These system calls interact with the virtual file system (VFS):
-
newFile: Creates a new file. -
readFile: Reads data from a file. -
writeFile: Writes data to a file. -
deleteFile: Deletes a file or directory.
Very UNSTABLE!
These system calls manage processes within the MVM:
-
exec: Executes a new program from the host operating system. -
fork: Creates a child process (a copy of the current process). -
spawn: Creates a new process and runs a program file. -
exit: Terminates the current process. -
getpid: Gets the process ID of the current process. -
getuid: Gets the user ID of the current process. -
handleSignals: Registers a signal handler for the process. -
sendSignal: Sends a signal to another process. -
pause_t: Pauses a specified process. -
continue_t: Resumes a paused process.
Very UNSTABLE! These system calls provide inter-process communication (IPC):
-
share_m: Establishes a shared memory region between two processes. -
send: Sends a message to another process using message passing. -
receive: Receives a message from another process.
These system calls interact with the host operating system:
-
time: Gets the current system time.
These system calls provide other miscellaneous functionality:
-
writeIo: Writes a null-terminated string to standard output. -
readIo: Reads a line from standard input. -
createArray: Creates a new array. -
arraySet: Sets an array element. -
arrayGet: Gets an array element.
System calls are invoked using the syscall instruction.
The system call ID (SystemCallID) is in register S1.
Arguments are passed in S2, S3, and S4.
Return values (if any) are stored in R2
lit S1 14 // Load system call ID 14 (time) into S1
syscall // Make the system callFor a detailed list of system calls, their arguments, return values, and notes, refer to the System Call Table. This overview explains the purpose and organisation of the MVM system calls.
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