arm: protect state after signal handler
[minix.git] / sys / arch / i386 / include / multiboot.h
blob19291b283bdd0eb4ef0dc6cc504c918367910631
1 /* $NetBSD: multiboot.h,v 1.8 2009/02/22 18:05:42 ahoka Exp $ */
3 /*-
4 * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
5 * All rights reserved.
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
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.
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.
31 #ifndef __MULTIBOOT_H__
32 #define __MULTIBOOT_H__
34 #if !defined(_KERNEL) && defined(_STANDALONE)
36 /* --------------------------------------------------------------------- */
39 * Multiboot header structure.
41 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002
42 #define MULTIBOOT_HEADER_MODS_ALIGNED 0x00000001
43 #define MULTIBOOT_HEADER_WANT_MEMORY 0x00000002
44 #define MULTIBOOT_HEADER_HAS_VBE 0x00000004
45 #define MULTIBOOT_HEADER_HAS_ADDR 0x00010000
47 #if !defined(_LOCORE)
48 struct multiboot_header {
49 uint32_t mh_magic;
50 uint32_t mh_flags;
51 uint32_t mh_checksum;
53 /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */
54 paddr_t mh_header_addr;
55 paddr_t mh_load_addr;
56 paddr_t mh_load_end_addr;
57 paddr_t mh_bss_end_addr;
58 paddr_t mh_entry_addr;
60 /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE. */
61 uint32_t mh_mode_type;
62 uint32_t mh_width;
63 uint32_t mh_height;
64 uint32_t mh_depth;
66 #endif /* !defined(_LOCORE) */
69 * Symbols defined in locore.S.
71 #if !defined(_LOCORE) && defined(_KERNEL)
72 extern struct multiboot_header *Multiboot_Header;
73 #endif /* !defined(_LOCORE) && defined(_KERNEL) */
75 /* --------------------------------------------------------------------- */
78 * Multiboot information structure.
80 #define MULTIBOOT_INFO_MAGIC 0x2BADB002
81 #define MULTIBOOT_INFO_HAS_MEMORY 0x00000001
82 #define MULTIBOOT_INFO_HAS_BOOT_DEVICE 0x00000002
83 #define MULTIBOOT_INFO_HAS_CMDLINE 0x00000004
84 #define MULTIBOOT_INFO_HAS_MODS 0x00000008
85 #define MULTIBOOT_INFO_HAS_AOUT_SYMS 0x00000010
86 #define MULTIBOOT_INFO_HAS_ELF_SYMS 0x00000020
87 #define MULTIBOOT_INFO_HAS_MMAP 0x00000040
88 #define MULTIBOOT_INFO_HAS_DRIVES 0x00000080
89 #define MULTIBOOT_INFO_HAS_CONFIG_TABLE 0x00000100
90 #define MULTIBOOT_INFO_HAS_LOADER_NAME 0x00000200
91 #define MULTIBOOT_INFO_HAS_APM_TABLE 0x00000400
92 #define MULTIBOOT_INFO_HAS_VBE 0x00000800
94 #if !defined(_LOCORE)
95 struct multiboot_info {
96 uint32_t mi_flags;
98 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MEMORY. */
99 uint32_t mi_mem_lower;
100 uint32_t mi_mem_upper;
102 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_BOOT_DEVICE. */
103 uint8_t mi_boot_device_part3;
104 uint8_t mi_boot_device_part2;
105 uint8_t mi_boot_device_part1;
106 uint8_t mi_boot_device_drive;
108 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CMDLINE. */
109 char * mi_cmdline;
111 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MODS. */
112 uint32_t mi_mods_count;
113 vaddr_t mi_mods_addr;
115 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_{AOUT,ELF}_SYMS. */
116 uint32_t mi_elfshdr_num;
117 uint32_t mi_elfshdr_size;
118 vaddr_t mi_elfshdr_addr;
119 uint32_t mi_elfshdr_shndx;
121 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MMAP. */
122 uint32_t mi_mmap_length;
123 vaddr_t mi_mmap_addr;
125 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_DRIVES. */
126 uint32_t mi_drives_length;
127 vaddr_t mi_drives_addr;
129 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CONFIG_TABLE. */
130 void * unused_mi_config_table;
132 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_LOADER_NAME. */
133 char * mi_loader_name;
135 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_APM. */
136 void * unused_mi_apm_table;
138 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_VBE. */
139 void * unused_mi_vbe_control_info;
140 void * unused_mi_vbe_mode_info;
141 paddr_t unused_mi_vbe_interface_seg;
142 paddr_t unused_mi_vbe_interface_off;
143 uint32_t unused_mi_vbe_interface_len;
146 /* --------------------------------------------------------------------- */
149 * Drive information. This describes an entry in the drives table as
150 * pointed to by mi_drives_addr.
152 struct multiboot_drive {
153 uint32_t md_length;
154 uint8_t md_number;
155 uint8_t md_mode;
156 uint16_t md_cylinders;
157 uint8_t md_heads;
158 uint8_t md_sectors;
160 /* The variable-sized 'ports' field comes here, so this structure
161 * can be longer. */
164 /* --------------------------------------------------------------------- */
167 * Memory mapping. This describes an entry in the memory mappings table
168 * as pointed to by mi_mmap_addr.
170 * Be aware that mm_size specifies the size of all other fields *except*
171 * for mm_size. In order to jump between two different entries, you
172 * have to count mm_size + 4 bytes.
174 struct multiboot_mmap {
175 uint32_t mm_size;
176 uint64_t mm_base_addr;
177 uint64_t mm_length;
178 uint32_t mm_type;
182 * Modules. This describes an entry in the modules table as pointed
183 * to by mi_mods_addr.
186 struct multiboot_module {
187 uint32_t mmo_start;
188 uint32_t mmo_end;
189 char * mmo_string;
190 uint32_t mmo_reserved;
193 #endif /* !defined(_LOCORE) */
195 /* --------------------------------------------------------------------- */
198 * Prototypes for public functions defined in multiboot.c.
200 #if !defined(_LOCORE) && defined(_KERNEL)
201 void multiboot_pre_reloc(struct multiboot_info *);
202 void multiboot_post_reloc(void);
203 void multiboot_print_info(void);
204 bool multiboot_ksyms_addsyms_elf(void);
205 #endif /* !defined(_LOCORE) */
207 /* --------------------------------------------------------------------- */
208 #else /* !defined(_KERNEL) && defined(_STANDALONE) */
209 /* LSC FIXME: OLD MINIX DEFINITION: should be removed and replace with
210 definition above... */
211 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002
213 #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
215 /* Must pass memory information to OS. */
216 #define MULTIBOOT_PAGE_ALIGN 0x00000001
218 #define MULTIBOOT_MEMORY_INFO 0x00000002
220 #define MULTIBOOT_VIDEO_MODE 0x00000004
222 #define MULTIBOOT_AOUT_KLUDGE 0x00010000
224 /* consts used for Multiboot pre-init */
226 #define MULTIBOOT_VIDEO_MODE_EGA 1
228 #define MULTIBOOT_VIDEO_BUFFER 0xB8000
230 /* Usable lower memory chunk has a upper bound */
231 #define MULTIBOOT_LOWER_MEM_MAX 0x7f800
233 #define MULTIBOOT_CONSOLE_LINES 25
234 #define MULTIBOOT_CONSOLE_COLS 80
236 #define MULTIBOOT_VIDEO_BUFFER_BYTES \
237 (MULTIBOOT_CONSOLE_LINES*MULTIBOOT_CONSOLE_COLS*2)
239 #define MULTIBOOT_STACK_SIZE 4096
240 #define MULTIBOOT_PARAM_BUF_SIZE 1024
242 #define MULTIBOOT_MAX_MODS 20
244 /* Flags to be set in the ’flags’ member of the multiboot info structure. */
246 #define MULTIBOOT_INFO_MEMORY 0x00000001
247 #define MULTIBOOT_INFO_MEM_MAP 0x00000040
249 /* Is there a boot device set? */
250 #define MULTIBOOT_INFO_BOOTDEV 0x00000002
252 /* Is the command-line defined? */
253 #define MULTIBOOT_INFO_CMDLINE 0x00000004
255 /* Are there modules to do something with? */
256 #define MULTIBOOT_INFO_MODS 0x00000008
258 #define MULTIBOOT_HIGH_MEM_BASE 0x100000
260 #ifndef __ASSEMBLY__
262 #include <sys/types.h>
263 /* The symbol table for a.out. */
264 struct multiboot_aout_symbol_table
266 u32_t tabsize;
267 u32_t strsize;
268 u32_t addr;
269 u32_t reserved;
271 /* The section header table for ELF. */
272 struct multiboot_elf_section_header_table
274 u32_t num;
275 u32_t size;
276 u32_t addr;
277 u32_t shndx;
280 typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t;
281 typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;
283 struct multiboot_info
285 /* Multiboot info version number */
286 u32_t flags;
287 /* Available memory from BIOS */
288 u32_t mem_lower_unused; /* minix uses memmap instead */
289 u32_t mem_upper_unused;
290 /* "root" partition */
291 u32_t boot_device;
292 /* Kernel command line */
293 u32_t cmdline;
294 /* Boot-Module list */
295 u32_t mods_count;
296 u32_t mods_addr;
297 union
299 multiboot_aout_symbol_table_t aout_sym;
300 multiboot_elf_section_header_table_t elf_sec;
301 } u;
302 /* Memory Mapping buffer */
303 u32_t mmap_length;
304 u32_t mmap_addr;
305 /* Drive Info buffer */
306 u32_t drives_length;
307 u32_t drives_addr;
308 /* ROM configuration table */
309 u32_t config_table;
310 /* Boot Loader Name */
311 u32_t boot_loader_name;
312 /* APM table */
313 u32_t apm_table;
314 /* Video */
315 u32_t vbe_control_info;
316 u32_t vbe_mode_info;
317 u16_t vbe_mode;
318 u16_t vbe_interface_seg;
319 u16_t vbe_interface_off;
320 u16_t vbe_interface_len;
322 typedef struct multiboot_info multiboot_info_t;
324 struct multiboot_mod_list
326 /* Memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
327 u32_t mod_start;
328 u32_t mod_end;
329 /* Module command line */
330 u32_t cmdline;
331 /* Pad struct to 16 bytes (must be zero) */
332 u32_t pad;
334 typedef struct multiboot_mod_list multiboot_module_t;
336 #define MULTIBOOT_MEMORY_AVAILABLE 1
337 #define MULTIBOOT_MEMORY_RESERVED 2
338 struct multiboot_mmap_entry
340 u32_t size;
341 u64_t addr;
342 u64_t len;
343 #define MULTIBOOT_MEMORY_AVAILABLE 1
344 #define MULTIBOOT_MEMORY_RESERVED 2
345 u32_t type;
346 } __attribute__((packed));
347 typedef struct multiboot_mmap_entry multiboot_memory_map_t;
349 #endif /* __ASSEMBLY__ */
350 #endif /* !defined(_KERNEL) && defined(_STANDALONE) */
351 #endif /* __MULTIBOOT_H__ */