Added system hive support.
[reactos.git] / freeldr / freeldr / multiboot.h
1 /* multiboot.h - the header for Multiboot */
2 /* Copyright (C) 1999 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18
19 #ifndef __MULTIBOOT_H
20 #define __MULTIBOOT_H
21
22 /* Macros. */
23
24 /* The magic number for the Multiboot header. */
25 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002
26
27 /* The flags for the Multiboot header. */
28 #define MULTIBOOT_HEADER_FLAGS 0x00010003
29
30 /* The magic number passed by a Multiboot-compliant boot loader. */
31 #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
32
33 /* The size of our stack (16KB). */
34 #define STACK_SIZE 0x4000
35
36 /* C symbol format. HAVE_ASM_USCORE is defined by configure. */
37 #ifdef HAVE_ASM_USCORE
38 # define EXT_C(sym) _ ## sym
39 #else
40 # define EXT_C(sym) sym
41 #endif
42
43 #define MB_INFO_FLAG_MEM_SIZE 0x00000001
44 #define MB_INFO_FLAG_BOOT_DEVICE 0x00000002
45 #define MB_INFO_FLAG_COMMAND_LINE 0x00000004
46 #define MB_INFO_FLAG_MODULES 0x00000008
47 #define MB_INFO_FLAG_AOUT_SYMS 0x00000010
48 #define MB_INFO_FLAG_ELF_SYMS 0x00000020
49 #define MB_INFO_FLAG_MEMORY_MAP 0x00000040
50 #define MB_INFO_FLAG_DRIVES 0x00000080
51 #define MB_INFO_FLAG_CONFIG_TABLE 0x00000100
52 #define MB_INFO_FLAG_BOOT_LOADER_NAME 0x00000200
53 #define MB_INFO_FLAG_APM_TABLE 0x00000400
54 #define MB_INFO_FLAG_GRAPHICS_TABLE 0x00000800
55
56 #ifndef ASM
57 /* Do not include here in boot.S. */
58
59 /* Types. */
60
61 /* The Multiboot header. */
62 typedef struct multiboot_header
63 {
64 unsigned long magic;
65 unsigned long flags;
66 unsigned long checksum;
67 unsigned long header_addr;
68 unsigned long load_addr;
69 unsigned long load_end_addr;
70 unsigned long bss_end_addr;
71 unsigned long entry_addr;
72 } multiboot_header_t;
73
74 /* The symbol table for a.out. */
75 typedef struct aout_symbol_table
76 {
77 unsigned long tabsize;
78 unsigned long strsize;
79 unsigned long addr;
80 unsigned long reserved;
81 } aout_symbol_table_t;
82
83 /* The section header table for ELF. */
84 typedef struct elf_section_header_table
85 {
86 unsigned long num;
87 unsigned long size;
88 unsigned long addr;
89 unsigned long shndx;
90 } elf_section_header_table_t;
91
92 /* The Multiboot information. */
93 typedef struct multiboot_info
94 {
95 unsigned long flags;
96 unsigned long mem_lower;
97 unsigned long mem_upper;
98 unsigned long boot_device;
99 unsigned long cmdline;
100 unsigned long mods_count;
101 unsigned long mods_addr;
102 union
103 {
104 aout_symbol_table_t aout_sym;
105 elf_section_header_table_t elf_sec;
106 } u;
107 unsigned long mmap_length;
108 unsigned long mmap_addr;
109 } multiboot_info_t;
110
111 /* The module structure. */
112 typedef struct module
113 {
114 unsigned long mod_start;
115 unsigned long mod_end;
116 unsigned long string;
117 unsigned long reserved;
118 } module_t;
119
120 /* The memory map. Be careful that the offset 0 is base_addr_low
121 but no size. */
122 typedef struct memory_map
123 {
124 //unsigned long size;
125 unsigned long base_addr_low;
126 unsigned long base_addr_high;
127 unsigned long length_low;
128 unsigned long length_high;
129 unsigned long type;
130 unsigned long reserved;
131 } memory_map_t;
132
133
134 multiboot_header_t mb_header; // Multiboot header structure defined in kernel image file
135 multiboot_info_t mb_info; // Multiboot info structure passed to kernel
136 char multiboot_kernel_cmdline[255]; // Command line passed to kernel
137 module_t multiboot_modules[64]; // Array to hold boot module info loaded for the kernel
138 char multiboot_module_strings[64][256]; // Array to hold module names
139 unsigned long multiboot_memory_map_descriptor_size;
140 memory_map_t multiboot_memory_map; // Memory map
141
142
143 void boot_reactos(void);
144
145 #include "fs.h" // Included FILE structure definition
146
147 BOOL MultiBootLoadKernel(FILE *KernelImage);
148 //BOOL MultiBootLoadModule(FILE *ModuleImage, char *ModuleName);
149 PVOID MultiBootLoadModule(FILE *ModuleImage, char *ModuleName, PULONG ModuleSize);
150
151 int GetBootPartition(char *OperatingSystemName);
152
153 PVOID MultiBootCreateModule(char *ModuleName);
154 BOOL MultiBootCloseModule(PVOID ModuleBase, DWORD dwModuleSize);
155
156 #endif /* ! ASM */
157
158
159 #endif // defined __MULTIBOOT_H