kexec_file_load on x64
load a new kernel for later execution
sys_kexec_file_load(int kernel_fd, int initrd_fd, unsigned long cmdline_len, const char *cmdline_ptr, unsigned long flags)
| number | 320 (0x140) |
|---|---|
| abi | common |
| kconfig | CONFIG_KEXEC_FILE |
| entry point | sys_kexec_file_load |
| since | Linux 3.17 |
| man page | kexec_file_load(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 320, the syscall number |
rdi | int kernel_fd |
rsi | int initrd_fd |
rdx | unsigned long cmdline_len |
r10 | const char *cmdline_ptr |
r8 | 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
- arm64 294
- arm 401
- riscv64 294
- x32 1073742144
- loongarch64 294
- ppc64 382
- ppc 382
- s390x 381
- arc 294
- csky 294
- hexagon 294
- nds32 294, removed in 5.18
- nios2 294
- openrisc 294
- parisc 355
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/kexec_file_load