mkdirat on x64
create a directory
sys_mkdirat(int dfd, const char *pathname, umode_t mode)
| number | 258 (0x102) |
|---|---|
| abi | common |
| entry point | sys_mkdirat |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | mkdirat(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 258, the syscall number |
rdi | int dfd |
rsi | const char *pathname |
rdx | umode_t mode |
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 296
- arm64 34
- arm 323
- riscv64 34
- ia32 296
- x32 1073742082
- loongarch64 34
- ppc64 287
- ppc 287
- s390x 289
- mips64 5248
- mipsn32 6252
- mipso32 4289
- alpha 451
- arc 34
- blackfin 296, removed in 4.17
- cris 296, removed in 4.17
- csky 34
- frv 296, removed in 4.17
- hexagon 34
- ia64 1282, removed in 6.7
- m32r 296, removed in 4.17
- m68k 289
- metag 34, removed in 4.17
- microblaze 296
- mn10300 297, removed in 4.17
- nds32 34, removed in 5.18
- nios2 34
- openrisc 34
- parisc 276
- score 34, removed in 4.17
- sh 296
- sparc 285
- sparc64 285
- tilegx 34, removed in 4.17
- tilepro 34, removed in 4.17
- xtensa 289
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/mkdirat