AquilaOS documentation
How it works, and its code
Toggle main menu visibility
Loading...
Searching...
No Matches
multiboot.h
Go to the documentation of this file.
1
3
/* Copyright (C) 1999,2003,2007,2008,2009 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 8192
28
29
/* The magic field should contain this. */
30
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
31
32
/* This should be in %eax. */
33
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
34
35
/* The bits in the required part of flags field we don't support. */
36
#define MULTIBOOT_UNSUPPORTED 0x0000fffc
37
38
/* Alignment of multiboot modules. */
39
#define MULTIBOOT_MOD_ALIGN 0x00001000
40
41
/* Alignment of the multiboot info structure. */
42
#define MULTIBOOT_INFO_ALIGN 0x00000004
43
44
/* Flags set in the 'flags' member of the multiboot header. */
45
46
/* Align all boot modules on i386 page (4KB) boundaries. */
47
#define MULTIBOOT_PAGE_ALIGN 0x00000001
48
49
/* Must pass memory information to OS. */
50
#define MULTIBOOT_MEMORY_INFO 0x00000002
51
52
/* Must pass video information to OS. */
53
#define MULTIBOOT_VIDEO_MODE 0x00000004
54
55
/* This flag indicates the use of the address fields in the header. */
56
#define MULTIBOOT_AOUT_KLUDGE 0x00010000
57
58
/* Flags to be set in the 'flags' member of the multiboot info structure. */
59
60
/* is there basic lower/upper memory information? */
61
#define MULTIBOOT_INFO_MEMORY 0x00000001
62
/* is there a boot device set? */
63
#define MULTIBOOT_INFO_BOOTDEV 0x00000002
64
/* is the command-line defined? */
65
#define MULTIBOOT_INFO_CMDLINE 0x00000004
66
/* are there modules to do something with? */
67
#define MULTIBOOT_INFO_MODS 0x00000008
68
69
/* These next two are mutually exclusive */
70
71
/* is there a symbol table loaded? */
72
#define MULTIBOOT_INFO_AOUT_SYMS 0x00000010
73
/* is there an ELF section header table? */
74
#define MULTIBOOT_INFO_ELF_SHDR 0X00000020
75
76
/* is there a full memory map? */
77
#define MULTIBOOT_INFO_MEM_MAP 0x00000040
78
79
/* Is there drive info? */
80
#define MULTIBOOT_INFO_DRIVE_INFO 0x00000080
81
82
/* Is there a config table? */
83
#define MULTIBOOT_INFO_CONFIG_TABLE 0x00000100
84
85
/* Is there a boot loader name? */
86
#define MULTIBOOT_INFO_BOOT_LOADER_NAME 0x00000200
87
88
/* Is there a APM table? */
89
#define MULTIBOOT_INFO_APM_TABLE 0x00000400
90
91
/* Is there video information? */
92
#define MULTIBOOT_INFO_VIDEO_INFO 0x00000800
93
94
/* is there framebuffer information? */
95
#define MULTIBOOT_INFO_FRAMEBUFFER_INFO 0x00001000
96
97
#ifndef ASM_FILE
98
99
#include <
stdint.h
>
100
101
struct
multiboot_header
102
{
103
/* Must be MULTIBOOT_MAGIC - see above. */
104
uint32_t
magic
;
105
106
/* Feature flags. */
107
uint32_t
flags
;
108
109
/* The above fields plus this one must equal 0 mod 2^32. */
110
uint32_t
checksum
;
111
112
/* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */
113
uint32_t
header_addr
;
114
uint32_t
load_addr
;
115
uint32_t
load_end_addr
;
116
uint32_t
bss_end_addr
;
117
uint32_t
entry_addr
;
118
119
/* These are only valid if MULTIBOOT_VIDEO_MODE is set. */
120
uint32_t
mode_type
;
121
uint32_t
width
;
122
uint32_t
height
;
123
uint32_t
depth
;
124
};
125
126
/* The symbol table for a.out. */
127
struct
multiboot_aout_symbol_table
128
{
129
uint32_t
tabsize
;
130
uint32_t
strsize
;
131
uint32_t
addr
;
132
uint32_t
reserved
;
133
};
134
typedef
struct
multiboot_aout_symbol_table
multiboot_aout_symbol_table_t
;
135
136
/* The section header table for ELF. */
137
struct
multiboot_elf_section_header_table
138
{
139
uint32_t
num
;
140
uint32_t
size
;
141
uint32_t
addr
;
142
uint32_t
shndx
;
143
};
144
typedef
struct
multiboot_elf_section_header_table
multiboot_elf_section_header_table_t
;
145
146
struct
multiboot_info
147
{
148
/* Multiboot info version number */
149
uint32_t
flags
;
150
151
/* Available memory from BIOS */
152
uint32_t
mem_lower
;
153
uint32_t
mem_upper
;
154
155
/* "root" partition */
156
uint32_t
boot_device
;
157
158
/* Kernel command line */
159
uint32_t
cmdline
;
160
161
/* Boot-Module list */
162
uint32_t
mods_count
;
163
uint32_t
mods_addr
;
164
165
union
166
{
167
multiboot_aout_symbol_table_t
aout_sym
;
168
multiboot_elf_section_header_table_t
elf_sec
;
169
}
u
;
170
171
/* Memory Mapping buffer */
172
uint32_t
mmap_length
;
173
uint32_t
mmap_addr
;
174
175
/* Drive Info buffer */
176
uint32_t
drives_length
;
177
uint32_t
drives_addr
;
178
179
/* ROM configuration table */
180
uint32_t
config_table
;
181
182
/* Boot Loader Name */
183
uint32_t
boot_loader_name
;
184
185
/* APM table */
186
uint32_t
apm_table
;
187
188
/* Video */
189
uint32_t
vbe_control_info
;
190
uint32_t
vbe_mode_info
;
191
uint16_t
vbe_mode
;
192
uint16_t
vbe_interface_seg
;
193
uint16_t
vbe_interface_off
;
194
uint16_t
vbe_interface_len
;
195
196
/* Framebuffer, valid if MULTIBOOT_INFO_FRAMEBUFFER_INFO is set */
197
uint64_t
framebuffer_addr
;
198
uint32_t
framebuffer_pitch
;
199
uint32_t
framebuffer_width
;
200
uint32_t
framebuffer_height
;
201
uint8_t
framebuffer_bpp
;
202
#define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
203
#define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
204
#define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
205
uint8_t
framebuffer_type
;
206
uint8_t
framebuffer_color_info
[6];
207
};
208
typedef
struct
multiboot_info
multiboot_info_t
;
209
210
struct
multiboot_mmap_entry
211
{
212
uint32_t
size
;
213
uint64_t
addr
;
214
uint64_t
len
;
215
#define MULTIBOOT_MEMORY_AVAILABLE 1
216
#define MULTIBOOT_MEMORY_RESERVED 2
217
uint32_t
type
;
218
} __attribute__((packed));
219
typedef
struct
multiboot_mmap_entry
multiboot_mmap_t
;
220
221
struct
multiboot_mod_list
222
{
223
/* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
224
uint32_t
mod_start
;
225
uint32_t
mod_end
;
226
227
/* Module command line */
228
uint32_t
cmdline
;
229
230
/* padding to take it to 16 bytes (must be zero) */
231
uint32_t
pad
;
232
};
233
typedef
struct
multiboot_mod_list
multiboot_module_t
;
234
235
extern
uint32_t
multiboot_signature
;
236
extern
uint32_t
multiboot_info
;
237
238
#endif
/* ! ASM_FILE */
239
240
#endif
/* ! MULTIBOOT_HEADER */
multiboot_mmap_t
struct multiboot_mmap_entry multiboot_mmap_t
Definition
multiboot.h:219
multiboot_elf_section_header_table_t
struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t
Definition
multiboot.h:144
multiboot_aout_symbol_table_t
struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t
Definition
multiboot.h:134
multiboot_signature
uint32_t multiboot_signature
multiboot_module_t
struct multiboot_mod_list multiboot_module_t
Definition
multiboot.h:233
multiboot_info_t
struct multiboot_info multiboot_info_t
Definition
multiboot.h:208
uint32_t
unsigned int uint32_t
Definition
stddef.h:22
uint8_t
unsigned char uint8_t
Definition
stddef.h:20
uint64_t
unsigned long long int uint64_t
Definition
stddef.h:23
uint16_t
unsigned short int uint16_t
Definition
stddef.h:21
stdint.h
multiboot_aout_symbol_table
Definition
multiboot.h:128
multiboot_aout_symbol_table::strsize
uint32_t strsize
Definition
multiboot.h:130
multiboot_aout_symbol_table::addr
uint32_t addr
Definition
multiboot.h:131
multiboot_aout_symbol_table::tabsize
uint32_t tabsize
Definition
multiboot.h:129
multiboot_aout_symbol_table::reserved
uint32_t reserved
Definition
multiboot.h:132
multiboot_elf_section_header_table
Definition
multiboot.h:138
multiboot_elf_section_header_table::addr
uint32_t addr
Definition
multiboot.h:141
multiboot_elf_section_header_table::shndx
uint32_t shndx
Definition
multiboot.h:142
multiboot_elf_section_header_table::size
uint32_t size
Definition
multiboot.h:140
multiboot_elf_section_header_table::num
uint32_t num
Definition
multiboot.h:139
multiboot_header
Definition
multiboot.h:102
multiboot_header::magic
uint32_t magic
Definition
multiboot.h:104
multiboot_header::checksum
uint32_t checksum
Definition
multiboot.h:110
multiboot_header::flags
uint32_t flags
Definition
multiboot.h:107
multiboot_header::bss_end_addr
uint32_t bss_end_addr
Definition
multiboot.h:116
multiboot_header::load_end_addr
uint32_t load_end_addr
Definition
multiboot.h:115
multiboot_header::height
uint32_t height
Definition
multiboot.h:122
multiboot_header::load_addr
uint32_t load_addr
Definition
multiboot.h:114
multiboot_header::depth
uint32_t depth
Definition
multiboot.h:123
multiboot_header::width
uint32_t width
Definition
multiboot.h:121
multiboot_header::header_addr
uint32_t header_addr
Definition
multiboot.h:113
multiboot_header::entry_addr
uint32_t entry_addr
Definition
multiboot.h:117
multiboot_header::mode_type
uint32_t mode_type
Definition
multiboot.h:120
multiboot_info
Definition
multiboot.h:147
multiboot_info::vbe_control_info
uint32_t vbe_control_info
Definition
multiboot.h:189
multiboot_info::drives_length
uint32_t drives_length
Definition
multiboot.h:176
multiboot_info::boot_device
uint32_t boot_device
Definition
multiboot.h:156
multiboot_info::flags
uint32_t flags
Definition
multiboot.h:149
multiboot_info::vbe_mode_info
uint32_t vbe_mode_info
Definition
multiboot.h:190
multiboot_info::framebuffer_type
uint8_t framebuffer_type
Definition
multiboot.h:205
multiboot_info::framebuffer_pitch
uint32_t framebuffer_pitch
Definition
multiboot.h:198
multiboot_info::vbe_interface_off
uint16_t vbe_interface_off
Definition
multiboot.h:193
multiboot_info::mmap_length
uint32_t mmap_length
Definition
multiboot.h:172
multiboot_info::vbe_interface_len
uint16_t vbe_interface_len
Definition
multiboot.h:194
multiboot_info::vbe_mode
uint16_t vbe_mode
Definition
multiboot.h:191
multiboot_info::u
union multiboot_info::@271253110040301035057036353331356106057115263040 u
multiboot_info::mem_lower
uint32_t mem_lower
Definition
multiboot.h:152
multiboot_info::mem_upper
uint32_t mem_upper
Definition
multiboot.h:153
multiboot_info::mods_addr
uint32_t mods_addr
Definition
multiboot.h:163
multiboot_info::cmdline
uint32_t cmdline
Definition
multiboot.h:159
multiboot_info::apm_table
uint32_t apm_table
Definition
multiboot.h:186
multiboot_info::drives_addr
uint32_t drives_addr
Definition
multiboot.h:177
multiboot_info::mmap_addr
uint32_t mmap_addr
Definition
multiboot.h:173
multiboot_info::framebuffer_color_info
uint8_t framebuffer_color_info[6]
Definition
multiboot.h:206
multiboot_info::config_table
uint32_t config_table
Definition
multiboot.h:180
multiboot_info::framebuffer_addr
uint64_t framebuffer_addr
Definition
multiboot.h:197
multiboot_info::framebuffer_width
uint32_t framebuffer_width
Definition
multiboot.h:199
multiboot_info::mods_count
uint32_t mods_count
Definition
multiboot.h:162
multiboot_info::boot_loader_name
uint32_t boot_loader_name
Definition
multiboot.h:183
multiboot_info::framebuffer_height
uint32_t framebuffer_height
Definition
multiboot.h:200
multiboot_info::framebuffer_bpp
uint8_t framebuffer_bpp
Definition
multiboot.h:201
multiboot_info::vbe_interface_seg
uint16_t vbe_interface_seg
Definition
multiboot.h:192
multiboot_mmap_entry
Definition
multiboot.h:211
multiboot_mmap_entry::type
uint32_t type
Definition
multiboot.h:217
multiboot_mmap_entry::len
uint64_t len
Definition
multiboot.h:214
multiboot_mmap_entry::addr
uint64_t addr
Definition
multiboot.h:213
multiboot_mmap_entry::size
uint32_t size
Definition
multiboot.h:212
multiboot_mod_list
Definition
multiboot.h:222
multiboot_mod_list::mod_start
uint32_t mod_start
Definition
multiboot.h:224
multiboot_mod_list::cmdline
uint32_t cmdline
Definition
multiboot.h:228
multiboot_mod_list::mod_end
uint32_t mod_end
Definition
multiboot.h:225
multiboot_mod_list::pad
uint32_t pad
Definition
multiboot.h:231
multiboot_info::[union].u::aout_sym
multiboot_aout_symbol_table_t aout_sym
multiboot_info::[union].u::elf_sec
multiboot_elf_section_header_table_t elf_sec
kernel
arch
i386
include
boot
multiboot.h
Generated by
1.18.0