kexec: kexec.x86_64
PATCH 10/14 kexec: kexec.x86_64
Here is the kexec implementation for x86_64
arch/x86_64/Kconfig +17 -0
@@ -401,6 +401,23 @@ depends on IA32_EMULATION default y +config KEXEC + bool "kexec system call (EXPERIMENTAL)" + depends on EXPERIMENTAL + help + kexec is a system call that implements the ability to shutdown your + current kernel, and to start another kernel. It is like a reboot + but it is indepedent of the system firmware. And like a reboot + you can start any kernel with it, not just Linux. + + The name comes from the similiarity to the exec system call. + + It is an ongoing process to be certain the hardware in a machine + is properly shutdown, so do not be surprised if this code does not + initially work for you. It may help to enable device hotplugging + support. As of this writing the exact hardware interface is + strongly in flux, so no good recommendation can be made. + endmenu source drivers/Kconfig
arch/x86_64/kernel/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_SMP) += smp.o smpboot.o trampoline.o obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o obj-$(CONFIG_X86_IO_APIC) += io_apic.o mpparse.o +obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o obj-$(CONFIG_PM) += suspend.o obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend_asm.o obj-$(CONFIG_CPU_FREQ) += cpufreq/
arch/x86_64/kernel/machine_kexec.c +246 -0
246 lines not on this page · raw message
arch/x86_64/kernel/relocate_kernel.S +141 -0
141 lines not on this page · raw message
include/asm-x86_64/kexec.h +25 -0
@@ -0,0 +1,25 @@ +#ifndef _X86_64_KEXEC_H +#define _X86_64_KEXEC_H + +#include <asm/page.h> +#include <asm/proto.h> + +/* +* KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. +* I.e. Maximum page that is mapped directly into kernel memory, +* and kmap is not required. +* +* So far x86_64 is limited to 40 physical address bits. +*/ + +/* Maximum physical address we can use pages from */ +#define KEXEC_SOURCE_MEMORY_LIMIT (0xFFFFFFFFFFUL) +/* Maximum address we can reach in physical address mode */ +#define KEXEC_DESTINATION_MEMORY_LIMIT (0xFFFFFFFFFFUL) +/* Maximum address we can use for the control pages */ +#define KEXEC_CONTROL_MEMORY_LIMIT (0xFFFFFFFFFFUL) + +/* Allocate one page for the pdp and the second for the code */ +#define KEXEC_CONTROL_CODE_SIZE (4096UL + 4096UL) + +#endif /* _X86_64_KEXEC_H */
include/asm-x86_64/unistd.h +1 -1
@@ -553,7 +553,7 @@#define __NR_mq_getsetattr 245 __SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr)#define __NR_kexec_load 246 -__SYSCALL(__NR_kexec_load, sys_ni_syscall) +__SYSCALL(__NR_kexec_load, sys_kexec_load)#define __NR_perfctr_info 247 __SYSCALL(__NR_perfctr_info, sys_perfctr_info)#define __NR_vperfctr_open (__NR_perfctr_info+1)