Content
    Intel x86-64

Linux System Calls

A system call is the basic interface between applications and the kernel.

Linux has more than 300 system calls.

The syscalls are implemented by the syscall function.

Intel x86-64

System calls use the default calling convention (System V AMD64 ABI).

Stack based arguments are not used. This limits the number of arguments to 6.

Each system call has an unique call code. The call code are provided in the rax register.

Call codes and arguments can be found here.

Registers

The registers are only used when needed.

The call code is necessary.

RegisterUsage
raxCall code, return value after call
rdi1st argument
rsi2nd argument
rdx3rd argument
rcx4th argument
r85th argument
r96th argument

SYSCALL Instruction

After the call code and the arguments are placed in the registers the syscall instruction is executed. Then the current process will pause and control is passed to the kernel. When the system call returns the process will be resumed.



  • Category

  • Programming

  • Tags

  • Assembler
    Computer Science
    OS
    Linux

  • Created

  • 6. November 2017


  • Modified

  • 13. May 2022