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 typedef struct {
50     u32 tabsize;
51     u32 strsize;
52     u32 addr;
53     u32 reserved;
54 } aout_symbol_table_t;
55 
56 /* The section header table for ELF.  */
57 typedef struct {
58     u32 num;
59     u32 size;
60     u32 addr;
61     u32 shndx;
62 } elf_section_header_table_t;
63 
64 /* The Multiboot information.  */
65 typedef struct {
66     u32 flags;
67 
68     /* Valid if flags sets MBI_MEMLIMITS */
69     u32 mem_lower;
70     u32 mem_upper;
71 
72     /* Valid if flags sets MBI_BOOTDEV */
73     u32 boot_device;
74 
75     /* Valid if flags sets MBI_CMDLINE */
76     u32 cmdline;
77 
78     /* Valid if flags sets MBI_MODULES */
79     u32 mods_count;
80     u32 mods_addr;
81 
82     /* Valid if flags sets ... */
83     union {
84         aout_symbol_table_t aout_sym;        /* ... MBI_AOUT_SYMS */
85         elf_section_header_table_t elf_sec;  /* ... MBI_ELF_SYMS */
86     } u;
87 
88     /* Valid if flags sets MBI_MEMMAP */
89     u32 mmap_length;
90     u32 mmap_addr;
91 
92     /* Valid if flags sets MBI_DRIVES */
93     u32 drives_length;
94     u32 drives_addr;
95 
96     /* Valid if flags sets MBI_BIOSCONFIG */
97     u32 config_table;
98 
99     /* Valid if flags sets MBI_LOADERNAME */
100     u32 boot_loader_name;
101 
102     /* Valid if flags sets MBI_APM */
103     u32 apm_table;
104 } multiboot_info_t;
105 
106 /* The module structure.  */
107 typedef struct {
108     u32 mod_start;
109     u32 mod_end;
110     u32 string;
111     u32 reserved;
112 } module_t;
113 
114 /* The memory map. Be careful that the offset 0 is base_addr_low
115    but no size.  */
116 typedef struct {
117     u32 size;
118     u32 base_addr_low;
119     u32 base_addr_high;
120     u32 length_low;
121     u32 length_high;
122     u32 type;
123 } memory_map_t;
124 
125 
126 #endif /* __ASSEMBLY__ */
127 
128 #endif /* __MULTIBOOT_H__ */
129