How to check syscall for x86_64?

I can not find a special official site to search for such information.

For example, if I want to do exit , how can I do this using syscall , introduced in x86_64?

Any guidance for this kind of detail?

I'm on Centos.

+4
source share
2 answers

Glibc sysdeps/unix/sysv/linux/x86_64/syscall.S , see if this helps.

+1
source

Let the C library do it for you:

 movl $0, %rdi # or whatever exit code you want (0-127) call _exit 

You really don't want to make system calls yourself. The C library isolates you from many low-level ABI problems (many system calls exist in more than one version, depending on which kernel you have, some of them do not require a real trap in supervisor mode, etc. ), he knows how to install errno , and he will choose the most efficient interrupt sequence for the architecture and kernel version.

+1
source

All Articles