1 | /*␉$NetBSD: multiboot.h,v 1.4 2006/10/25 13:56:16 jmmv Exp $␉*/␊ |
2 | ␊ |
3 | /*-␊ |
4 | * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.␊ |
5 | * All rights reserved.␊ |
6 | *␊ |
7 | * This code is derived from software contributed to The NetBSD Foundation␊ |
8 | * by Julio M. Merino Vidal.␊ |
9 | *␊ |
10 | * Redistribution and use in source and binary forms, with or without␊ |
11 | * modification, are permitted provided that the following conditions␊ |
12 | * are met:␊ |
13 | * 1. Redistributions of source code must retain the above copyright␊ |
14 | * notice, this list of conditions and the following disclaimer.␊ |
15 | * 2. Redistributions in binary form must reproduce the above copyright␊ |
16 | * notice, this list of conditions and the following disclaimer in the␊ |
17 | * documentation and/or other materials provided with the distribution.␊ |
18 | * 3. All advertising materials mentioning features or use of this software␊ |
19 | * must display the following acknowledgement:␊ |
20 | *␉This product includes software developed by the NetBSD␊ |
21 | *␉Foundation, Inc. and its contributors.␊ |
22 | * 4. Neither the name of The NetBSD Foundation nor the names of its␊ |
23 | * contributors may be used to endorse or promote products derived␊ |
24 | * from this software without specific prior written permission.␊ |
25 | *␊ |
26 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS␊ |
27 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED␊ |
28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR␊ |
29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS␊ |
30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR␊ |
31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF␊ |
32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS␊ |
33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN␊ |
34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)␊ |
35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE␊ |
36 | * POSSIBILITY OF SUCH DAMAGE.␊ |
37 | */␊ |
38 | ␊ |
39 | /* Modified by David Elliott <dfe@cox.net> on 2007/06/27 ␊ |
40 | - Removed checks for KERNEL define␊ |
41 | - Replaced _LOCORE def check with __ASSEMBLER__ def check␊ |
42 | - Removed prototypes for C functions we don't have␊ |
43 | - Replaced all paddr_t and vaddr_t types with uint32_t and a comment␊ |
44 | */␊ |
45 | ␊ |
46 | /* --------------------------------------------------------------------- */␊ |
47 | ␊ |
48 | /*␊ |
49 | * Multiboot header structure.␊ |
50 | */␊ |
51 | #define MULTIBOOT_HEADER_MAGIC␉␉0x1BADB002␊ |
52 | #define MULTIBOOT_HEADER_MODS_ALIGNED␉0x00000001␊ |
53 | #define MULTIBOOT_HEADER_WANT_MEMORY␉0x00000002␊ |
54 | #define MULTIBOOT_HEADER_HAS_VBE␉0x00000004␊ |
55 | #define MULTIBOOT_HEADER_HAS_ADDR␉0x00010000␊ |
56 | ␊ |
57 | #if !defined(__ASSEMBLER__)␊ |
58 | struct multiboot_header {␊ |
59 | ␉uint32_t␉mh_magic;␊ |
60 | ␉uint32_t␉mh_flags;␊ |
61 | ␉uint32_t␉mh_checksum;␊ |
62 | ␊ |
63 | ␉/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */␊ |
64 | ␉uint32_t␉mh_header_addr; /* paddr_t */␊ |
65 | ␉uint32_t␉mh_load_addr; /* paddr_t */␊ |
66 | ␉uint32_t␉mh_load_end_addr; /* paddr_t */␊ |
67 | ␉uint32_t␉mh_bss_end_addr; /* paddr_t */␊ |
68 | ␉uint32_t␉mh_entry_addr; /* paddr_t */␊ |
69 | ␊ |
70 | ␉/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE. */␊ |
71 | ␉uint32_t␉mh_mode_type;␊ |
72 | ␉uint32_t␉mh_width;␊ |
73 | ␉uint32_t␉mh_height;␊ |
74 | ␉uint32_t␉mh_depth;␊ |
75 | };␊ |
76 | #endif /* !defined(__ASSEMBLER__) */␊ |
77 | ␊ |
78 | /*␊ |
79 | * Symbols defined in locore.S.␊ |
80 | */␊ |
81 | #if !defined(__ASSEMBLER__)␊ |
82 | extern struct multiboot_header *Multiboot_Header;␊ |
83 | #endif /* !defined(__ASSEMBLER__) */␊ |
84 | ␊ |
85 | /* --------------------------------------------------------------------- */␊ |
86 | ␊ |
87 | /*␊ |
88 | * Multiboot information structure.␊ |
89 | */␊ |
90 | #define MULTIBOOT_INFO_MAGIC␉␉0x2BADB002␊ |
91 | #define MULTIBOOT_INFO_HAS_MEMORY␉0x00000001␊ |
92 | #define MULTIBOOT_INFO_HAS_BOOT_DEVICE␉0x00000002␊ |
93 | #define MULTIBOOT_INFO_HAS_CMDLINE␉0x00000004␊ |
94 | #define MULTIBOOT_INFO_HAS_MODS␉␉0x00000008␊ |
95 | #define MULTIBOOT_INFO_HAS_AOUT_SYMS␉0x00000010␊ |
96 | #define MULTIBOOT_INFO_HAS_ELF_SYMS␉0x00000020␊ |
97 | #define MULTIBOOT_INFO_HAS_MMAP␉␉0x00000040␊ |
98 | #define MULTIBOOT_INFO_HAS_DRIVES␉0x00000080␊ |
99 | #define MULTIBOOT_INFO_HAS_CONFIG_TABLE␉0x00000100␊ |
100 | #define MULTIBOOT_INFO_HAS_LOADER_NAME␉0x00000200␊ |
101 | #define MULTIBOOT_INFO_HAS_APM_TABLE␉0x00000400␊ |
102 | #define MULTIBOOT_INFO_HAS_VBE␉␉0x00000800␊ |
103 | ␊ |
104 | #if !defined(__ASSEMBLER__)␊ |
105 | struct multiboot_info {␊ |
106 | ␉uint32_t␉mi_flags;␊ |
107 | ␊ |
108 | ␉/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MEMORY. */␊ |
109 | ␉uint32_t␉mi_mem_lower;␊ |
110 | ␉uint32_t␉mi_mem_upper;␊ |
111 | ␊ |
112 | ␉/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_BOOT_DEVICE. */␊ |
113 | ␉uint8_t␉␉mi_boot_device_part3;␊ |
114 | ␉uint8_t␉␉mi_boot_device_part2;␊ |
115 | ␉uint8_t␉␉mi_boot_device_part1;␊ |
116 | ␉uint8_t␉␉mi_boot_device_drive;␊ |
117 | ␊ |
118 | ␉/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CMDLINE. */␊ |
119 | ␉char *␉␉mi_cmdline;␊ |
120 | ␊ |
121 | ␉/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MODS. */␊ |
122 | ␉uint32_t␉mi_mods_count;␊ |
123 | ␉uint32_t␉mi_mods_addr; /* vaddr_t */␊ |
124 | ␊ |
125 | ␉/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_{AOUT,ELF}_SYMS. */␊ |
126 | ␉uint32_t␉mi_elfshdr_num;␊ |
127 | ␉uint32_t␉mi_elfshdr_size;␊ |
128 | ␉uint32_t␉mi_elfshdr_addr; /* vaddr_t */␊ |
129 | ␉uint32_t␉mi_elfshdr_shndx;␊ |
130 | ␊ |
131 | ␉/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MMAP. */␊ |
132 | ␉uint32_t␉mi_mmap_length;␊ |
133 | ␉uint32_t␉mi_mmap_addr; /* vaddr_t */␊ |
134 | ␊ |
135 | ␉/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_DRIVES. */␊ |
136 | ␉uint32_t␉mi_drives_length;␊ |
137 | ␉uint32_t␉mi_drives_addr; /* vaddr_t */␊ |
138 | ␊ |
139 | ␉/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CONFIG_TABLE. */␊ |
140 | ␉void *␉␉unused_mi_config_table;␊ |
141 | ␊ |
142 | ␉/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_LOADER_NAME. */␊ |
143 | ␉char *␉␉mi_loader_name;␊ |
144 | ␊ |
145 | ␉/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_APM. */␊ |
146 | ␉void *␉␉unused_mi_apm_table;␊ |
147 | ␊ |
148 | ␉/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_VBE. */␊ |
149 | ␉void *␉␉unused_mi_vbe_control_info;␊ |
150 | ␉void *␉␉unused_mi_vbe_mode_info;␊ |
151 | ␉uint32_t␉unused_mi_vbe_interface_seg; /* paddr_t */␊ |
152 | ␉uint32_t␉unused_mi_vbe_interface_off; /* paddr_t */␊ |
153 | ␉uint32_t␉unused_mi_vbe_interface_len;␊ |
154 | };␊ |
155 | typedef struct multiboot_info multiboot_info;␊ |
156 | ␊ |
157 | /* --------------------------------------------------------------------- */␊ |
158 | ␊ |
159 | struct multiboot_module {␊ |
160 | ␉uint32_t␉mm_mod_start;␊ |
161 | ␉uint32_t␉mm_mod_end;␊ |
162 | ␉char *␉␉mm_string;␊ |
163 | ␉uint32_t␉mm_reserved;␊ |
164 | };␊ |
165 | typedef struct multiboot_module multiboot_module;␊ |
166 | ␊ |
167 | /*␊ |
168 | * Drive information. This describes an entry in the drives table as␊ |
169 | * pointed to by mi_drives_addr.␊ |
170 | */␊ |
171 | struct multiboot_drive {␊ |
172 | ␉uint32_t␉md_length;␊ |
173 | ␉uint8_t␉␉md_number;␊ |
174 | ␉uint8_t␉␉md_mode;␊ |
175 | ␉uint16_t␉md_cylinders;␊ |
176 | ␉uint8_t␉␉md_heads;␊ |
177 | ␉uint8_t␉␉md_sectors;␊ |
178 | ␊ |
179 | ␉/* The variable-sized 'ports' field comes here, so this structure␊ |
180 | ␉ * can be longer. */␊ |
181 | };␊ |
182 | ␊ |
183 | /* --------------------------------------------------------------------- */␊ |
184 | ␊ |
185 | /*␊ |
186 | * Memory mapping. This describes an entry in the memory mappings table␊ |
187 | * as pointed to by mi_mmap_addr.␊ |
188 | *␊ |
189 | * Be aware that mm_size specifies the size of all other fields *except*␊ |
190 | * for mm_size. In order to jump between two different entries, you␊ |
191 | * have to count mm_size + 4 bytes.␊ |
192 | */␊ |
193 | struct multiboot_mmap {␊ |
194 | ␉uint32_t␉mm_size;␊ |
195 | ␉uint64_t␉mm_base_addr;␊ |
196 | ␉uint64_t␉mm_length;␊ |
197 | ␉uint32_t␉mm_type;␊ |
198 | };␊ |
199 | ␊ |
200 | #endif /* !defined(__ASSEMBLER__) */␊ |
201 | ␊ |
202 | /* --------------------------------------------------------------------- */␊ |
203 | ␊ |
204 | |