]> pd.if.org Git - zos/blob - multiboot.h
add a readme with a public domain note
[zos] / multiboot.h
1 #ifndef MULTIBOOT_HEADER
2 #define MULTIBOOT_HEADER 1
3
4 /* How many bytes from the start of the file to search for the header. */
5 #define MULTIBOOT_SEARCH                        8192
6
7 /* the magic field should contain this. */
8 #define MULTIBOOT_HEADER_MAGIC                  0x1badb002
9
10 /* this should be in eax */
11 #define MULTIBOOT_BOOTLOADER_MAGIC              0x2badb002
12
13 /* bits in the required part of flags field we don't support */
14 #define MULTIBOOT_UNSUPPORTED                   0x0000fffc
15
16 /* alignment of multiboot modules */
17 #define MULTIBOOT_MOD_ALIGN                     0x00001000
18
19 /* alignment of the multiboot info structure */
20 #define MULTIBOOT_INFO_ALIGN                    0x00000004
21
22 /*
23  * multiboot header flags
24  */
25
26 /* align each boot module on 4KB page boundary */
27 #define MULTIBOOT_PAGE_ALIGN                    0x00000001
28
29 /* pass memory information to OS */
30 #define MULTIBOOT_MEMORY_INFO                   0x00000002
31
32 /* pass video information to OS */
33 #define MULTIBOOT_VIDEO_MODE                    0x00000004
34
35 /* This flag indicates the use of the address fields in the header */
36 #define MULTIBOOT_AOUT_KLUDGE                   0x00010000
37
38 /* 
39  * multiboot info flags
40  */
41
42 /* has basic memory information */
43 #define MULTIBOOT_INFO_MEMORY                   0x00000001
44
45 /* has boot device */
46 #define MULTIBOOT_INFO_BOOTDEV                  0x00000002
47
48 /* has command-line */
49 #define MULTIBOOT_INFO_CMDLINE                  0x00000004
50
51 /* has modules */
52 #define MULTIBOOT_INFO_MODS                     0x00000008
53
54
55 /* only one of the next two should be set */
56 /* has a.out symbol table */
57 #define MULTIBOOT_INFO_AOUT_SYMS                0x00000010
58 /* has ELF section header table */
59 #define MULTIBOOT_INFO_ELF_SHDR                 0X00000020
60
61 /* has complete memory map */
62 #define MULTIBOOT_INFO_MEM_MAP                  0x00000040
63
64 /* has drive info */
65 #define MULTIBOOT_INFO_DRIVE_INFO               0x00000080
66
67 /* has config table */
68 #define MULTIBOOT_INFO_CONFIG_TABLE             0x00000100
69
70 /* has boot loader name */
71 #define MULTIBOOT_INFO_BOOT_LOADER_NAME         0x00000200
72
73 /* has APM table */
74 #define MULTIBOOT_INFO_APM_TABLE                0x00000400
75
76 /* has video information */
77 #define MULTIBOOT_INFO_VIDEO_INFO               0x00000800
78
79 #include <stdint.h>
80
81 struct multiboot_header {
82         uint32_t magic; /* should == MULTIBOOT_MAGIC */
83
84         uint32_t flags;
85
86         uint32_t checksum; /* magic + flags + checksum & 0xffffffff == 0 */
87
88         /* only valid if MULTIBOOT_AOUT_KLUDGE is set */
89         uint32_t header_addr;
90         uint32_t load_addr;
91         uint32_t load_end_addr;
92         uint32_t bss_end_addr;
93         uint32_t entry_addr;
94
95         /* only valid if MULTIBOOT_VIDEO_MODE is set */
96         uint32_t mode_type;
97         uint32_t width;
98         uint32_t height;
99         uint32_t depth;
100 };
101
102 /* a.out symbol table */
103 struct multiboot_aout_symbol_table {
104         uint32_t tabsize;
105         uint32_t strsize;
106         uint32_t addr;
107         uint32_t reserved;
108 };
109
110 /* ELF section header table */
111 struct multiboot_elf_section_header_table {
112         uint32_t num;
113         uint32_t size;
114         uint32_t addr;
115         uint32_t shndx;
116 };
117
118 struct multiboot_info {
119         uint32_t flags;
120
121         /* available memory from BIOS */
122         uint32_t mem_lower;
123         uint32_t mem_upper;
124
125         uint32_t boot_device; /* root partition */
126
127         uint32_t cmdline; /* kernel command line */
128
129         uint32_t mods_count; /* number of mods */
130         uint32_t mods_addr; /* physical address of list */
131
132         union {
133                 struct multiboot_aout_symbol_table aout_sym;
134                 struct multiboot_elf_section_header_table elf_sec;
135         } u;
136
137         /* memory map */
138         uint32_t mmap_length;
139         uint32_t mmap_addr;
140
141         /* drive info */
142         uint32_t drives_length;
143         uint32_t drives_addr;
144
145         /* ROM configuration table */
146         uint32_t config_table;
147
148         /* boot loader Name */
149         uint32_t boot_loader_name;
150
151         /* APM table */
152         uint32_t apm_table;
153
154         /* video information */
155         uint32_t vbe_control_info;
156         uint32_t vbe_mode_info;
157         uint16_t vbe_mode;
158         uint16_t vbe_interface_seg;
159         uint16_t vbe_interface_off;
160         uint16_t vbe_interface_len;
161 };
162
163 #define MULTIBOOT_MEMORY_AVAILABLE              1
164 #define MULTIBOOT_MEMORY_RESERVED               2
165 struct multiboot_mmap_entry {
166         uint32_t size;
167         uint64_t addr;
168         uint64_t len;
169         uint32_t type;
170 } __attribute__((packed));
171
172 struct multiboot_mod_list {
173         /* memory used goes from mod_start through mod_end-1 */
174         uint32_t mod_start;
175         uint32_t mod_end;
176
177         uint32_t cmdline;
178
179         uint32_t padding; /* each entry is 16 bytes */
180 };
181
182 #endif