settimeofday on x64
get / set time
sys_settimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
| number | 164 (0xa4) |
|---|---|
| abi | common |
| entry point | sys_settimeofday |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | settimeofday(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 164, the syscall number |
rdi | struct __kernel_old_timeval *tv |
rsi | struct timezone *tz |
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 79
- arm64 170
- arm 79
- riscv64 170
- ia32 79
- x32 1073741988
- loongarch64 170
- ppc64 79
- ppc 79
- s390x 79
- mips64 5159
- mipsn32 6159
- mipso32 4079
- alpha 360
- arc 170
- blackfin 79, removed in 4.17
- cris 79, removed in 4.17
- csky 170
- frv 79, removed in 4.17
- hexagon 170
- ia64 1088, removed in 6.7
- m32r 79, removed in 4.17
- m68k 79
- metag 170, removed in 4.17
- microblaze 79
- mn10300 79, removed in 4.17
- nds32 170, removed in 5.18
- nios2 170
- openrisc 170
- parisc 79
- score 170, removed in 4.17
- sh 79
- sparc 122
- sparc64 122
- tilegx 170, removed in 4.17
- tilepro 170, removed in 4.17
- xtensa 193
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/settimeofday