问题
I can't find a dedicated official website to search for such information .
For example,if I want to do exit,how should I do it with syscall introduced in x86_64?
Any manual for this kind of details?
I'm on Centos.
回答1:
Glibc sysdeps/unix/sysv/linux/x86_64/syscall.S, see if this helps.
回答2:
Let the C library do it for you:
movl $0, %rdi # or whatever exit code you want (0-127)
call _exit
You really do not want to make system calls yourself. The C library insulates you from a bunch of low-level ABI issues (many system calls exist in more than one version, depending on exactly which kernel you have; some of them don't require an actual trap into supervisor mode; etc), it knows how to set errno, and it will pick the most efficient trap sequence for the architecture and kernel version.
来源:https://stackoverflow.com/questions/6537828/how-do-you-check-syscall-for-x86-64