That is, how do you know
how many parameters a specific syscall expects,
which register each parameter should be in,
and finally what each parameter means?
Is there a man
alike command to tell you that?
syscall is an instruction in x86-64, and is used as part of the ABI for making system calls. (The 32-bit ABI uses int 80h or sysenter , and is also available in 64-bit mode, but using the 32-bit ABI from 64-bit code is a bad idea, especially for calls with pointer arguments.)
The exit syscall is number 60 .
Solved using the following approach: The system call table is located in arch/x86/syscalls/syscall_32. tbl for the x86 architecture.
syscall(2) is a glibc wrapper function for system calls, and the syscall man page also documents is asm ABI for various Linux platforms (x86-64, SPARC, ARM, etc.), including registers for the call number and ret val, and the instruction for entering the kernel.
see also: What are the calling conventions for UNIX & Linux system calls on x86-64
What you are looking for is the kernel ABI, I can't find the official site, but there is a blog with info like this.
In x64 with int 80h call, it is:
value storage
syscall nr rax
arg 1 rdi
arg 2 rsi
arg 3 rdx
arg 4 r10
arg 5 r9
arg 6 r8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With