membarrier on x64
issue memory barriers on a set of threads
sys_membarrier(int cmd, unsigned int flags, int cpu_id)
| number | 324 (0x144) |
|---|---|
| abi | common |
| entry point | sys_membarrier |
| since | Linux 4.3 |
| man page | membarrier(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 324, the syscall number |
rdi | int cmd |
rsi | unsigned int flags |
rdx | int cpu_id |
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 375
- arm64 283
- arm 389
- riscv64 283
- ia32 375
- x32 1073742148
- loongarch64 283
- ppc64 365
- ppc 365
- s390x 356
- mips64 5318
- mipsn32 6322
- mipso32 4358
- alpha 517
- arc 283
- csky 283
- hexagon 283
- ia64 1344, removed in 6.7
- m68k 374
- metag 283, removed in 4.17
- microblaze 390
- nds32 283, removed in 5.18
- nios2 283
- openrisc 283
- parisc 343
- score 283, removed in 4.17
- sh 378
- sparc 351
- sparc64 351
- tilegx 283, removed in 4.17
- tilepro 283, removed in 4.17
- xtensa 343
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/membarrier