remap_file_pages on x64
create a nonlinear file mapping
sys_remap_file_pages(unsigned long start, unsigned long size, unsigned long prot, unsigned long pgoff, unsigned long flags)
| number | 216 (0xd8) |
|---|---|
| abi | common |
| entry point | sys_remap_file_pages |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | remap_file_pages(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 216, the syscall number |
rdi | unsigned long start |
rsi | unsigned long size |
rdx | unsigned long prot |
r10 | unsigned long pgoff |
r8 | unsigned long 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 257
- arm64 234
- arm 253
- riscv64 234
- ia32 257
- x32 1073742040
- loongarch64 234
- ppc64 239
- ppc 239
- s390x 267
- mips64 5210
- mipsn32 6210
- mipso32 4251
- alpha 410
- arc 234
- cris 257, removed in 4.17
- csky 234
- frv 257, removed in 4.17
- hexagon 234
- ia64 1125, removed in 6.7
- m32r 257, removed in 4.17
- m68k 252
- metag 234, removed in 4.17
- microblaze 257
- mn10300 257, removed in 4.17
- nds32 234, removed in 5.18
- nios2 234
- openrisc 234
- parisc 227
- score 234, removed in 4.17
- sh 257
- sparc 192
- sparc64 192
- tilegx 234, removed in 4.17
- tilepro 234, removed in 4.17
- xtensa 261
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/remap_file_pages