multiboot2.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. /* multiboot2.h - Multiboot 2 header file. */
  2. /* Copyright (C) 1999,2003,2007,2008,2009,2010 Free Software Foundation, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to
  6. * deal in the Software without restriction, including without limitation the
  7. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. * sell copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ANY
  17. * DEVELOPER OR DISTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  18. * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
  19. * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20. */
  21. #ifndef MULTIBOOT_HEADER
  22. #define MULTIBOOT_HEADER 1
  23. /* How many bytes from the start of the file we search for the header. */
  24. #define MULTIBOOT_SEARCH 32768
  25. #define MULTIBOOT_HEADER_ALIGN 8
  26. /* The magic field should contain this. */
  27. #define MULTIBOOT2_HEADER_MAGIC 0xe85250d6
  28. /* This should be in %eax. */
  29. #define MULTIBOOT2_BOOTLOADER_MAGIC 0x36d76289
  30. /* Alignment of multiboot modules. */
  31. #define MULTIBOOT_MOD_ALIGN 0x00001000
  32. /* Alignment of the multiboot info structure. */
  33. #define MULTIBOOT_INFO_ALIGN 0x00000008
  34. /* Flags set in the 'flags' member of the multiboot header. */
  35. #define MULTIBOOT_TAG_ALIGN 8
  36. #define MULTIBOOT_TAG_TYPE_END 0
  37. #define MULTIBOOT_TAG_TYPE_CMDLINE 1
  38. #define MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME 2
  39. #define MULTIBOOT_TAG_TYPE_MODULE 3
  40. #define MULTIBOOT_TAG_TYPE_BASIC_MEMINFO 4
  41. #define MULTIBOOT_TAG_TYPE_BOOTDEV 5
  42. #define MULTIBOOT_TAG_TYPE_MMAP 6
  43. #define MULTIBOOT_TAG_TYPE_VBE 7
  44. #define MULTIBOOT_TAG_TYPE_FRAMEBUFFER 8
  45. #define MULTIBOOT_TAG_TYPE_ELF_SECTIONS 9
  46. #define MULTIBOOT_TAG_TYPE_APM 10
  47. #define MULTIBOOT_TAG_TYPE_EFI32 11
  48. #define MULTIBOOT_TAG_TYPE_EFI64 12
  49. #define MULTIBOOT_TAG_TYPE_SMBIOS 13
  50. #define MULTIBOOT_TAG_TYPE_ACPI_OLD 14
  51. #define MULTIBOOT_TAG_TYPE_ACPI_NEW 15
  52. #define MULTIBOOT_TAG_TYPE_NETWORK 16
  53. #define MULTIBOOT_TAG_TYPE_EFI_MMAP 17
  54. #define MULTIBOOT_TAG_TYPE_EFI_BS 18
  55. #define MULTIBOOT_HEADER_TAG_END 0
  56. #define MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST 1
  57. #define MULTIBOOT_HEADER_TAG_ADDRESS 2
  58. #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS 3
  59. #define MULTIBOOT_HEADER_TAG_CONSOLE_FLAGS 4
  60. #define MULTIBOOT_HEADER_TAG_FRAMEBUFFER 5
  61. #define MULTIBOOT_HEADER_TAG_MODULE_ALIGN 6
  62. #define MULTIBOOT_HEADER_TAG_EFI_BS 7
  63. #define MULTIBOOT_ARCHITECTURE_I386 0
  64. #define MULTIBOOT_ARCHITECTURE_MIPS32 4
  65. #define MULTIBOOT_HEADER_TAG_OPTIONAL 1
  66. #define MULTIBOOT_CONSOLE_FLAGS_CONSOLE_REQUIRED 1
  67. #define MULTIBOOT_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED 2
  68. #ifndef ASM_FILE
  69. typedef unsigned char multiboot_uint8_t;
  70. typedef unsigned short multiboot_uint16_t;
  71. typedef unsigned int multiboot_uint32_t;
  72. typedef unsigned long long multiboot_uint64_t;
  73. struct multiboot_header
  74. {
  75. /* Must be MULTIBOOT_MAGIC - see above. */
  76. multiboot_uint32_t magic;
  77. /* ISA */
  78. multiboot_uint32_t architecture;
  79. /* Total header length. */
  80. multiboot_uint32_t header_length;
  81. /* The above fields plus this one must equal 0 mod 2^32. */
  82. multiboot_uint32_t checksum;
  83. };
  84. struct multiboot_header_tag
  85. {
  86. multiboot_uint16_t type;
  87. multiboot_uint16_t flags;
  88. multiboot_uint32_t size;
  89. };
  90. struct multiboot_header_tag_information_request
  91. {
  92. multiboot_uint16_t type;
  93. multiboot_uint16_t flags;
  94. multiboot_uint32_t size;
  95. multiboot_uint32_t requests[0];
  96. };
  97. struct multiboot_header_tag_address
  98. {
  99. multiboot_uint16_t type;
  100. multiboot_uint16_t flags;
  101. multiboot_uint32_t size;
  102. multiboot_uint32_t header_addr;
  103. multiboot_uint32_t load_addr;
  104. multiboot_uint32_t load_end_addr;
  105. multiboot_uint32_t bss_end_addr;
  106. };
  107. struct multiboot_header_tag_entry_address
  108. {
  109. multiboot_uint16_t type;
  110. multiboot_uint16_t flags;
  111. multiboot_uint32_t size;
  112. multiboot_uint32_t entry_addr;
  113. };
  114. struct multiboot_header_tag_console_flags
  115. {
  116. multiboot_uint16_t type;
  117. multiboot_uint16_t flags;
  118. multiboot_uint32_t size;
  119. multiboot_uint32_t console_flags;
  120. };
  121. struct multiboot_header_tag_framebuffer
  122. {
  123. multiboot_uint16_t type;
  124. multiboot_uint16_t flags;
  125. multiboot_uint32_t size;
  126. multiboot_uint32_t width;
  127. multiboot_uint32_t height;
  128. multiboot_uint32_t depth;
  129. };
  130. struct multiboot_header_tag_module_align
  131. {
  132. multiboot_uint16_t type;
  133. multiboot_uint16_t flags;
  134. multiboot_uint32_t size;
  135. };
  136. struct multiboot_color
  137. {
  138. multiboot_uint8_t red;
  139. multiboot_uint8_t green;
  140. multiboot_uint8_t blue;
  141. };
  142. struct multiboot_mmap_entry
  143. {
  144. multiboot_uint64_t addr;
  145. multiboot_uint64_t len;
  146. #define MULTIBOOT_MEMORY_AVAILABLE 1
  147. #define MULTIBOOT_MEMORY_RESERVED 2
  148. #define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
  149. #define MULTIBOOT_MEMORY_NVS 4
  150. #define MULTIBOOT_MEMORY_BADRAM 5
  151. multiboot_uint32_t type;
  152. multiboot_uint32_t zero;
  153. };
  154. typedef struct multiboot_mmap_entry multiboot_memory_map_t;
  155. struct multiboot_tag
  156. {
  157. multiboot_uint32_t type;
  158. multiboot_uint32_t size;
  159. };
  160. struct multiboot_tag_string
  161. {
  162. multiboot_uint32_t type;
  163. multiboot_uint32_t size;
  164. char string[0];
  165. };
  166. struct multiboot_tag_module
  167. {
  168. multiboot_uint32_t type;
  169. multiboot_uint32_t size;
  170. multiboot_uint32_t mod_start;
  171. multiboot_uint32_t mod_end;
  172. char cmdline[0];
  173. };
  174. struct multiboot_tag_basic_meminfo
  175. {
  176. multiboot_uint32_t type;
  177. multiboot_uint32_t size;
  178. multiboot_uint32_t mem_lower;
  179. multiboot_uint32_t mem_upper;
  180. };
  181. struct multiboot_tag_bootdev
  182. {
  183. multiboot_uint32_t type;
  184. multiboot_uint32_t size;
  185. multiboot_uint32_t biosdev;
  186. multiboot_uint32_t slice;
  187. multiboot_uint32_t part;
  188. };
  189. struct multiboot_tag_mmap
  190. {
  191. multiboot_uint32_t type;
  192. multiboot_uint32_t size;
  193. multiboot_uint32_t entry_size;
  194. multiboot_uint32_t entry_version;
  195. struct multiboot_mmap_entry entries[0];
  196. };
  197. struct multiboot_vbe_info_block
  198. {
  199. multiboot_uint8_t external_specification[512];
  200. };
  201. struct multiboot_vbe_mode_info_block
  202. {
  203. multiboot_uint8_t external_specification[256];
  204. };
  205. struct multiboot_tag_vbe
  206. {
  207. multiboot_uint32_t type;
  208. multiboot_uint32_t size;
  209. multiboot_uint16_t vbe_mode;
  210. multiboot_uint16_t vbe_interface_seg;
  211. multiboot_uint16_t vbe_interface_off;
  212. multiboot_uint16_t vbe_interface_len;
  213. struct multiboot_vbe_info_block vbe_control_info;
  214. struct multiboot_vbe_mode_info_block vbe_mode_info;
  215. };
  216. struct multiboot_tag_framebuffer_common
  217. {
  218. multiboot_uint32_t type;
  219. multiboot_uint32_t size;
  220. multiboot_uint64_t framebuffer_addr;
  221. multiboot_uint32_t framebuffer_pitch;
  222. multiboot_uint32_t framebuffer_width;
  223. multiboot_uint32_t framebuffer_height;
  224. multiboot_uint8_t framebuffer_bpp;
  225. #define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
  226. #define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
  227. #define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
  228. multiboot_uint8_t framebuffer_type;
  229. multiboot_uint16_t reserved;
  230. };
  231. struct multiboot_tag_framebuffer
  232. {
  233. struct multiboot_tag_framebuffer_common common;
  234. union
  235. {
  236. struct
  237. {
  238. multiboot_uint16_t framebuffer_palette_num_colors;
  239. struct multiboot_color framebuffer_palette[0];
  240. };
  241. struct
  242. {
  243. multiboot_uint8_t framebuffer_red_field_position;
  244. multiboot_uint8_t framebuffer_red_mask_size;
  245. multiboot_uint8_t framebuffer_green_field_position;
  246. multiboot_uint8_t framebuffer_green_mask_size;
  247. multiboot_uint8_t framebuffer_blue_field_position;
  248. multiboot_uint8_t framebuffer_blue_mask_size;
  249. };
  250. };
  251. };
  252. struct multiboot_tag_elf_sections
  253. {
  254. multiboot_uint32_t type;
  255. multiboot_uint32_t size;
  256. multiboot_uint32_t num;
  257. multiboot_uint32_t entsize;
  258. multiboot_uint32_t shndx;
  259. char sections[0];
  260. };
  261. struct multiboot_tag_apm
  262. {
  263. multiboot_uint32_t type;
  264. multiboot_uint32_t size;
  265. multiboot_uint16_t version;
  266. multiboot_uint16_t cseg;
  267. multiboot_uint32_t offset;
  268. multiboot_uint16_t cseg_16;
  269. multiboot_uint16_t dseg;
  270. multiboot_uint16_t flags;
  271. multiboot_uint16_t cseg_len;
  272. multiboot_uint16_t cseg_16_len;
  273. multiboot_uint16_t dseg_len;
  274. };
  275. struct multiboot_tag_efi32
  276. {
  277. multiboot_uint32_t type;
  278. multiboot_uint32_t size;
  279. multiboot_uint32_t pointer;
  280. };
  281. struct multiboot_tag_efi64
  282. {
  283. multiboot_uint32_t type;
  284. multiboot_uint32_t size;
  285. multiboot_uint64_t pointer;
  286. };
  287. struct multiboot_tag_smbios
  288. {
  289. multiboot_uint32_t type;
  290. multiboot_uint32_t size;
  291. multiboot_uint8_t major;
  292. multiboot_uint8_t minor;
  293. multiboot_uint8_t reserved[6];
  294. multiboot_uint8_t tables[0];
  295. };
  296. struct multiboot_tag_old_acpi
  297. {
  298. multiboot_uint32_t type;
  299. multiboot_uint32_t size;
  300. multiboot_uint8_t rsdp[0];
  301. };
  302. struct multiboot_tag_new_acpi
  303. {
  304. multiboot_uint32_t type;
  305. multiboot_uint32_t size;
  306. multiboot_uint8_t rsdp[0];
  307. };
  308. struct multiboot_tag_network
  309. {
  310. multiboot_uint32_t type;
  311. multiboot_uint32_t size;
  312. multiboot_uint8_t dhcpack[0];
  313. };
  314. struct multiboot_tag_efi_mmap
  315. {
  316. multiboot_uint32_t type;
  317. multiboot_uint32_t size;
  318. multiboot_uint32_t descr_size;
  319. multiboot_uint32_t descr_vers;
  320. multiboot_uint8_t efi_mmap[0];
  321. };
  322. #endif /* ! ASM_FILE */
  323. #endif /* ! MULTIBOOT_HEADER */