splice on x64
splice data to/from a pipe
sys_splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags)
| number | 275 (0x113) |
|---|---|
| abi | common |
| entry point | sys_splice |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | splice(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 275, the syscall number |
rdi | int fd_in |
rsi | loff_t *off_in |
rdx | int fd_out |
r10 | loff_t *off_out |
r8 | size_t len |
r9 | unsigned int flags |
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 313
- arm64 76
- arm 340
- riscv64 76
- ia32 313
- x32 1073742099
- loongarch64 76
- ppc64 283
- ppc 283
- s390x 306
- mips64 5263
- mipsn32 6267
- mipso32 4304
- alpha 468
- arc 76
- blackfin 342, removed in 4.17
- cris 313, removed in 4.17
- csky 76
- frv 313, removed in 4.17
- hexagon 76
- ia64 1297, removed in 6.7
- m32r 313, removed in 4.17
- m68k 306
- metag 76, removed in 4.17
- microblaze 313
- mn10300 314, removed in 4.17
- nds32 76, removed in 5.18
- nios2 76
- openrisc 76
- parisc 291
- score 76, removed in 4.17
- sh 313
- sparc 232
- sparc64 232
- tilegx 76, removed in 4.17
- tilepro 76, removed in 4.17
- xtensa 268
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/splice