exit on x64
terminate the calling thread
sys_exit(int error_code)
| number | 60 (0x3c) |
|---|---|
| abi | common |
| entry point | sys_exit |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | exit(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 60, the syscall number |
rdi | int error_code |
rax | the return value |
Then run syscall to enter the kernel.
The syscall instruction clobbers rcx (the return address lands in rcx) and r11 (the flags land in r11).
Since Linux 5.14 the kernel reads the syscall number from eax and ignores the upper 32 bits of rax. Older kernels fail with ENOSYS when those bits are not zero, and mov eax, N clears them, so it works on both.
Same syscall on other architectures
- x86 1
- arm64 93
- arm 1
- riscv64 93
- ia32 1
- x32 1073741884
- loongarch64 93
- ppc64 1
- ppc 1
- s390x 1
- mips64 5058
- mipsn32 6058
- mipso32 4001
- alpha 1
- arc 93
- blackfin 1, removed in 4.17
- cris 1, removed in 4.17
- csky 93
- frv 1, removed in 4.17
- hexagon 93
- ia64 1025, removed in 6.7
- m32r 1, removed in 4.17
- m68k 1
- metag 93, removed in 4.17
- microblaze 1
- mn10300 1, removed in 4.17
- nds32 93, removed in 5.18
- nios2 93
- openrisc 93
- parisc 1
- score 93, removed in 4.17
- sh 1
- sparc 1
- sparc64 1
- tilegx 93, removed in 4.17
- tilepro 93, removed in 4.17
- xtensa 118
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/exit