OSDN Git Service

5c0310192ac85a7b8d67841eb24b2864f0e16c01
[linuxjm/LDP_man-pages.git] / original / man2 / kexec_load.2
1 .\" Copyright (C) 2010 Intel Corporation
2 .\" Author: Andi Kleen
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
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 .\" %%%LICENSE_END
25 .\"
26 .TH KEXEC_LOAD 2 2012-07-13 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 kexec_load \- load a new kernel for later execution
29 .SH SYNOPSIS
30 .B #include <linux/kexec.h>
31 .br
32 .BI "long kexec_load(unsigned long " entry ", unsigned long " nr_segments ","
33 .br
34 .BI "                struct kexec_segment *" segments \
35 ", unsigned long " flags ");"
36
37 .IR Note :
38 There is no glibc wrapper for this system call; see NOTES.
39 .SH DESCRIPTION
40 The
41 .BR kexec_load ()
42 system call loads a new kernel that can be executed later by
43 .BR reboot (2).
44 .PP
45 The
46 .I flags
47 argument is a mask whose high-order bits control the operation of the call.
48 The following values can be specified in
49 .IR flags :
50 .TP
51 .BR KEXEC_ON_CRASH " (since Linux 2.6.13)"
52 Execute the new kernel automatically on a system crash.
53 .\" FIXME figure out how this is really used
54 .TP
55 .BR KEXEC_PRESERVE_CONTEXT " (since Linux 2.6.27)"
56 Preserve the system hardware and
57 software states before executing the new kernel.
58 This could be used for system suspend.
59 This flag is available only if the kernel was configured with
60 .BR CONFIG_KEXEC_JUMP ,
61 and is effective only if
62 .I nr_segments
63 is greater than 0.
64 .PP
65 The low-order bits of
66 .I flags
67 contain the architecture of the to-be-executed kernel.
68 Specify (OR) the constant
69 .B KEXEC_ARCH_DEFAULT
70 to use the current architecture,
71 or one of the following architecture constants
72 .BR KEXEC_ARCH_386 ,
73 .BR KEXEC_ARCH_X86_64 ,
74 .BR KEXEC_ARCH_PPC ,
75 .BR KEXEC_ARCH_PPC64 ,
76 .BR KEXEC_ARCH_IA_64 ,
77 .BR KEXEC_ARCH_ARM ,
78 .BR KEXEC_ARCH_S390 ,
79 .BR KEXEC_ARCH_SH ,
80 .BR KEXEC_ARCH_MIPS ,
81 and
82 .BR KEXEC_ARCH_MIPS_LE .
83 The architecture must be executable on the CPU of the system.
84
85 The
86 .I entry
87 argument is the physical entry address in the kernel image.
88 The
89 .I nr_segments
90 argument is the number of segments pointed to by the
91 .I segments
92 pointer.
93 The
94 .I segments
95 argument is an array of
96 .I kexec_segment
97 structures which define the kernel layout:
98 .in +4n
99 .nf
100
101 struct kexec_segment {
102     void   *buf;        /* Buffer in user space */
103     size_t  bufsz;      /* Buffer length in user space */
104     void   *mem;        /* Physical address of kernel */
105     size_t  memsz;      /* Physical address length */
106 };
107 .fi
108 .in
109 .PP
110 .\" FIXME elaborate on the following:
111 The kernel image defined by
112 .I segments
113 is copied from the calling process into previously reserved memory.
114 .SH RETURN VALUE
115 On success,
116 .BR kexec_load ()
117 returns 0.
118 On error, \-1 is returned and
119 .I errno
120 is set to indicate the error.
121 .SH ERRORS
122 .TP
123 .B EBUSY
124 Another crash kernel is already being loaded
125 or a crash kernel is already in use.
126 .TP
127 .B EINVAL
128 .I flags
129 is invalid; or
130 .IR nr_segments
131 is too large
132 .\" KEXEC_SEGMENT_MAX == 16
133 .TP
134 .B EPERM
135 The caller does not have the
136 .BR CAP_SYS_BOOT
137 capability.
138 .SH VERSIONS
139 The
140 .BR kexec_load ()
141 system call first appeared in Linux 2.6.13.
142 .SH CONFORMING TO
143 This system call is Linux-specific.
144 .SH NOTES
145 Currently, there is no glibc support for
146 .BR kexec_load ().
147 Call it using
148 .BR syscall (2).
149 .PP
150 The required constants are in the Linux kernel source file
151 .IR linux/kexec.h ,
152 which is not currently exported to glibc.
153 .\" FIXME Andi submitted a patch for this.
154 .\" Check if it got accepted later.
155 Therefore, these constants must be defined manually.
156
157 This system call is available only if the kernel was configured with
158 .BR CONFIG_KEXEC .
159 .SH SEE ALSO
160 .BR reboot (2),
161 .BR syscall (2)
162 .SH COLOPHON
163 This page is part of release 3.67 of the Linux
164 .I man-pages
165 project.
166 A description of the project,
167 information about reporting bugs,
168 and the latest version of this page,
169 can be found at
170 \%http://www.kernel.org/doc/man\-pages/.