Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/stand/i386/libi386/multiboot.h
34869 views
1
/* multiboot.h - Multiboot header file. */
2
/* Copyright (C) 1999,2003,2007,2008,2009 Free Software Foundation, Inc.
3
*
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:
10
*
11
* The above copyright notice and this permission notice shall be included in
12
* all copies or substantial portions of the Software.
13
*
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.
20
*
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
#ifndef ASM_FILE
95
96
typedef unsigned short multiboot_uint16_t;
97
typedef unsigned int multiboot_uint32_t;
98
typedef unsigned long long multiboot_uint64_t;
99
100
struct multiboot_header
101
{
102
/* Must be MULTIBOOT_MAGIC - see above. */
103
multiboot_uint32_t magic;
104
105
/* Feature flags. */
106
multiboot_uint32_t flags;
107
108
/* The above fields plus this one must equal 0 mod 2^32. */
109
multiboot_uint32_t checksum;
110
111
/* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */
112
multiboot_uint32_t header_addr;
113
multiboot_uint32_t load_addr;
114
multiboot_uint32_t load_end_addr;
115
multiboot_uint32_t bss_end_addr;
116
multiboot_uint32_t entry_addr;
117
118
/* These are only valid if MULTIBOOT_VIDEO_MODE is set. */
119
multiboot_uint32_t mode_type;
120
multiboot_uint32_t width;
121
multiboot_uint32_t height;
122
multiboot_uint32_t depth;
123
};
124
125
/* The symbol table for a.out. */
126
struct multiboot_aout_symbol_table
127
{
128
multiboot_uint32_t tabsize;
129
multiboot_uint32_t strsize;
130
multiboot_uint32_t addr;
131
multiboot_uint32_t reserved;
132
};
133
typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;
134
135
/* The section header table for ELF. */
136
struct multiboot_elf_section_header_table
137
{
138
multiboot_uint32_t num;
139
multiboot_uint32_t size;
140
multiboot_uint32_t addr;
141
multiboot_uint32_t shndx;
142
};
143
typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t;
144
145
struct multiboot_info
146
{
147
/* Multiboot info version number */
148
multiboot_uint32_t flags;
149
150
/* Available memory from BIOS */
151
multiboot_uint32_t mem_lower;
152
multiboot_uint32_t mem_upper;
153
154
/* "root" partition */
155
multiboot_uint32_t boot_device;
156
157
/* Kernel command line */
158
multiboot_uint32_t cmdline;
159
160
/* Boot-Module list */
161
multiboot_uint32_t mods_count;
162
multiboot_uint32_t mods_addr;
163
164
union
165
{
166
multiboot_aout_symbol_table_t aout_sym;
167
multiboot_elf_section_header_table_t elf_sec;
168
} u;
169
170
/* Memory Mapping buffer */
171
multiboot_uint32_t mmap_length;
172
multiboot_uint32_t mmap_addr;
173
174
/* Drive Info buffer */
175
multiboot_uint32_t drives_length;
176
multiboot_uint32_t drives_addr;
177
178
/* ROM configuration table */
179
multiboot_uint32_t config_table;
180
181
/* Boot Loader Name */
182
multiboot_uint32_t boot_loader_name;
183
184
/* APM table */
185
multiboot_uint32_t apm_table;
186
187
/* Video */
188
multiboot_uint32_t vbe_control_info;
189
multiboot_uint32_t vbe_mode_info;
190
multiboot_uint16_t vbe_mode;
191
multiboot_uint16_t vbe_interface_seg;
192
multiboot_uint16_t vbe_interface_off;
193
multiboot_uint16_t vbe_interface_len;
194
};
195
typedef struct multiboot_info multiboot_info_t;
196
197
struct multiboot_mmap_entry
198
{
199
multiboot_uint32_t size;
200
multiboot_uint64_t addr;
201
multiboot_uint64_t len;
202
#define MULTIBOOT_MEMORY_AVAILABLE 1
203
#define MULTIBOOT_MEMORY_RESERVED 2
204
multiboot_uint32_t type;
205
} __attribute__((packed));
206
typedef struct multiboot_mmap_entry multiboot_memory_map_t;
207
208
struct multiboot_mod_list
209
{
210
/* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
211
multiboot_uint32_t mod_start;
212
multiboot_uint32_t mod_end;
213
214
/* Module command line */
215
multiboot_uint32_t cmdline;
216
217
/* padding to take it to 16 bytes (must be zero) */
218
multiboot_uint32_t pad;
219
};
220
typedef struct multiboot_mod_list multiboot_module_t;
221
222
#endif /* ! ASM_FILE */
223
224
#endif /* ! MULTIBOOT_HEADER */
225
226