msync on x64
synchronize a file with a memory map
sys_msync(unsigned long start, size_t len, int flags)
| number | 26 (0x1a) |
|---|---|
| abi | common |
| entry point | sys_msync |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | msync(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 26, the syscall number |
rdi | unsigned long start |
rsi | size_t len |
rdx | 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 144
- arm64 227
- arm 144
- riscv64 227
- ia32 144
- x32 1073741850
- loongarch64 227
- ppc64 144
- ppc 144
- s390x 144
- mips64 5025
- mipsn32 6025
- mipso32 4144
- alpha 217
- arc 227
- cris 144, removed in 4.17
- csky 227
- frv 144, removed in 4.17
- hexagon 227
- ia64 1157, removed in 6.7
- m32r 144, removed in 4.17
- m68k 144
- metag 227, removed in 4.17
- microblaze 144
- mn10300 144, removed in 4.17
- nds32 227, removed in 5.18
- nios2 227
- openrisc 227
- parisc 144
- score 227, removed in 4.17
- sh 144
- sparc 65
- sparc64 65
- tilegx 227, removed in 4.17
- tilepro 227, removed in 4.17
- xtensa 89
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/msync