bind on x64
bind a name to a socket
sys_bind(int fd, struct sockaddr *umyaddr, int addrlen)
| number | 49 (0x31) |
|---|---|
| abi | common |
| entry point | sys_bind |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | bind(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 49, the syscall number |
rdi | int fd |
rsi | struct sockaddr *umyaddr |
rdx | int addrlen |
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 361
- arm64 200
- arm 282
- riscv64 200
- ia32 361
- x32 1073741873
- loongarch64 200
- ppc64 327
- ppc 327
- s390x 361
- mips64 5048
- mipsn32 6048
- mipso32 4169
- alpha 104
- arc 200
- blackfin 315, removed in 4.17
- csky 200
- hexagon 200
- ia64 1191, removed in 6.7
- m68k 358
- metag 200, removed in 4.17
- microblaze 347
- nds32 200, removed in 5.18
- nios2 200
- openrisc 200
- parisc 22
- score 200, removed in 4.17
- sh 341
- sparc 353
- sparc64 353
- tilegx 200, removed in 4.17
- tilepro 200, removed in 4.17
- xtensa 100
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/bind