1 /* multiboot.h - multiboot header file. */
3 * Copyright (C) 2003 Free Software Foundation, Inc.
4 * Copyright (C) 2008 Robert Millan
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
25 /* How many bytes from the start of the file we search for the header. */
26 #define MB_SEARCH 8192
28 /* The magic field should contain this. */
29 #define MB_MAGIC 0x1BADB002
31 /* This should be in %eax. */
32 #define MB_MAGIC2 0x2BADB002
34 /* The bits in the required part of flags field we don't support. */
35 #define MB_UNSUPPORTED 0x0000fffc
37 /* Alignment of multiboot modules. */
38 #define MB_MOD_ALIGN 0x00001000
41 * Flags set in the 'flags' member of the multiboot header.
44 /* Align all boot modules on i386 page (4KB) boundaries. */
45 #define MB_PAGE_ALIGN 0x00000001
47 /* Must pass memory information to OS. */
48 #define MB_MEMORY_INFO 0x00000002
50 /* Must pass video information to OS. */
51 #define MB_VIDEO_MODE 0x00000004
53 /* This flag indicates the use of the address fields in the header. */
54 #define MB_AOUT_KLUDGE 0x00010000
57 * Flags to be set in the 'flags' member of the multiboot info structure.
60 /* is there basic lower/upper memory information? */
61 #define MB_INFO_MEMORY 0x00000001
62 /* is there a boot device set? */
63 #define MB_INFO_BOOTDEV 0x00000002
64 /* is the command-line defined? */
65 #define MB_INFO_CMDLINE 0x00000004
66 /* are there modules to do something with? */
67 #define MB_INFO_MODS 0x00000008
69 /* These next two are mutually exclusive */
71 /* is there a symbol table loaded? */
72 #define MB_INFO_AOUT_SYMS 0x00000010
73 /* is there an ELF section header table? */
74 #define MB_INFO_ELF_SHDR 0x00000020
76 /* is there a full memory map? */
77 #define MB_INFO_MEM_MAP 0x00000040
79 /* Is there drive info? */
80 #define MB_INFO_DRIVE_INFO 0x00000080
82 /* Is there a config table? */
83 #define MB_INFO_CONFIG_TABLE 0x00000100
85 /* Is there a boot loader name? */
86 #define MB_INFO_BOOT_LOADER_NAME 0x00000200
88 /* Is there a APM table? */
89 #define MB_INFO_APM_TABLE 0x00000400
91 /* Is there video information? */
92 #define MB_INFO_VIDEO_INFO 0x00000800
94 struct multiboot_header {
95 /* Must be MB_MAGIC - see above. */
101 /* The above fields plus this one must equal 0 mod 2^32. */
104 /* These are only valid if MB_AOUT_KLUDGE is set. */
105 uint32_t header_addr;
107 uint32_t load_end_addr;
108 uint32_t bss_end_addr;
111 /* These are only valid if MB_VIDEO_MODE is set. */
118 struct multiboot_info {
119 /* Multiboot info version number */
122 /* Available memory from BIOS */
126 /* "root" partition */
127 uint32_t boot_device;
129 /* Kernel command line */
132 /* Boot-Module list */
138 /* Memory Mapping buffer */
139 uint32_t mmap_length;
142 /* Drive Info buffer */
143 uint32_t drives_length;
144 uint32_t drives_addr;
146 /* ROM configuration table */
147 uint32_t config_table;
149 /* Boot Loader Name */
150 uint32_t boot_loader_name;
156 uint32_t vbe_control_info;
157 uint32_t vbe_mode_info;
159 uint16_t vbe_interface_seg;
160 uint16_t vbe_interface_off;
161 uint16_t vbe_interface_len;
164 struct multiboot_mmap_entry {
169 } __attribute__ ((packed));
171 extern struct multiboot_info *mbi;
173 unsigned long write_multiboot_info(unsigned long, unsigned long, unsigned long, unsigned long);