OSDN Git Service

(split) LDP man-pages の original/ を v3.30 に更新。
[linuxjm/LDP_man-pages.git] / original / man2 / kexec_load.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (C) 2010 Andi Kleen
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .TH KEXEC_LOAD 2 2010-10-31 "Linux" "Linux Programmer's Manual"
25 .SH NAME
26 kexec_load \- load a new kernel for later execution
27 .SH SYNOPSIS
28 .b #include <linux/kexec.h>
29 .br
30 .BI "long kexec_load(unsigned long " entry ", unsigned long " nr_segments ","
31 .br
32 .BI "                struct kexec_segment *" segments \
33 ", unsigned long " flags ");"
34 .SH DESCRIPTION
35 The
36 .BR kexec_load ()
37 system call loads a new kernel that can be executed later by
38 .BR reboot(2) .
39 .PP
40 The
41 .I flags
42 argument is a mask whose high-order bits control the operation of the call.
43 The following values can be specified in
44 .IR flags :
45 .TP
46 .B KEXEC_ON_CRASH
47 Execute the new kernel automatically on a system crash.
48 .\" FIXME figure out how this is really used
49 .TP
50 .B KEXEC_PRESERVE_CONTEXT
51 Preserve the system hardware and
52 software states before executing the new kernel.
53 This could be used for system suspend.
54 This flag is only available if the kernel was configured with
55 .BR CONFIG_KEXEC_JUMP ,
56 and is only effective if
57 .I nr_segments
58 is greater than 0.
59 .PP
60 The low-order bits of
61 .I flags
62 contain the architecture of the to-be-executed kernel.
63 Specify (OR) the constant
64 .B KEXEC_ARCH_DEFAULT
65 to use the current architecture,
66 or one of the following architecture constants
67 .BR KEXEC_ARCH_386 ,
68 .BR KEXEC_ARCH_X86_64 ,
69 .BR KEXEC_ARCH_PPC ,
70 .BR KEXEC_ARCH_PPC64 ,
71 .BR KEXEC_ARCH_IA_64 ,
72 .BR KEXEC_ARCH_ARM ,
73 .BR KEXEC_ARCH_S390 ,
74 .BR KEXEC_ARCH_SH ,
75 .BR KEXEC_ARCH_MIPS ,
76 and
77 .BR KEXEC_ARCH_MIPS_LE .
78 The architecture must be executable on the CPU of the system.
79
80 The
81 .I entry
82 argument is the physical entry address in the kernel image.
83 The
84 .I nr_segments
85 argument is the number of segments pointed to by the
86 .I segments
87 pointer.
88 The
89 .I segments
90 argument is an array of
91 .I kexec_segment
92 structures which define the kernel layout:
93 .in +4n
94 .nf
95
96 struct kexec_segment {
97     void   *buf;        /* Buffer in user space */
98     size_t  bufsz;      /* Buffer length in user space */
99     void   *mem;        /* Physical address of kernel */
100     size_t  memsz;      /* Physical address length */
101 };
102 .fi
103 .in
104 .PP
105 .\" FIXME elaborate on the following:
106 The kernel image defined by
107 .I segments
108 is copied from the calling process into previously reserved memory.
109 .SH RETURN VALUE
110 On success,
111 .BR kexec_load ()
112 returns 0.
113 On error, -1 is returned and
114 .I errno
115 is set to indicate the error.
116 .SH ERRORS
117 .TP
118 .B EBUSY
119 Another crash kernel is already being loaded
120 or a crash kernel is already in use.
121 .TP
122 .B EINVAL
123 .I flags
124 is invalid; of
125 .IR nr_segments is too large
126 .\" KEXEC_SEGMENT_MAX == 16
127 .TP
128 .B EPERM
129 The caller does not have the
130 .BR CAP_SYS_BOOT
131 capability.
132 .SH VERSIONS
133 The
134 .BR kexec_load ()
135 system call first appeared in Linux 2.6.7.
136 .SH CONFORMING TO
137 This system call is Linux-specific.
138 .SH NOTES
139 Currently, there is no glibc support for
140 .BR kexec_load ().
141 Call it using
142 .BR syscall (2).
143 .PP
144 The required constants are in the kernel source file
145 .IR linux/kexec.h ,
146 which is not currently exported to glibc.
147 .\" FIXME Andi submitted a patch for this.
148 .\" Check if it got accepted later.
149 Therefore, these constants must be defined manually.
150
151 This system call is only available if the kernel was configured with
152 .BR CONFIG_KEXEC .
153 .SH SEE ALSO
154 .BR reboot (2),
155 .BR syscall (2)