1 /* $NetBSD: multiboot.h,v 1.8 2009/02/22 18:05:42 ahoka Exp $ */
4 * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Julio M. Merino Vidal.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
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.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 /* --------------------------------------------------------------------- */
35 * Multiboot header structure.
37 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002
38 #define MULTIBOOT_HEADER_MODS_ALIGNED 0x00000001
39 #define MULTIBOOT_HEADER_WANT_MEMORY 0x00000002
40 #define MULTIBOOT_HEADER_HAS_VBE 0x00000004
41 #define MULTIBOOT_HEADER_HAS_ADDR 0x00010000
44 struct multiboot_header
{
49 /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */
50 paddr_t mh_header_addr
;
52 paddr_t mh_load_end_addr
;
53 paddr_t mh_bss_end_addr
;
54 paddr_t mh_entry_addr
;
56 /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE. */
57 uint32_t mh_mode_type
;
62 #endif /* !defined(_LOCORE) */
65 * Symbols defined in locore.S.
67 #if !defined(_LOCORE) && defined(_KERNEL)
68 extern struct multiboot_header
*Multiboot_Header
;
69 #endif /* !defined(_LOCORE) && defined(_KERNEL) */
71 /* --------------------------------------------------------------------- */
74 * Multiboot information structure.
76 #define MULTIBOOT_INFO_MAGIC 0x2BADB002
77 #define MULTIBOOT_INFO_HAS_MEMORY 0x00000001
78 #define MULTIBOOT_INFO_HAS_BOOT_DEVICE 0x00000002
79 #define MULTIBOOT_INFO_HAS_CMDLINE 0x00000004
80 #define MULTIBOOT_INFO_HAS_MODS 0x00000008
81 #define MULTIBOOT_INFO_HAS_AOUT_SYMS 0x00000010
82 #define MULTIBOOT_INFO_HAS_ELF_SYMS 0x00000020
83 #define MULTIBOOT_INFO_HAS_MMAP 0x00000040
84 #define MULTIBOOT_INFO_HAS_DRIVES 0x00000080
85 #define MULTIBOOT_INFO_HAS_CONFIG_TABLE 0x00000100
86 #define MULTIBOOT_INFO_HAS_LOADER_NAME 0x00000200
87 #define MULTIBOOT_INFO_HAS_APM_TABLE 0x00000400
88 #define MULTIBOOT_INFO_HAS_VBE 0x00000800
91 struct multiboot_info
{
94 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MEMORY. */
95 uint32_t mi_mem_lower
;
96 uint32_t mi_mem_upper
;
98 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_BOOT_DEVICE. */
99 uint8_t mi_boot_device_part3
;
100 uint8_t mi_boot_device_part2
;
101 uint8_t mi_boot_device_part1
;
102 uint8_t mi_boot_device_drive
;
104 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CMDLINE. */
107 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MODS. */
108 uint32_t mi_mods_count
;
109 vaddr_t mi_mods_addr
;
111 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_{AOUT,ELF}_SYMS. */
112 uint32_t mi_elfshdr_num
;
113 uint32_t mi_elfshdr_size
;
114 vaddr_t mi_elfshdr_addr
;
115 uint32_t mi_elfshdr_shndx
;
117 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MMAP. */
118 uint32_t mi_mmap_length
;
119 vaddr_t mi_mmap_addr
;
121 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_DRIVES. */
122 uint32_t mi_drives_length
;
123 vaddr_t mi_drives_addr
;
125 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CONFIG_TABLE. */
126 void * unused_mi_config_table
;
128 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_LOADER_NAME. */
129 char * mi_loader_name
;
131 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_APM. */
132 void * unused_mi_apm_table
;
134 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_VBE. */
135 void * unused_mi_vbe_control_info
;
136 void * unused_mi_vbe_mode_info
;
137 paddr_t unused_mi_vbe_interface_seg
;
138 paddr_t unused_mi_vbe_interface_off
;
139 uint32_t unused_mi_vbe_interface_len
;
142 /* --------------------------------------------------------------------- */
145 * Drive information. This describes an entry in the drives table as
146 * pointed to by mi_drives_addr.
148 struct multiboot_drive
{
152 uint16_t md_cylinders
;
156 /* The variable-sized 'ports' field comes here, so this structure
160 /* --------------------------------------------------------------------- */
163 * Memory mapping. This describes an entry in the memory mappings table
164 * as pointed to by mi_mmap_addr.
166 * Be aware that mm_size specifies the size of all other fields *except*
167 * for mm_size. In order to jump between two different entries, you
168 * have to count mm_size + 4 bytes.
170 struct multiboot_mmap
{
172 uint64_t mm_base_addr
;
178 * Modules. This describes an entry in the modules table as pointed
179 * to by mi_mods_addr.
182 struct multiboot_module
{
186 uint32_t mmo_reserved
;
189 #endif /* !defined(_LOCORE) */
191 /* --------------------------------------------------------------------- */
194 * Prototypes for public functions defined in multiboot.c.
196 #if !defined(_LOCORE) && defined(_KERNEL)
197 void multiboot_pre_reloc(struct multiboot_info
*);
198 void multiboot_post_reloc(void);
199 void multiboot_print_info(void);
200 bool multiboot_ksyms_addsyms_elf(void);
201 #endif /* !defined(_LOCORE) */
203 /* --------------------------------------------------------------------- */