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