xref: /freebsd/sys/contrib/xen/elfnote.h (revision 3a9fd8242b35884921dfc4e886f284a75870a536)
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  * `incontents 200 elfnotes ELF notes
32  *
33  * The notes should live in a PT_NOTE segment and have "Xen" in the
34  * name field.
35  *
36  * Numeric types are either 4 or 8 bytes depending on the content of
37  * the desc field.
38  *
39  * LEGACY indicated the fields in the legacy __xen_guest string which
40  * this a note type replaces.
41  *
42  * String values (for non-legacy) are NULL terminated ASCII, also known
43  * as ASCIZ type.
44  */
45 
46 /*
47  * NAME=VALUE pair (string).
48  */
49 #define XEN_ELFNOTE_INFO           0
50 
51 /*
52  * The virtual address of the entry point (numeric).
53  *
54  * LEGACY: VIRT_ENTRY
55  */
56 #define XEN_ELFNOTE_ENTRY          1
57 
58 /* The virtual address of the hypercall transfer page (numeric).
59  *
60  * LEGACY: HYPERCALL_PAGE. (n.b. legacy value is a physical page
61  * number not a virtual address)
62  */
63 #define XEN_ELFNOTE_HYPERCALL_PAGE 2
64 
65 /* The virtual address where the kernel image should be mapped (numeric).
66  *
67  * Defaults to 0.
68  *
69  * LEGACY: VIRT_BASE
70  */
71 #define XEN_ELFNOTE_VIRT_BASE      3
72 
73 /*
74  * The offset of the ELF paddr field from the actual required
75  * pseudo-physical address (numeric).
76  *
77  * This is used to maintain backwards compatibility with older kernels
78  * which wrote __PAGE_OFFSET into that field. This field defaults to 0
79  * if not present.
80  *
81  * LEGACY: ELF_PADDR_OFFSET. (n.b. legacy default is VIRT_BASE)
82  */
83 #define XEN_ELFNOTE_PADDR_OFFSET   4
84 
85 /*
86  * The version of Xen that we work with (string).
87  *
88  * LEGACY: XEN_VER
89  */
90 #define XEN_ELFNOTE_XEN_VERSION    5
91 
92 /*
93  * The name of the guest operating system (string).
94  *
95  * LEGACY: GUEST_OS
96  */
97 #define XEN_ELFNOTE_GUEST_OS       6
98 
99 /*
100  * The version of the guest operating system (string).
101  *
102  * LEGACY: GUEST_VER
103  */
104 #define XEN_ELFNOTE_GUEST_VERSION  7
105 
106 /*
107  * The loader type (string).
108  *
109  * LEGACY: LOADER
110  */
111 #define XEN_ELFNOTE_LOADER         8
112 
113 /*
114  * The kernel supports PAE (x86/32 only, string = "yes", "no" or
115  * "bimodal").
116  *
117  * For compatibility with Xen 3.0.3 and earlier the "bimodal" setting
118  * may be given as "yes,bimodal" which will cause older Xen to treat
119  * this kernel as PAE.
120  *
121  * LEGACY: PAE (n.b. The legacy interface included a provision to
122  * indicate 'extended-cr3' support allowing L3 page tables to be
123  * placed above 4G. It is assumed that any kernel new enough to use
124  * these ELF notes will include this and therefore "yes" here is
125  * equivalent to "yes[entended-cr3]" in the __xen_guest interface.
126  */
127 #define XEN_ELFNOTE_PAE_MODE       9
128 
129 /*
130  * The features supported/required by this kernel (string).
131  *
132  * The string must consist of a list of feature names (as given in
133  * features.h, without the "XENFEAT_" prefix) separated by '|'
134  * characters. If a feature is required for the kernel to function
135  * then the feature name must be preceded by a '!' character.
136  *
137  * LEGACY: FEATURES
138  */
139 #define XEN_ELFNOTE_FEATURES      10
140 
141 /*
142  * The kernel requires the symbol table to be loaded (string = "yes" or "no")
143  * LEGACY: BSD_SYMTAB (n.b. The legacy treated the presence or absence
144  * of this string as a boolean flag rather than requiring "yes" or
145  * "no".
146  */
147 #define XEN_ELFNOTE_BSD_SYMTAB    11
148 
149 /*
150  * The lowest address the hypervisor hole can begin at (numeric).
151  *
152  * This must not be set higher than HYPERVISOR_VIRT_START. Its presence
153  * also indicates to the hypervisor that the kernel can deal with the
154  * hole starting at a higher address.
155  */
156 #define XEN_ELFNOTE_HV_START_LOW  12
157 
158 /*
159  * List of maddr_t-sized mask/value pairs describing how to recognize
160  * (non-present) L1 page table entries carrying valid MFNs (numeric).
161  */
162 #define XEN_ELFNOTE_L1_MFN_VALID  13
163 
164 /*
165  * Whether or not the guest supports cooperative suspend cancellation.
166  * This is a numeric value.
167  *
168  * Default is 0
169  */
170 #define XEN_ELFNOTE_SUSPEND_CANCEL 14
171 
172 /*
173  * The (non-default) location the initial phys-to-machine map should be
174  * placed at by the hypervisor (Dom0) or the tools (DomU).
175  * The kernel must be prepared for this mapping to be established using
176  * large pages, despite such otherwise not being available to guests. Note
177  * that these large pages may be misaligned in PFN space (they'll obviously
178  * be aligned in MFN and virtual address spaces).
179  * The kernel must also be able to handle the page table pages used for
180  * this mapping not being accessible through the initial mapping.
181  * (Only x86-64 supports this at present.)
182  */
183 #define XEN_ELFNOTE_INIT_P2M      15
184 
185 /*
186  * Whether or not the guest can deal with being passed an initrd not
187  * mapped through its initial page tables.
188  */
189 #define XEN_ELFNOTE_MOD_START_PFN 16
190 
191 /*
192  * The features supported by this kernel (numeric).
193  *
194  * Other than XEN_ELFNOTE_FEATURES on pre-4.2 Xen, this note allows a
195  * kernel to specify support for features that older hypervisors don't
196  * know about. The set of features 4.2 and newer hypervisors will
197  * consider supported by the kernel is the combination of the sets
198  * specified through this and the string note.
199  *
200  * LEGACY: FEATURES
201  */
202 #define XEN_ELFNOTE_SUPPORTED_FEATURES 17
203 
204 /*
205  * Physical entry point into the kernel.
206  *
207  * 32bit entry point into the kernel. When requested to launch the
208  * guest kernel in a HVM container, Xen will use this entry point to
209  * launch the guest in 32bit protected mode with paging disabled.
210  * Ignored otherwise.
211  */
212 #define XEN_ELFNOTE_PHYS32_ENTRY 18
213 
214 /*
215  * The number of the highest elfnote defined.
216  */
217 #define XEN_ELFNOTE_MAX XEN_ELFNOTE_PHYS32_ENTRY
218 
219 /*
220  * System information exported through crash notes.
221  *
222  * The kexec / kdump code will create one XEN_ELFNOTE_CRASH_INFO
223  * note in case of a system crash. This note will contain various
224  * information about the system, see xen/include/xen/elfcore.h.
225  */
226 #define XEN_ELFNOTE_CRASH_INFO 0x1000001
227 
228 /*
229  * System registers exported through crash notes.
230  *
231  * The kexec / kdump code will create one XEN_ELFNOTE_CRASH_REGS
232  * note per cpu in case of a system crash. This note is architecture
233  * specific and will contain registers not saved in the "CORE" note.
234  * See xen/include/xen/elfcore.h for more information.
235  */
236 #define XEN_ELFNOTE_CRASH_REGS 0x1000002
237 
238 
239 /*
240  * xen dump-core none note.
241  * xm dump-core code will create one XEN_ELFNOTE_DUMPCORE_NONE
242  * in its dump file to indicate that the file is xen dump-core
243  * file. This note doesn't have any other information.
244  * See tools/libxc/xc_core.h for more information.
245  */
246 #define XEN_ELFNOTE_DUMPCORE_NONE               0x2000000
247 
248 /*
249  * xen dump-core header note.
250  * xm dump-core code will create one XEN_ELFNOTE_DUMPCORE_HEADER
251  * in its dump file.
252  * See tools/libxc/xc_core.h for more information.
253  */
254 #define XEN_ELFNOTE_DUMPCORE_HEADER             0x2000001
255 
256 /*
257  * xen dump-core xen version note.
258  * xm dump-core code will create one XEN_ELFNOTE_DUMPCORE_XEN_VERSION
259  * in its dump file. It contains the xen version obtained via the
260  * XENVER hypercall.
261  * See tools/libxc/xc_core.h for more information.
262  */
263 #define XEN_ELFNOTE_DUMPCORE_XEN_VERSION        0x2000002
264 
265 /*
266  * xen dump-core format version note.
267  * xm dump-core code will create one XEN_ELFNOTE_DUMPCORE_FORMAT_VERSION
268  * in its dump file. It contains a format version identifier.
269  * See tools/libxc/xc_core.h for more information.
270  */
271 #define XEN_ELFNOTE_DUMPCORE_FORMAT_VERSION     0x2000003
272 
273 #endif /* __XEN_PUBLIC_ELFNOTE_H__ */
274 
275 /*
276  * Local variables:
277  * mode: C
278  * c-file-style: "BSD"
279  * c-basic-offset: 4
280  * tab-width: 4
281  * indent-tabs-mode: nil
282  * End:
283  */
284