All the system calls are referenced here. You can find the most useful ones down below.
The register “rax” is where the system call’s value is stored. The next ones (rdi, rsi,…) are arguments (optionals?).
In short, to invoke a system call, you need to set first the registers to their values, then put the line “syscall”.
| NR | syscall name | %rax | %rdi | %rsi | %rdx |
|---|---|---|---|---|---|
| 1 | write | 0x01 | unsigned int fd (file descriptor) | const char *buf | size_t_count |
| 60 | exit | 0x3c | int error_code | ||
write %rdi
The file descriptor can take 3 values : 0, 1 or 2. 0 for standard input, 1 for standard output and 2 for standard error.