logo

live-bootstrap

Mirror of <https://github.com/fosslinux/live-bootstrap>

multiboot1.h (10807B)


  1. /* multiboot.h - Multiboot 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. * SPDX-FileCopyrightText: 2010 FSF <licensing@fsf.org>
  21. * SPDX-License-Identifier: MIT
  22. */
  23. #ifndef MULTIBOOT_HEADER
  24. #define MULTIBOOT_HEADER 1
  25. /* How many bytes from the start of the file we search for the header. */
  26. #define MULTIBOOT_SEARCH 8192
  27. #define MULTIBOOT_HEADER_ALIGN 4
  28. /* The magic field should contain this. */
  29. #define MULTIBOOT_HEADER_MAGIC 0x1BADB002
  30. /* This should be in %eax. */
  31. #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
  32. /* Alignment of multiboot modules. */
  33. #define MULTIBOOT_MOD_ALIGN 0x00001000
  34. /* Alignment of the multiboot info structure. */
  35. #define MULTIBOOT_INFO_ALIGN 0x00000004
  36. /* Flags set in the ’flags’ member of the multiboot header. */
  37. /* Align all boot modules on i386 page (4KB) boundaries. */
  38. #define MULTIBOOT_PAGE_ALIGN 0x00000001
  39. /* Must pass memory information to OS. */
  40. #define MULTIBOOT_MEMORY_INFO 0x00000002
  41. /* Must pass video information to OS. */
  42. #define MULTIBOOT_VIDEO_MODE 0x00000004
  43. /* This flag indicates the use of the address fields in the header. */
  44. #define MULTIBOOT_AOUT_KLUDGE 0x00010000
  45. /* Flags to be set in the ’flags’ member of the multiboot info structure. */
  46. /* is there basic lower/upper memory information? */
  47. #define MULTIBOOT_INFO_MEMORY 0x00000001
  48. /* is there a boot device set? */
  49. #define MULTIBOOT_INFO_BOOTDEV 0x00000002
  50. /* is the command-line defined? */
  51. #define MULTIBOOT_INFO_CMDLINE 0x00000004
  52. /* are there modules to do something with? */
  53. #define MULTIBOOT_INFO_MODS 0x00000008
  54. /* These next two are mutually exclusive */
  55. /* is there a symbol table loaded? */
  56. #define MULTIBOOT_INFO_AOUT_SYMS 0x00000010
  57. /* is there an ELF section header table? */
  58. #define MULTIBOOT_INFO_ELF_SHDR 0X00000020
  59. /* is there a full memory map? */
  60. #define MULTIBOOT_INFO_MEM_MAP 0x00000040
  61. /* Is there drive info? */
  62. #define MULTIBOOT_INFO_DRIVE_INFO 0x00000080
  63. /* Is there a config table? */
  64. #define MULTIBOOT_INFO_CONFIG_TABLE 0x00000100
  65. /* Is there a boot loader name? */
  66. #define MULTIBOOT_INFO_BOOT_LOADER_NAME 0x00000200
  67. /* Is there a APM table? */
  68. #define MULTIBOOT_INFO_APM_TABLE 0x00000400
  69. /* Is there video information? */
  70. #define MULTIBOOT_INFO_VBE_INFO 0x00000800
  71. #define MULTIBOOT_INFO_FRAMEBUFFER_INFO 0x00001000
  72. #ifndef ASM_FILE
  73. typedef unsigned char multiboot_uint8_t;
  74. typedef unsigned short multiboot_uint16_t;
  75. typedef unsigned int multiboot_uint32_t;
  76. typedef unsigned long long multiboot_uint64_t;
  77. struct multiboot_header
  78. {
  79. /* Must be MULTIBOOT_MAGIC - see above. */
  80. multiboot_uint32_t magic;
  81. /* Feature flags. */
  82. multiboot_uint32_t flags;
  83. /* The above fields plus this one must equal 0 mod 2^32. */
  84. multiboot_uint32_t checksum;
  85. /* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */
  86. multiboot_uint32_t header_addr;
  87. multiboot_uint32_t load_addr;
  88. multiboot_uint32_t load_end_addr;
  89. multiboot_uint32_t bss_end_addr;
  90. multiboot_uint32_t entry_addr;
  91. /* These are only valid if MULTIBOOT_VIDEO_MODE is set. */
  92. multiboot_uint32_t mode_type;
  93. multiboot_uint32_t width;
  94. multiboot_uint32_t height;
  95. multiboot_uint32_t depth;
  96. };
  97. /* The symbol table for a.out. */
  98. struct multiboot_aout_symbol_table
  99. {
  100. multiboot_uint32_t tabsize;
  101. multiboot_uint32_t strsize;
  102. multiboot_uint32_t addr;
  103. multiboot_uint32_t reserved;
  104. };
  105. typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;
  106. /* The section header table for ELF. */
  107. struct multiboot_elf_section_header_table
  108. {
  109. multiboot_uint32_t num;
  110. multiboot_uint32_t size;
  111. multiboot_uint32_t addr;
  112. multiboot_uint32_t shndx;
  113. };
  114. typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t;
  115. struct multiboot_info
  116. {
  117. /* Multiboot info version number */
  118. multiboot_uint32_t flags;
  119. /* Available memory from BIOS */
  120. multiboot_uint32_t mem_lower;
  121. multiboot_uint32_t mem_upper;
  122. /* "root" partition */
  123. multiboot_uint32_t boot_device;
  124. /* Kernel command line */
  125. multiboot_uint32_t cmdline;
  126. /* Boot-Module list */
  127. multiboot_uint32_t mods_count;
  128. multiboot_uint32_t mods_addr;
  129. union
  130. {
  131. multiboot_aout_symbol_table_t aout_sym;
  132. multiboot_elf_section_header_table_t elf_sec;
  133. } u;
  134. /* Memory Mapping buffer */
  135. multiboot_uint32_t mmap_length;
  136. multiboot_uint32_t mmap_addr;
  137. /* Drive Info buffer */
  138. multiboot_uint32_t drives_length;
  139. multiboot_uint32_t drives_addr;
  140. /* ROM configuration table */
  141. multiboot_uint32_t config_table;
  142. /* Boot Loader Name */
  143. multiboot_uint32_t boot_loader_name;
  144. /* APM table */
  145. multiboot_uint32_t apm_table;
  146. /* Video */
  147. multiboot_uint32_t vbe_control_info;
  148. multiboot_uint32_t vbe_mode_info;
  149. multiboot_uint16_t vbe_mode;
  150. multiboot_uint16_t vbe_interface_seg;
  151. multiboot_uint16_t vbe_interface_off;
  152. multiboot_uint16_t vbe_interface_len;
  153. multiboot_uint64_t framebuffer_addr;
  154. multiboot_uint32_t framebuffer_pitch;
  155. multiboot_uint32_t framebuffer_width;
  156. multiboot_uint32_t framebuffer_height;
  157. multiboot_uint8_t framebuffer_bpp;
  158. #define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
  159. #define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
  160. #define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
  161. multiboot_uint8_t framebuffer_type;
  162. union
  163. {
  164. struct
  165. {
  166. multiboot_uint32_t framebuffer_palette_addr;
  167. multiboot_uint16_t framebuffer_palette_num_colors;
  168. };
  169. struct
  170. {
  171. multiboot_uint8_t framebuffer_red_field_position;
  172. multiboot_uint8_t framebuffer_red_mask_size;
  173. multiboot_uint8_t framebuffer_green_field_position;
  174. multiboot_uint8_t framebuffer_green_mask_size;
  175. multiboot_uint8_t framebuffer_blue_field_position;
  176. multiboot_uint8_t framebuffer_blue_mask_size;
  177. };
  178. };
  179. };
  180. typedef struct multiboot_info multiboot_info_t;
  181. struct multiboot_color
  182. {
  183. multiboot_uint8_t red;
  184. multiboot_uint8_t green;
  185. multiboot_uint8_t blue;
  186. };
  187. struct multiboot_mmap_entry
  188. {
  189. multiboot_uint32_t size;
  190. multiboot_uint64_t addr;
  191. multiboot_uint64_t len;
  192. #define MULTIBOOT_MEMORY_AVAILABLE 1
  193. #define MULTIBOOT_MEMORY_RESERVED 2
  194. #define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
  195. #define MULTIBOOT_MEMORY_NVS 4
  196. #define MULTIBOOT_MEMORY_BADRAM 5
  197. multiboot_uint32_t type;
  198. } __attribute__((packed));
  199. typedef struct multiboot_mmap_entry multiboot_memory_map_t;
  200. struct multiboot_mod_list
  201. {
  202. /* the memory used goes from bytes ’mod_start’ to ’mod_end-1’ inclusive */
  203. multiboot_uint32_t mod_start;
  204. multiboot_uint32_t mod_end;
  205. /* Module command line */
  206. multiboot_uint32_t cmdline;
  207. /* padding to take it to 16 bytes (must be zero) */
  208. multiboot_uint32_t pad;
  209. };
  210. typedef struct multiboot_mod_list multiboot_module_t;
  211. /* APM BIOS info. */
  212. struct multiboot_apm_info
  213. {
  214. multiboot_uint16_t version;
  215. multiboot_uint16_t cseg;
  216. multiboot_uint32_t offset;
  217. multiboot_uint16_t cseg_16;
  218. multiboot_uint16_t dseg;
  219. multiboot_uint16_t flags;
  220. multiboot_uint16_t cseg_len;
  221. multiboot_uint16_t cseg_16_len;
  222. multiboot_uint16_t dseg_len;
  223. };
  224. /* VBE controller information. */
  225. struct vbe_controller
  226. {
  227. unsigned char signature[4];
  228. unsigned short version;
  229. unsigned long oem_string;
  230. unsigned long capabilities;
  231. unsigned long video_mode;
  232. unsigned short total_memory;
  233. unsigned short oem_software_rev;
  234. unsigned long oem_vendor_name;
  235. unsigned long oem_product_name;
  236. unsigned long oem_product_rev;
  237. unsigned char reserved[222];
  238. unsigned char oem_data[256];
  239. } __attribute__ ((packed));
  240. /* VBE mode information. */
  241. struct vbe_mode
  242. {
  243. unsigned short mode_attributes;
  244. unsigned char win_a_attributes;
  245. unsigned char win_b_attributes;
  246. unsigned short win_granularity;
  247. unsigned short win_size;
  248. unsigned short win_a_segment;
  249. unsigned short win_b_segment;
  250. unsigned long win_func;
  251. unsigned short bytes_per_scanline;
  252. /* >=1.2 */
  253. unsigned short x_resolution;
  254. unsigned short y_resolution;
  255. unsigned char x_char_size;
  256. unsigned char y_char_size;
  257. unsigned char number_of_planes;
  258. unsigned char bits_per_pixel;
  259. unsigned char number_of_banks;
  260. unsigned char memory_model;
  261. unsigned char bank_size;
  262. unsigned char number_of_image_pages;
  263. unsigned char reserved0;
  264. /* direct color */
  265. unsigned char red_mask_size;
  266. unsigned char red_field_position;
  267. unsigned char green_mask_size;
  268. unsigned char green_field_position;
  269. unsigned char blue_mask_size;
  270. unsigned char blue_field_position;
  271. unsigned char reserved_mask_size;
  272. unsigned char reserved_field_position;
  273. unsigned char direct_color_mode_info;
  274. /* >=2.0 */
  275. unsigned long phys_base;
  276. unsigned long reserved1;
  277. unsigned short reversed2;
  278. /* >=3.0 */
  279. unsigned short linear_bytes_per_scanline;
  280. unsigned char banked_number_of_image_pages;
  281. unsigned char linear_number_of_image_pages;
  282. unsigned char linear_red_mask_size;
  283. unsigned char linear_red_field_position;
  284. unsigned char linear_green_mask_size;
  285. unsigned char linear_green_field_position;
  286. unsigned char linear_blue_mask_size;
  287. unsigned char linear_blue_field_position;
  288. unsigned char linear_reserved_mask_size;
  289. unsigned char linear_reserved_field_position;
  290. unsigned long max_pixel_clock;
  291. unsigned char reserved3[190];
  292. } __attribute__ ((packed));
  293. #endif /* ! ASM_FILE */
  294. #endif /* ! MULTIBOOT_HEADER */