Syscall ABI
The InstantOS system-call convention and the instantos stdlib modules.
InstantOS uses its own syscall register convention. @syscall(num, a1..a5) on the x86_64_instantos target lowers to:
| Register | Meaning |
|---|---|
rax | syscall number |
rbx | arg 1 |
r10 | arg 2 |
rdx | arg 3 |
r8 | arg 4 |
r9 | arg 5 |
The result comes back in rax. (This differs from Linux, which uses rdi/rsi/rdx/r10/r8/r9.)
Use the stdlib wrappers
Rather than raw @syscall, use the instantos modules:
module main
import instantos::io
fun main() -> i32 {
io.println("hello from InstantOS")
return 0
} instantos::sys—exit,write,read,open,close,getpid,seek,yield_now,sleep_ms, plusnr_*()syscall-number accessors.instantos::io—print,println,print_int,read_stdin.instantos::mem—map,map_rw,unmap,protect.
Next: building for InstantOS.