semop on x64
System V semaphore operations
sys_semop(int semid, struct sembuf *sops, unsigned nsops)
| number | 65 (0x41) |
|---|---|
| abi | common |
| kconfig | CONFIG_SYSVIPC |
| family | sysvipc see the whole family on x64 |
| entry point | sys_semop |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | semop(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 65, the syscall number |
rdi | int semid |
rsi | struct sembuf *sops |
rdx | unsigned nsops |
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
- arm64 193
- arm 298
- riscv64 193
- x32 1073741889
- loongarch64 193
- mips64 5063
- mipsn32 6063
- alpha 206
- arc 193
- blackfin 333, removed in 4.17
- csky 193
- hexagon 193
- ia64 1107, removed in 6.7
- metag 193, removed in 4.17
- microblaze 330
- nds32 193, removed in 5.18
- nios2 193
- openrisc 193
- parisc 185
- score 193, removed in 4.17
- tilegx 193, removed in 4.17
- tilepro 193, removed in 4.17
- xtensa 163
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/semop