Chameleon

Chameleon Svn Source Tree

Root/branches/azimutz/Chazileon/i386/boot2/multiboot.h

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_MAGIC0x1BADB002
52#define MULTIBOOT_HEADER_MODS_ALIGNED0x00000001
53#define MULTIBOOT_HEADER_WANT_MEMORY0x00000002
54#define MULTIBOOT_HEADER_HAS_VBE0x00000004
55#define MULTIBOOT_HEADER_HAS_ADDR0x00010000
56
57#if !defined(__ASSEMBLER__)
58struct multiboot_header {
59uint32_tmh_magic;
60uint32_tmh_flags;
61uint32_tmh_checksum;
62
63/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */
64uint32_tmh_header_addr; /* paddr_t */
65uint32_tmh_load_addr; /* paddr_t */
66uint32_tmh_load_end_addr; /* paddr_t */
67uint32_tmh_bss_end_addr; /* paddr_t */
68uint32_tmh_entry_addr; /* paddr_t */
69
70/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE. */
71uint32_tmh_mode_type;
72uint32_tmh_width;
73uint32_tmh_height;
74uint32_tmh_depth;
75};
76#endif /* !defined(__ASSEMBLER__) */
77
78/*
79 * Symbols defined in locore.S.
80 */
81#if !defined(__ASSEMBLER__)
82extern struct multiboot_header *Multiboot_Header;
83#endif /* !defined(__ASSEMBLER__) */
84
85/* --------------------------------------------------------------------- */
86
87/*
88 * Multiboot information structure.
89 */
90#define MULTIBOOT_INFO_MAGIC0x2BADB002
91#define MULTIBOOT_INFO_HAS_MEMORY0x00000001
92#define MULTIBOOT_INFO_HAS_BOOT_DEVICE0x00000002
93#define MULTIBOOT_INFO_HAS_CMDLINE0x00000004
94#define MULTIBOOT_INFO_HAS_MODS0x00000008
95#define MULTIBOOT_INFO_HAS_AOUT_SYMS0x00000010
96#define MULTIBOOT_INFO_HAS_ELF_SYMS0x00000020
97#define MULTIBOOT_INFO_HAS_MMAP0x00000040
98#define MULTIBOOT_INFO_HAS_DRIVES0x00000080
99#define MULTIBOOT_INFO_HAS_CONFIG_TABLE0x00000100
100#define MULTIBOOT_INFO_HAS_LOADER_NAME0x00000200
101#define MULTIBOOT_INFO_HAS_APM_TABLE0x00000400
102#define MULTIBOOT_INFO_HAS_VBE0x00000800
103
104#if !defined(__ASSEMBLER__)
105struct multiboot_info {
106uint32_tmi_flags;
107
108/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MEMORY. */
109uint32_tmi_mem_lower;
110uint32_tmi_mem_upper;
111
112/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_BOOT_DEVICE. */
113uint8_tmi_boot_device_part3;
114uint8_tmi_boot_device_part2;
115uint8_tmi_boot_device_part1;
116uint8_tmi_boot_device_drive;
117
118/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CMDLINE. */
119char *mi_cmdline;
120
121/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MODS. */
122uint32_tmi_mods_count;
123uint32_tmi_mods_addr; /* vaddr_t */
124
125/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_{AOUT,ELF}_SYMS. */
126uint32_tmi_elfshdr_num;
127uint32_tmi_elfshdr_size;
128uint32_tmi_elfshdr_addr; /* vaddr_t */
129uint32_tmi_elfshdr_shndx;
130
131/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MMAP. */
132uint32_tmi_mmap_length;
133uint32_tmi_mmap_addr; /* vaddr_t */
134
135/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_DRIVES. */
136uint32_tmi_drives_length;
137uint32_tmi_drives_addr; /* vaddr_t */
138
139/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CONFIG_TABLE. */
140void *unused_mi_config_table;
141
142/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_LOADER_NAME. */
143char *mi_loader_name;
144
145/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_APM. */
146void *unused_mi_apm_table;
147
148/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_VBE. */
149void *unused_mi_vbe_control_info;
150void *unused_mi_vbe_mode_info;
151uint32_tunused_mi_vbe_interface_seg; /* paddr_t */
152uint32_tunused_mi_vbe_interface_off; /* paddr_t */
153uint32_tunused_mi_vbe_interface_len;
154};
155typedef struct multiboot_info multiboot_info;
156
157/* --------------------------------------------------------------------- */
158
159struct multiboot_module {
160uint32_tmm_mod_start;
161uint32_tmm_mod_end;
162char *mm_string;
163uint32_tmm_reserved;
164};
165typedef 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 */
171struct multiboot_drive {
172uint32_tmd_length;
173uint8_tmd_number;
174uint8_tmd_mode;
175uint16_tmd_cylinders;
176uint8_tmd_heads;
177uint8_tmd_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 */
193struct multiboot_mmap {
194uint32_tmm_size;
195uint64_tmm_base_addr;
196uint64_tmm_length;
197uint32_tmm_type;
198};
199
200#endif /* !defined(__ASSEMBLER__) */
201
202/* --------------------------------------------------------------------- */
203
204

Archive Download this file

Revision: 296