System calls #
Helios supports a small number of system calls, which are documented in their respective pages — consult the site navigation on the left. Helios is a non-preemptable kernel, so a given CPU will not context-switch while executing a syscall or interrupt. The system uses one kernel stack per CPU.
System call ABI #
The Application Binary Interface (ABI) for syscalls varies depending on architecture. Each architecture has a minimum of one register to identify the syscall number to execute, and one return register. Additional registers may be used for passing arguments or returning values. Any arguments which do not fit into the available registers are stored in the IPC buffer (TODO: link).
Each system call has two return values: a status value and an additional value. The status value is zero if no error occured, or non-zero if an error occured. The additional value provides additional information (if useful for that syscall) in the case of success, or additional details about the error in the case of an error. Additional error information may be placed into the IPC buffer if necessary.
- %rax: system call number
- %rdi: 1st argument
- %rsi: 2nd argument
- %rdx: 3rd argument
- %rcx: 4th argument
- %r8: 5th argument
- %r9: 6th argument
- %rax: 1st return value; status code
- %rdx: 2nd return value; additional info
%r10, %r11, and %rcx are destroyed.
- uintptr: 64-bit address, virtual or physical
- size: 64-bit unsigned integer
- caddr: 32-bit unsigned integer, capability address
Error handling #
The first return register is used to provide the result of a syscall. The error codes and their meanings are as follows:
||No error occured; the operation completed successfully.|
||Insufficient resources are available.|
||A provided address exceeded the range of a cspace.|
||A provided capability slot was not valid, for instance because it is not empty.|
||A provided capability has a type which is not compatible with the requested operation.|
||An invalid parameter or combination of parameters was provided.|
||An invalid capability or combination of parameters was provided.|
||The requested operation is not supported by this kernel version.|
||A page table required to complete a virtual memory mapping is not present.|
||The user attempted to map the same page or page table capability twice.|
||A virtual memory operation was attempted on a vspace capabillity without a valid ASID.|
||The user does not possess the necessary permissions to complete the requested operation.|
||The subject of an operation was destroyed while it was being performed.|
||Non-blocking operation was requested, but is not available.|
The documentation for each syscall or capability invocation clarifies the meaning of each status code as it relates to the requested operation.