Skip to main content

Syscall ABI

Sinux follows the Linux x86_64 ABI for system calls. Arguments are passed in registers and the syscall number goes in RAX.

RegisterRole
RAXsyscall number
RDIarg 1
RSIarg 2
RDXarg 3
R10arg 4
R8arg 5
R9arg 6
RAXreturn value
tip

Because the register convention matches Linux, userspace code written against the Linux x86_64 calling convention can issue syscalls in the same way — though only the supported syscall numbers are implemented.

A userspace program issues a syscall with the syscall instruction after loading the appropriate registers. The kernel's dispatch table (in kernel/syscall/) routes the call to the correct handler.