Let the C library do it for you:
movl $0, %rdi
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.
source share