1 /* multiboot.h - the header for Multiboot */
2 /* Copyright (C) 1999, 2001  Free Software Foundation, Inc.
3 
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2 of the License, or
7    (at your option) any later version.
8 
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13 
14    You should have received a copy of the GNU General Public License
15    along with this program; If not, see <http://www.gnu.org/licenses/>.  */
16 
17 #ifndef __MULTIBOOT_H__
18 #define __MULTIBOOT_H__
19 
20 #include "const.h"
21 
22 /*
23  * Multiboot header structure.
24  */
25 #define MULTIBOOT_HEADER_MAGIC         0x1BADB002
26 #define MULTIBOOT_HEADER_MODS_ALIGNED  0x00000001
27 #define MULTIBOOT_HEADER_WANT_MEMORY   0x00000002
28 #define MULTIBOOT_HEADER_HAS_VBE       0x00000004
29 #define MULTIBOOT_HEADER_HAS_ADDR      0x00010000
30 
31 /* The magic number passed by a Multiboot-compliant boot loader. */
32 #define MULTIBOOT_BOOTLOADER_MAGIC     0x2BADB002
33 
34 #define MBI_MEMLIMITS  (_AC(1,u) << 0)
35 #define MBI_BOOTDEV    (_AC(1,u) << 1)
36 #define MBI_CMDLINE    (_AC(1,u) << 2)
37 #define MBI_MODULES    (_AC(1,u) << 3)
38 #define MBI_AOUT_SYMS  (_AC(1,u) << 4)
39 #define MBI_ELF_SYMS   (_AC(1,u) << 5)
40 #define MBI_MEMMAP     (_AC(1,u) << 6)
41 #define MBI_DRIVES     (_AC(1,u) << 7)
42 #define MBI_BIOSCONFIG (_AC(1,u) << 8)
43 #define MBI_LOADERNAME (_AC(1,u) << 9)
44 #define MBI_APM        (_AC(1,u) << 10)
45 
46 #ifndef __ASSEMBLY__
47 
48 /* The symbol table for a.out.  */
49 struct aout_symbol_table {
50     u32 tabsize;
51     u32 strsize;
52     u32 addr;
53     u32 reserved;
54 };
55 typedef struct aout_symbol_table aout_symbol_table_t;
56 
57 /* The section header table for ELF.  */
58 struct elf_section_header_table {
59     u32 num;
60     u32 size;
61     u32 addr;
62     u32 shndx;
63 };
64 typedef struct elf_section_header_table elf_section_header_table_t;
65 
66 /* The Multiboot information.  */
67 struct multiboot_info {
68     u32 flags;
69 
70     /* Valid if flags sets MBI_MEMLIMITS */
71     u32 mem_lower;
72     u32 mem_upper;
73 
74     /* Valid if flags sets MBI_BOOTDEV */
75     u32 boot_device;
76 
77     /* Valid if flags sets MBI_CMDLINE */
78     u32 cmdline;
79 
80     /* Valid if flags sets MBI_MODULES */
81     u32 mods_count;
82     u32 mods_addr;
83 
84     /* Valid if flags sets ... */
85     union {
86         aout_symbol_table_t aout_sym;        /* ... MBI_AOUT_SYMS */
87         elf_section_header_table_t elf_sec;  /* ... MBI_ELF_SYMS */
88     } u;
89 
90     /* Valid if flags sets MBI_MEMMAP */
91     u32 mmap_length;
92     u32 mmap_addr;
93 
94     /* Valid if flags sets MBI_DRIVES */
95     u32 drives_length;
96     u32 drives_addr;
97 
98     /* Valid if flags sets MBI_BIOSCONFIG */
99     u32 config_table;
100 
101     /* Valid if flags sets MBI_LOADERNAME */
102     u32 boot_loader_name;
103 
104     /* Valid if flags sets MBI_APM */
105     u32 apm_table;
106 };
107 typedef struct multiboot_info multiboot_info_t;
108 
109 /* The module structure.  */
110 struct module {
111     u32 mod_start;
112     u32 mod_end;
113     u32 string;
114     u32 reserved;
115 };
116 typedef struct module module_t;
117 
118 /* The memory map. Be careful that the offset 0 is base_addr_low
119    but no size.  */
120 struct memory_map {
121     u32 size;
122     u32 base_addr_low;
123     u32 base_addr_high;
124     u32 length_low;
125     u32 length_high;
126     u32 type;
127 };
128 typedef struct memory_map memory_map_t;
129 
130 
131 #endif /* __ASSEMBLY__ */
132 
133 #endif /* __MULTIBOOT_H__ */
134