kexec_load on x64
load a new kernel for later execution
sys_kexec_load(unsigned long entry, unsigned long nr_segments, struct kexec_segment *segments, unsigned long flags)
| number | 246 (0xf6) |
|---|---|
| abi | 64 |
| kconfig | CONFIG_KEXEC |
| entry point | sys_kexec_load |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | kexec_load(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 246, the syscall number |
rdi | unsigned long entry |
rsi | unsigned long nr_segments |
rdx | struct kexec_segment *segments |
r10 | 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 283
- arm64 104
- arm 347
- riscv64 104
- ia32 283
- x32 1073742352
- loongarch64 104
- ppc64 268
- ppc 268
- s390x 277
- mips64 5270
- mipsn32 6274
- mipso32 4311
- alpha 448
- arc 104
- csky 104
- hexagon 104
- ia64 1268, removed in 6.7
- m68k 313
- metag 104, removed in 4.17
- microblaze 283
- mn10300 283, removed in 4.17
- nds32 104, removed in 5.18
- nios2 104
- openrisc 104
- parisc 300
- score 104, removed in 4.17
- sh 283
- sparc 306
- sparc64 306
- tilegx 104, removed in 4.17
- tilepro 104, removed in 4.17
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/kexec_load