From 0bd8e0bf4985f49c55be03fb7f62f99bc47b5b0e Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Sun, 31 Oct 2010 06:56:47 +0100 Subject: [PATCH] kexec_load.2: New page documenting kexec_load(2) Signed-off-by: Michael Kerrisk --- man2/kexec_load.2 | 94 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 man2/kexec_load.2 diff --git a/man2/kexec_load.2 b/man2/kexec_load.2 new file mode 100644 index 000000000..f4866412b --- /dev/null +++ b/man2/kexec_load.2 @@ -0,0 +1,94 @@ +.TH KEXEC_LOAD 2 2010-06-16 "Linux" "Linux Programmer's Manual" +.SH NAME +kexec_load \- Load a new kernel for later execution. +.SH SYNOPSIS +.b #include +.br +.BI "long kexec_load(unsigned long " entry ", unsigned long " nr_segments "," +.br +.BI "struct kexec_segment *" segments ", unsigned long " flags ");" +.SH DESCRIPTION +.BR kexec_load +loads a new kernel that can be executed later +by +.I reboot(2). +An alternative approach is to specify +.B KEXEC_ON_CRASH +in the +.I flags +argument and then the new kernel will be automatically executed on a +system crash. +.\" XXX figure out how this is really used +With +.B KEXEC_PRESERVE_CONTEXT +specified in +.I flags +kexec will preserve the system hard and +software state before executing the kexec kernel. This +could be used for system suspend. + +.I flags +also contains the architecture of the executed kernel or +be +.I KEXEC_ARCH_DEFAULT +for the current architecture. +Valid architectures are +.I KEXEC_ARCH_I386, +.I KEXEC_ARCH_X86_64, +.I KEXEC_ARCH_PPC, +.I KEXEC_ARCH_PPC64, +.I KEXEC_ARCH_IA_64, +.I KEXEC_ARCH_ARM, +.I KEXEC_ARCH_S390, +.I KEXEC_ARCH_SH, +.I KEXEC_ARCH_MIPS, +.I KEXEC_ARCH_MIPS_LE. +The architecture must be executable on the CPU of the system. + +.I entry +is the virtual entry address in the kernel image. +.I nr_segments +is the number of segments pointed to by the +.I segments +pointer. +.I segments +is an array of +.I struct kexec_segment +structures which define the kernel layout: +.in +4n +.nf + +struct kexec_segment { + void *buf; /* Buffer in user space */ + size_t bufsz; /* Buffer length in user space */ + void *mem; /* Virtual address of kernel */ + size_t memsz; /* Virtual address length */ +}; +.fi +.in +.PP +.\" XXX elaborate on this +The kernel image defined by +.I segments +is copied from the calling process into previously reserved memory. +.SH CONFORMING TO +This system call is Linux-specific. +.SH NOTES +kexec_load is currently not defined in glibc. To call it use: +.in +4n +.nf +#define _GNU_SOURCE +#include +#include +#include + +ret = syscall(__NR_kexec_load, entry, nr_segments, segments, flags); +.fi +.in +.PP +.I linux/kexec.h as a exported header is only available in 2.6.38 +and later kernels, in earlier kernels the constants need to be copied +out of the kernel source. +.SH SEE ALSO +.BR syscall (2), +.BR reboot (2)