Loading...
1/* SPDX-License-Identifier: MIT */
2/******************************************************************************
3 * elfnote.h
4 *
5 * Definitions used for the Xen ELF notes.
6 *
7 * Copyright (c) 2006, Ian Campbell, XenSource Ltd.
8 */
9
10#ifndef __XEN_PUBLIC_ELFNOTE_H__
11#define __XEN_PUBLIC_ELFNOTE_H__
12
13/*
14 * `incontents 200 elfnotes ELF notes
15 *
16 * The notes should live in a PT_NOTE segment and have "Xen" in the
17 * name field.
18 *
19 * Numeric types are either 4 or 8 bytes depending on the content of
20 * the desc field.
21 *
22 * LEGACY indicated the fields in the legacy __xen_guest string which
23 * this a note type replaces.
24 *
25 * String values (for non-legacy) are NULL terminated ASCII, also known
26 * as ASCIZ type.
27 *
28 * Xen only uses ELF Notes contained in x86 binaries.
29 */
30
31/*
32 * NAME=VALUE pair (string).
33 */
34#define XEN_ELFNOTE_INFO 0
35
36/*
37 * The virtual address of the entry point (numeric).
38 *
39 * LEGACY: VIRT_ENTRY
40 */
41#define XEN_ELFNOTE_ENTRY 1
42
43/* The virtual address of the hypercall transfer page (numeric).
44 *
45 * LEGACY: HYPERCALL_PAGE. (n.b. legacy value is a physical page
46 * number not a virtual address)
47 */
48#define XEN_ELFNOTE_HYPERCALL_PAGE 2
49
50/* The virtual address where the kernel image should be mapped (numeric).
51 *
52 * Defaults to 0.
53 *
54 * LEGACY: VIRT_BASE
55 */
56#define XEN_ELFNOTE_VIRT_BASE 3
57
58/*
59 * The offset of the ELF paddr field from the actual required
60 * pseudo-physical address (numeric).
61 *
62 * This is used to maintain backwards compatibility with older kernels
63 * which wrote __PAGE_OFFSET into that field. This field defaults to 0
64 * if not present.
65 *
66 * LEGACY: ELF_PADDR_OFFSET. (n.b. legacy default is VIRT_BASE)
67 */
68#define XEN_ELFNOTE_PADDR_OFFSET 4
69
70/*
71 * The version of Xen that we work with (string).
72 *
73 * LEGACY: XEN_VER
74 */
75#define XEN_ELFNOTE_XEN_VERSION 5
76
77/*
78 * The name of the guest operating system (string).
79 *
80 * LEGACY: GUEST_OS
81 */
82#define XEN_ELFNOTE_GUEST_OS 6
83
84/*
85 * The version of the guest operating system (string).
86 *
87 * LEGACY: GUEST_VER
88 */
89#define XEN_ELFNOTE_GUEST_VERSION 7
90
91/*
92 * The loader type (string).
93 *
94 * LEGACY: LOADER
95 */
96#define XEN_ELFNOTE_LOADER 8
97
98/*
99 * The kernel supports PAE (x86/32 only, string = "yes", "no" or
100 * "bimodal").
101 *
102 * For compatibility with Xen 3.0.3 and earlier the "bimodal" setting
103 * may be given as "yes,bimodal" which will cause older Xen to treat
104 * this kernel as PAE.
105 *
106 * LEGACY: PAE (n.b. The legacy interface included a provision to
107 * indicate 'extended-cr3' support allowing L3 page tables to be
108 * placed above 4G. It is assumed that any kernel new enough to use
109 * these ELF notes will include this and therefore "yes" here is
110 * equivalent to "yes[entended-cr3]" in the __xen_guest interface.
111 */
112#define XEN_ELFNOTE_PAE_MODE 9
113
114/*
115 * The features supported/required by this kernel (string).
116 *
117 * The string must consist of a list of feature names (as given in
118 * features.h, without the "XENFEAT_" prefix) separated by '|'
119 * characters. If a feature is required for the kernel to function
120 * then the feature name must be preceded by a '!' character.
121 *
122 * LEGACY: FEATURES
123 */
124#define XEN_ELFNOTE_FEATURES 10
125
126/*
127 * The kernel requires the symbol table to be loaded (string = "yes" or "no")
128 * LEGACY: BSD_SYMTAB (n.b. The legacy treated the presence or absence
129 * of this string as a boolean flag rather than requiring "yes" or
130 * "no".
131 */
132#define XEN_ELFNOTE_BSD_SYMTAB 11
133
134/*
135 * The lowest address the hypervisor hole can begin at (numeric).
136 *
137 * This must not be set higher than HYPERVISOR_VIRT_START. Its presence
138 * also indicates to the hypervisor that the kernel can deal with the
139 * hole starting at a higher address.
140 */
141#define XEN_ELFNOTE_HV_START_LOW 12
142
143/*
144 * List of maddr_t-sized mask/value pairs describing how to recognize
145 * (non-present) L1 page table entries carrying valid MFNs (numeric).
146 */
147#define XEN_ELFNOTE_L1_MFN_VALID 13
148
149/*
150 * Whether or not the guest supports cooperative suspend cancellation.
151 * This is a numeric value.
152 *
153 * Default is 0
154 */
155#define XEN_ELFNOTE_SUSPEND_CANCEL 14
156
157/*
158 * The (non-default) location the initial phys-to-machine map should be
159 * placed at by the hypervisor (Dom0) or the tools (DomU).
160 * The kernel must be prepared for this mapping to be established using
161 * large pages, despite such otherwise not being available to guests. Note
162 * that these large pages may be misaligned in PFN space (they'll obviously
163 * be aligned in MFN and virtual address spaces).
164 * The kernel must also be able to handle the page table pages used for
165 * this mapping not being accessible through the initial mapping.
166 * (Only x86-64 supports this at present.)
167 */
168#define XEN_ELFNOTE_INIT_P2M 15
169
170/*
171 * Whether or not the guest can deal with being passed an initrd not
172 * mapped through its initial page tables.
173 */
174#define XEN_ELFNOTE_MOD_START_PFN 16
175
176/*
177 * The features supported by this kernel (numeric).
178 *
179 * Other than XEN_ELFNOTE_FEATURES on pre-4.2 Xen, this note allows a
180 * kernel to specify support for features that older hypervisors don't
181 * know about. The set of features 4.2 and newer hypervisors will
182 * consider supported by the kernel is the combination of the sets
183 * specified through this and the string note.
184 *
185 * LEGACY: FEATURES
186 */
187#define XEN_ELFNOTE_SUPPORTED_FEATURES 17
188
189/*
190 * Physical entry point into the kernel.
191 *
192 * 32bit entry point into the kernel. When requested to launch the
193 * guest kernel in a HVM container, Xen will use this entry point to
194 * launch the guest in 32bit protected mode with paging disabled.
195 * Ignored otherwise.
196 */
197#define XEN_ELFNOTE_PHYS32_ENTRY 18
198
199/*
200 * Physical loading constraints for PVH kernels
201 *
202 * The presence of this note indicates the kernel supports relocating itself.
203 *
204 * The note may include up to three 32bit values to place constraints on the
205 * guest physical loading addresses and alignment for a PVH kernel. Values
206 * are read in the following order:
207 * - a required start alignment (default 0x200000)
208 * - a minimum address for the start of the image (default 0; see below)
209 * - a maximum address for the last byte of the image (default 0xffffffff)
210 *
211 * When this note specifies an alignment value, it is used. Otherwise the
212 * maximum p_align value from loadable ELF Program Headers is used, if it is
213 * greater than or equal to 4k (0x1000). Otherwise, the default is used.
214 */
215#define XEN_ELFNOTE_PHYS32_RELOC 19
216
217/*
218 * The number of the highest elfnote defined.
219 */
220#define XEN_ELFNOTE_MAX XEN_ELFNOTE_PHYS32_RELOC
221
222/*
223 * System information exported through crash notes.
224 *
225 * The kexec / kdump code will create one XEN_ELFNOTE_CRASH_INFO
226 * note in case of a system crash. This note will contain various
227 * information about the system, see xen/include/xen/elfcore.h.
228 */
229#define XEN_ELFNOTE_CRASH_INFO 0x1000001
230
231/*
232 * System registers exported through crash notes.
233 *
234 * The kexec / kdump code will create one XEN_ELFNOTE_CRASH_REGS
235 * note per cpu in case of a system crash. This note is architecture
236 * specific and will contain registers not saved in the "CORE" note.
237 * See xen/include/xen/elfcore.h for more information.
238 */
239#define XEN_ELFNOTE_CRASH_REGS 0x1000002
240
241
242/*
243 * xen dump-core none note.
244 * xm dump-core code will create one XEN_ELFNOTE_DUMPCORE_NONE
245 * in its dump file to indicate that the file is xen dump-core
246 * file. This note doesn't have any other information.
247 * See tools/libxc/xc_core.h for more information.
248 */
249#define XEN_ELFNOTE_DUMPCORE_NONE 0x2000000
250
251/*
252 * xen dump-core header note.
253 * xm dump-core code will create one XEN_ELFNOTE_DUMPCORE_HEADER
254 * in its dump file.
255 * See tools/libxc/xc_core.h for more information.
256 */
257#define XEN_ELFNOTE_DUMPCORE_HEADER 0x2000001
258
259/*
260 * xen dump-core xen version note.
261 * xm dump-core code will create one XEN_ELFNOTE_DUMPCORE_XEN_VERSION
262 * in its dump file. It contains the xen version obtained via the
263 * XENVER hypercall.
264 * See tools/libxc/xc_core.h for more information.
265 */
266#define XEN_ELFNOTE_DUMPCORE_XEN_VERSION 0x2000002
267
268/*
269 * xen dump-core format version note.
270 * xm dump-core code will create one XEN_ELFNOTE_DUMPCORE_FORMAT_VERSION
271 * in its dump file. It contains a format version identifier.
272 * See tools/libxc/xc_core.h for more information.
273 */
274#define XEN_ELFNOTE_DUMPCORE_FORMAT_VERSION 0x2000003
275
276#endif /* __XEN_PUBLIC_ELFNOTE_H__ */
1/******************************************************************************
2 * elfnote.h
3 *
4 * Definitions used for the Xen ELF notes.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 * Copyright (c) 2006, Ian Campbell, XenSource Ltd.
25 */
26
27#ifndef __XEN_PUBLIC_ELFNOTE_H__
28#define __XEN_PUBLIC_ELFNOTE_H__
29
30/*
31 * The notes should live in a SHT_NOTE segment and have "Xen" in the
32 * name field.
33 *
34 * Numeric types are either 4 or 8 bytes depending on the content of
35 * the desc field.
36 *
37 * LEGACY indicated the fields in the legacy __xen_guest string which
38 * this a note type replaces.
39 *
40 * String values (for non-legacy) are NULL terminated ASCII, also known
41 * as ASCIZ type.
42 */
43
44/*
45 * NAME=VALUE pair (string).
46 */
47#define XEN_ELFNOTE_INFO 0
48
49/*
50 * The virtual address of the entry point (numeric).
51 *
52 * LEGACY: VIRT_ENTRY
53 */
54#define XEN_ELFNOTE_ENTRY 1
55
56/* The virtual address of the hypercall transfer page (numeric).
57 *
58 * LEGACY: HYPERCALL_PAGE. (n.b. legacy value is a physical page
59 * number not a virtual address)
60 */
61#define XEN_ELFNOTE_HYPERCALL_PAGE 2
62
63/* The virtual address where the kernel image should be mapped (numeric).
64 *
65 * Defaults to 0.
66 *
67 * LEGACY: VIRT_BASE
68 */
69#define XEN_ELFNOTE_VIRT_BASE 3
70
71/*
72 * The offset of the ELF paddr field from the acutal required
73 * pseudo-physical address (numeric).
74 *
75 * This is used to maintain backwards compatibility with older kernels
76 * which wrote __PAGE_OFFSET into that field. This field defaults to 0
77 * if not present.
78 *
79 * LEGACY: ELF_PADDR_OFFSET. (n.b. legacy default is VIRT_BASE)
80 */
81#define XEN_ELFNOTE_PADDR_OFFSET 4
82
83/*
84 * The version of Xen that we work with (string).
85 *
86 * LEGACY: XEN_VER
87 */
88#define XEN_ELFNOTE_XEN_VERSION 5
89
90/*
91 * The name of the guest operating system (string).
92 *
93 * LEGACY: GUEST_OS
94 */
95#define XEN_ELFNOTE_GUEST_OS 6
96
97/*
98 * The version of the guest operating system (string).
99 *
100 * LEGACY: GUEST_VER
101 */
102#define XEN_ELFNOTE_GUEST_VERSION 7
103
104/*
105 * The loader type (string).
106 *
107 * LEGACY: LOADER
108 */
109#define XEN_ELFNOTE_LOADER 8
110
111/*
112 * The kernel supports PAE (x86/32 only, string = "yes" or "no").
113 *
114 * LEGACY: PAE (n.b. The legacy interface included a provision to
115 * indicate 'extended-cr3' support allowing L3 page tables to be
116 * placed above 4G. It is assumed that any kernel new enough to use
117 * these ELF notes will include this and therefore "yes" here is
118 * equivalent to "yes[entended-cr3]" in the __xen_guest interface.
119 */
120#define XEN_ELFNOTE_PAE_MODE 9
121
122/*
123 * The features supported/required by this kernel (string).
124 *
125 * The string must consist of a list of feature names (as given in
126 * features.h, without the "XENFEAT_" prefix) separated by '|'
127 * characters. If a feature is required for the kernel to function
128 * then the feature name must be preceded by a '!' character.
129 *
130 * LEGACY: FEATURES
131 */
132#define XEN_ELFNOTE_FEATURES 10
133
134/*
135 * The kernel requires the symbol table to be loaded (string = "yes" or "no")
136 * LEGACY: BSD_SYMTAB (n.b. The legacy treated the presence or absence
137 * of this string as a boolean flag rather than requiring "yes" or
138 * "no".
139 */
140#define XEN_ELFNOTE_BSD_SYMTAB 11
141
142/*
143 * The lowest address the hypervisor hole can begin at (numeric).
144 *
145 * This must not be set higher than HYPERVISOR_VIRT_START. Its presence
146 * also indicates to the hypervisor that the kernel can deal with the
147 * hole starting at a higher address.
148 */
149#define XEN_ELFNOTE_HV_START_LOW 12
150
151/*
152 * List of maddr_t-sized mask/value pairs describing how to recognize
153 * (non-present) L1 page table entries carrying valid MFNs (numeric).
154 */
155#define XEN_ELFNOTE_L1_MFN_VALID 13
156
157/*
158 * Whether or not the guest supports cooperative suspend cancellation.
159 * This is a numeric value.
160 *
161 * Default is 0
162 */
163#define XEN_ELFNOTE_SUSPEND_CANCEL 14
164
165/*
166 * The (non-default) location the initial phys-to-machine map should be
167 * placed at by the hypervisor (Dom0) or the tools (DomU).
168 * The kernel must be prepared for this mapping to be established using
169 * large pages, despite such otherwise not being available to guests.
170 * The kernel must also be able to handle the page table pages used for
171 * this mapping not being accessible through the initial mapping.
172 * (Only x86-64 supports this at present.)
173 */
174#define XEN_ELFNOTE_INIT_P2M 15
175
176/*
177 * Whether or not the guest can deal with being passed an initrd not
178 * mapped through its initial page tables.
179 */
180#define XEN_ELFNOTE_MOD_START_PFN 16
181
182/*
183 * The features supported by this kernel (numeric).
184 *
185 * Other than XEN_ELFNOTE_FEATURES on pre-4.2 Xen, this note allows a
186 * kernel to specify support for features that older hypervisors don't
187 * know about. The set of features 4.2 and newer hypervisors will
188 * consider supported by the kernel is the combination of the sets
189 * specified through this and the string note.
190 *
191 * LEGACY: FEATURES
192 */
193#define XEN_ELFNOTE_SUPPORTED_FEATURES 17
194
195/*
196 * Physical entry point into the kernel.
197 *
198 * 32bit entry point into the kernel. When requested to launch the
199 * guest kernel in a HVM container, Xen will use this entry point to
200 * launch the guest in 32bit protected mode with paging disabled.
201 * Ignored otherwise.
202 */
203#define XEN_ELFNOTE_PHYS32_ENTRY 18
204
205/*
206 * The number of the highest elfnote defined.
207 */
208#define XEN_ELFNOTE_MAX XEN_ELFNOTE_PHYS32_ENTRY
209
210#endif /* __XEN_PUBLIC_ELFNOTE_H__ */
211
212/*
213 * Local variables:
214 * mode: C
215 * c-set-style: "BSD"
216 * c-basic-offset: 4
217 * tab-width: 4
218 * indent-tabs-mode: nil
219 * End:
220 */