1 /* multiboot2.h - Multiboot 2 header file. */
2 /* Copyright (C) 1999,2003,2007,2008,2009,2010 Free Software Foundation, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
22 #ifndef MULTIBOOT_HEADER
23 #define MULTIBOOT_HEADER 1
25 /* How many bytes from the start of the file we search for the header. */
26 #define MULTIBOOT_SEARCH 8192
28 /* The magic field should contain this. */
29 #define MULTIBOOT2_HEADER_MAGIC 0xe85250d6
31 /* This should be in %eax. */
32 #define MULTIBOOT2_BOOTLOADER_MAGIC 0x36d76289
34 /* Alignment of multiboot modules. */
35 #define MULTIBOOT_MOD_ALIGN 0x00001000
37 /* Alignment of the multiboot info structure. */
38 #define MULTIBOOT_INFO_ALIGN 0x00000004
40 /* Flags set in the 'flags' member of the multiboot header. */
42 /* Align all boot modules on i386 page (4KB) boundaries. */
43 #define MULTIBOOT_PAGE_ALIGN 0x00000001
45 /* Must pass memory information to OS. */
46 #define MULTIBOOT_MEMORY_INFO 0x00000002
48 /* Must pass video information to OS. */
49 #define MULTIBOOT_VIDEO_MODE 0x00000004
51 /* This flag indicates the use of the address fields in the header. */
52 #define MULTIBOOT_AOUT_KLUDGE 0x00010000
54 /* Flags to be set in the 'flags' member of the multiboot info structure. */
56 /* is there basic lower/upper memory information? */
57 #define MULTIBOOT_INFO_MEMORY 0x00000001
58 /* is there a boot device set? */
59 #define MULTIBOOT_INFO_BOOTDEV 0x00000002
60 /* is the command-line defined? */
61 #define MULTIBOOT_INFO_CMDLINE 0x00000004
62 /* are there modules to do something with? */
63 #define MULTIBOOT_INFO_MODS 0x00000008
65 /* These next two are mutually exclusive */
67 /* is there a symbol table loaded? */
68 #define MULTIBOOT_INFO_AOUT_SYMS 0x00000010
69 /* is there an ELF section header table? */
70 #define MULTIBOOT_INFO_ELF_SHDR 0X00000020
72 /* is there a full memory map? */
73 #define MULTIBOOT_INFO_MEM_MAP 0x00000040
75 /* Is there drive info? */
76 #define MULTIBOOT_INFO_DRIVE_INFO 0x00000080
78 /* Is there a config table? */
79 #define MULTIBOOT_INFO_CONFIG_TABLE 0x00000100
81 /* Is there a boot loader name? */
82 #define MULTIBOOT_INFO_BOOT_LOADER_NAME 0x00000200
84 /* Is there a APM table? */
85 #define MULTIBOOT_INFO_APM_TABLE 0x00000400
87 /* Is there video information? */
88 #define MULTIBOOT_INFO_VIDEO_INFO 0x00000800
92 typedef unsigned short multiboot_uint16_t
;
93 typedef unsigned int multiboot_uint32_t
;
94 typedef unsigned long long multiboot_uint64_t
;
96 struct multiboot_header
98 /* Must be MULTIBOOT_MAGIC - see above. */
99 multiboot_uint32_t magic
;
102 multiboot_uint32_t flags
;
104 /* The above fields plus this one must equal 0 mod 2^32. */
105 multiboot_uint32_t checksum
;
107 /* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */
108 multiboot_uint32_t header_addr
;
109 multiboot_uint32_t load_addr
;
110 multiboot_uint32_t load_end_addr
;
111 multiboot_uint32_t bss_end_addr
;
112 multiboot_uint32_t entry_addr
;
114 /* These are only valid if MULTIBOOT_VIDEO_MODE is set. */
115 multiboot_uint32_t mode_type
;
116 multiboot_uint32_t width
;
117 multiboot_uint32_t height
;
118 multiboot_uint32_t depth
;
121 /* The symbol table for a.out. */
122 struct multiboot_aout_symbol_table
124 multiboot_uint32_t tabsize
;
125 multiboot_uint32_t strsize
;
126 multiboot_uint32_t addr
;
127 multiboot_uint32_t reserved
;
129 typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t
;
131 /* The section header table for ELF. */
132 struct multiboot_elf_section_header_table
134 multiboot_uint32_t num
;
135 multiboot_uint32_t size
;
136 multiboot_uint32_t addr
;
137 multiboot_uint32_t shndx
;
139 typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t
;
141 struct multiboot_info
143 /* Multiboot info version number */
144 multiboot_uint32_t flags
;
146 /* Available memory from BIOS */
147 multiboot_uint32_t mem_lower
;
148 multiboot_uint32_t mem_upper
;
150 /* "root" partition */
151 multiboot_uint32_t boot_device
;
153 /* Kernel command line */
154 multiboot_uint32_t cmdline
;
156 /* Boot-Module list */
157 multiboot_uint32_t mods_count
;
158 multiboot_uint32_t mods_addr
;
162 multiboot_aout_symbol_table_t aout_sym
;
163 multiboot_elf_section_header_table_t elf_sec
;
166 /* Memory Mapping buffer */
167 multiboot_uint32_t mmap_length
;
168 multiboot_uint32_t mmap_addr
;
170 /* Drive Info buffer */
171 multiboot_uint32_t drives_length
;
172 multiboot_uint32_t drives_addr
;
174 /* ROM configuration table */
175 multiboot_uint32_t config_table
;
177 /* Boot Loader Name */
178 multiboot_uint32_t boot_loader_name
;
181 multiboot_uint32_t apm_table
;
184 multiboot_uint32_t vbe_control_info
;
185 multiboot_uint32_t vbe_mode_info
;
186 multiboot_uint16_t vbe_mode
;
187 multiboot_uint16_t vbe_interface_seg
;
188 multiboot_uint16_t vbe_interface_off
;
189 multiboot_uint16_t vbe_interface_len
;
191 typedef struct multiboot_info multiboot_info_t
;
193 struct multiboot_mmap_entry
195 multiboot_uint32_t size
;
196 multiboot_uint64_t addr
;
197 multiboot_uint64_t len
;
198 #define MULTIBOOT_MEMORY_AVAILABLE 1
199 #define MULTIBOOT_MEMORY_RESERVED 2
200 multiboot_uint32_t type
;
201 } __attribute__((packed
));
202 typedef struct multiboot_mmap_entry multiboot_memory_map_t
;
204 struct multiboot_mod_list
206 /* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
207 multiboot_uint32_t mod_start
;
208 multiboot_uint32_t mod_end
;
210 /* Module command line */
211 multiboot_uint32_t cmdline
;
213 /* padding to take it to 16 bytes (must be zero) */
214 multiboot_uint32_t pad
;
216 typedef struct multiboot_mod_list multiboot_module_t
;
218 #endif /* ! ASM_FILE */
220 #endif /* ! MULTIBOOT_HEADER */