elfnote.h 8.2 KB

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