blob: f5d3310813eee18deff68711259dc09375a4cd53 [file] [log] [blame]
Corey Tabaka84697242009-03-26 02:32:01 -04001/*
2 * Copyright (c) 2009 Corey Tabaka
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files
6 * (the "Software"), to deal in the Software without restriction,
7 * including without limitation the rights to use, copy, modify, merge,
8 * publish, distribute, sublicense, and/or sell copies of the Software,
9 * and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23#ifndef __PLATFORM_MULTIBOOT_H
24#define __PLATFORM_MULTIBOOT_H
25
26#include <sys/types.h>
27
28/* magic number for multiboot header */
29#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
30
31/* flags for multiboot header */
32#ifdef __ELF__
33#define MULTIBOOT_HEADER_FLAGS 0x00000003
34#else
35#define MULTIBOOT_HEADER_FLAGS 0x00010003
36#endif
37
38/* magic number passed by multiboot-compliant boot loaders */
39#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
40
41#ifndef ASSEMBLY
42
43/* multiboot header */
44typedef struct multiboot_header
45{
46 uint32_t magic;
47 uint32_t flags;
48 uint32_t checksum;
49 uint32_t header_addr;
50 uint32_t load_addr;
51 uint32_t load_end_addr;
52 uint32_t bss_end_addr;
53 uint32_t entry_addr;
54} multiboot_header_t;
55
56/* symbol table for a.out */
57typedef struct aout_symbol_table
58{
59 uint32_t tabsize;
60 uint32_t strsize;
61 uint32_t addr;
62 uint32_t reserved;
63} aout_symbol_table_t;
64
65/* section header table for ELF */
66typedef struct elf_section_header_table
67{
68 uint32_t num;
69 uint32_t size;
70 uint32_t addr;
71 uint32_t shndx;
72} elf_section_header_table_t;
73
74/* multiboot info */
75typedef struct multiboot_info
76{
77 uint32_t flags;
78 uint32_t mem_lower;
79 uint32_t mem_upper;
80 uint32_t boot_device;
81 uint32_t cmdline;
82 uint32_t mods_count;
83 uint32_t mods_addr;
84 union
85 {
86 aout_symbol_table_t aout_sym;
87 elf_section_header_table_t elf_sec;
88 } u;
89 uint32_t mmap_length;
90 uint32_t mmap_addr;
91} multiboot_info_t;
92
93enum {
94 MB_INFO_MEM_SIZE = 0x001,
95 MB_INFO_BOOT_DEV = 0x002,
96 MB_INFO_CMD_LINE = 0x004,
97 MB_INFO_MODS = 0x008,
98 MB_INFO_SYMS = 0x010,
99 MB_INFO_MMAP = 0x020,
100 MB_INFO_DRIVES = 0x040,
101 MB_INFO_CONFIG = 0x080,
102 MB_INFO_BOOT_LOADER = 0x100,
103 MB_INFO_APM_TABLE = 0x200,
104 MB_INFO_VBE = 0x400,
105};
106
107/* module structure */
108typedef struct module
109{
110 uint32_t mod_start;
111 uint32_t mod_end;
112 uint32_t string;
113 uint32_t reserved;
114} module_t;
115
116/* memory map - be careful that the offset 0 is base_addr_low without size */
117typedef struct memory_map
118{
119 uint32_t size;
120 uint32_t base_addr_low;
121 uint32_t base_addr_high;
122 uint32_t length_low;
123 uint32_t length_high;
124 uint32_t type;
125} memory_map_t;
126
127/* memory map entry types */
128enum {
129 MB_MMAP_TYPE_AVAILABLE = 0x01,
130 MB_MMAP_TYPE_RESERVED = 0x02,
131 MB_MMAP_TYPE_ACPI_RECLAIM = 0x03,
132 MB_MMAP_TYPE_ACPI_NVS = 0x04,
133};
134
135#endif
136
137#endif