symlinkat on x64
make a new name for a file
sys_symlinkat(const char *oldname, int newdfd, const char *newname)
| number | 266 (0x10a) |
|---|---|
| abi | common |
| entry point | sys_symlinkat |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | symlinkat(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 266, the syscall number |
rdi | const char *oldname |
rsi | int newdfd |
rdx | const char *newname |
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 304
- arm64 36
- arm 331
- riscv64 36
- ia32 304
- x32 1073742090
- loongarch64 36
- ppc64 295
- ppc 295
- s390x 297
- mips64 5256
- mipsn32 6260
- mipso32 4297
- alpha 459
- arc 36
- blackfin 304, removed in 4.17
- cris 304, removed in 4.17
- csky 36
- frv 304, removed in 4.17
- hexagon 36
- ia64 1290, removed in 6.7
- m32r 304, removed in 4.17
- m68k 297
- metag 36, removed in 4.17
- microblaze 304
- mn10300 305, removed in 4.17
- nds32 36, removed in 5.18
- nios2 36
- openrisc 36
- parisc 284
- score 36, removed in 4.17
- sh 304
- sparc 293
- sparc64 293
- tilegx 36, removed in 4.17
- tilepro 36, removed in 4.17
- xtensa 294
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/symlinkat