Linux programs interact with the operating system and its resources (specifically, by asking the OS to do some service for the program), such as writing content to a file or checking the current time, using the
syscall NASM instruction.
Before calling
syscall, we first prepare the necessary data (service/syscall number, and arguments) for the call to run correctly: we put the syscall number inside the rax register, and the arguments inside the following registers: rdi, rsi, rdx, r10, r8, and r9 (in this order).
This means that we can call any OS service (function/syscall) that needs up to $6$ arguments. Most OS syscalls, however, usually use much fewer than $6$ argument (the average number of arguments is $1$ to $3$ arguments.)
NASM Linux syscalls are easy to understand using code of the C language. On the next slides, we will see examples of Linux syscalls written in C, and their easy translation into NASM.