| 1 |
/* |
| 2 |
* GRUB -- GRand Unified Bootloader |
| 3 |
* Copyright (C) 2000,2003 Free Software Foundation, Inc. |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program; If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
/* |
| 20 |
* The structure type "mod_list" is used by the "multiboot_info" structure. |
| 21 |
*/ |
| 22 |
|
| 23 |
struct mod_list |
| 24 |
{ |
| 25 |
/* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */ |
| 26 |
unsigned long mod_start; |
| 27 |
unsigned long mod_end; |
| 28 |
|
| 29 |
/* Module command line */ |
| 30 |
unsigned long cmdline; |
| 31 |
|
| 32 |
/* padding to take it to 16 bytes (must be zero) */ |
| 33 |
unsigned long pad; |
| 34 |
}; |
| 35 |
|
| 36 |
|
| 37 |
/* |
| 38 |
* INT-15, AX=E820 style "AddressRangeDescriptor" |
| 39 |
* ...with a "size" parameter on the front which is the structure size - 4, |
| 40 |
* pointing to the next one, up until the full buffer length of the memory |
| 41 |
* map has been reached. |
| 42 |
*/ |
| 43 |
|
| 44 |
struct AddrRangeDesc |
| 45 |
{ |
| 46 |
unsigned long size; |
| 47 |
unsigned long long BaseAddr; |
| 48 |
unsigned long long Length; |
| 49 |
unsigned long Type; |
| 50 |
|
| 51 |
/* unspecified optional padding... */ |
| 52 |
} __attribute__ ((packed)); |
| 53 |
|
| 54 |
/* usable memory "Type", all others are reserved. */ |
| 55 |
#define MB_ARD_MEMORY 1 |
| 56 |
|
| 57 |
|
| 58 |
/* Drive Info structure. */ |
| 59 |
struct drive_info |
| 60 |
{ |
| 61 |
/* The size of this structure. */ |
| 62 |
unsigned long size; |
| 63 |
|
| 64 |
/* The BIOS drive number. */ |
| 65 |
unsigned char drive_number; |
| 66 |
|
| 67 |
/* The access mode (see below). */ |
| 68 |
unsigned char drive_mode; |
| 69 |
|
| 70 |
/* The BIOS geometry. */ |
| 71 |
unsigned short drive_cylinders; |
| 72 |
unsigned char drive_heads; |
| 73 |
unsigned char drive_sectors; |
| 74 |
|
| 75 |
/* The array of I/O ports used for the drive. */ |
| 76 |
unsigned short drive_ports[0]; |
| 77 |
}; |
| 78 |
|
| 79 |
/* Drive Mode. */ |
| 80 |
#define MB_DI_CHS_MODE 0 |
| 81 |
#define MB_DI_LBA_MODE 1 |
| 82 |
|
| 83 |
|
| 84 |
/* APM BIOS info. */ |
| 85 |
struct apm_info |
| 86 |
{ |
| 87 |
unsigned short version; |
| 88 |
unsigned short cseg; |
| 89 |
unsigned long offset; |
| 90 |
unsigned short cseg_16; |
| 91 |
unsigned short dseg_16; |
| 92 |
unsigned short cseg_len; |
| 93 |
unsigned short cseg_16_len; |
| 94 |
unsigned short dseg_16_len; |
| 95 |
}; |
| 96 |
|
| 97 |
|
| 98 |
/* |
| 99 |
* MultiBoot Info description |
| 100 |
* |
| 101 |
* This is the struct passed to the boot image. This is done by placing |
| 102 |
* its address in the EAX register. |
| 103 |
*/ |
| 104 |
|
| 105 |
struct multiboot_info |
| 106 |
{ |
| 107 |
/* MultiBoot info version number */ |
| 108 |
unsigned long flags; |
| 109 |
|
| 110 |
/* Available memory from BIOS */ |
| 111 |
unsigned long mem_lower; |
| 112 |
unsigned long mem_upper; |
| 113 |
|
| 114 |
/* "root" partition */ |
| 115 |
unsigned long boot_device; |
| 116 |
|
| 117 |
/* Kernel command line */ |
| 118 |
unsigned long cmdline; |
| 119 |
|
| 120 |
/* Boot-Module list */ |
| 121 |
unsigned long mods_count; |
| 122 |
unsigned long mods_addr; |
| 123 |
|
| 124 |
union |
| 125 |
{ |
| 126 |
struct |
| 127 |
{ |
| 128 |
/* (a.out) Kernel symbol table info */ |
| 129 |
unsigned long tabsize; |
| 130 |
unsigned long strsize; |
| 131 |
unsigned long addr; |
| 132 |
unsigned long pad; |
| 133 |
} |
| 134 |
a; |
| 135 |
|
| 136 |
struct |
| 137 |
{ |
| 138 |
/* (ELF) Kernel section header table */ |
| 139 |
unsigned long num; |
| 140 |
unsigned long size; |
| 141 |
unsigned long addr; |
| 142 |
unsigned long shndx; |
| 143 |
} |
| 144 |
e; |
| 145 |
} |
| 146 |
syms; |
| 147 |
|
| 148 |
/* Memory Mapping buffer */ |
| 149 |
unsigned long mmap_length; |
| 150 |
unsigned long mmap_addr; |
| 151 |
|
| 152 |
/* Drive Info buffer */ |
| 153 |
unsigned long drives_length; |
| 154 |
unsigned long drives_addr; |
| 155 |
|
| 156 |
/* ROM configuration table */ |
| 157 |
unsigned long config_table; |
| 158 |
|
| 159 |
/* Boot Loader Name */ |
| 160 |
unsigned long boot_loader_name; |
| 161 |
|
| 162 |
/* APM table */ |
| 163 |
unsigned long apm_table; |
| 164 |
|
| 165 |
/* Video */ |
| 166 |
unsigned long vbe_control_info; |
| 167 |
unsigned long vbe_mode_info; |
| 168 |
unsigned short vbe_mode; |
| 169 |
unsigned short vbe_interface_seg; |
| 170 |
unsigned short vbe_interface_off; |
| 171 |
unsigned short vbe_interface_len; |
| 172 |
}; |
| 173 |
|
| 174 |
/* |
| 175 |
* Flags to be set in the 'flags' parameter above |
| 176 |
*/ |
| 177 |
|
| 178 |
/* is there basic lower/upper memory information? */ |
| 179 |
#define MB_INFO_MEMORY 0x00000001 |
| 180 |
/* is there a boot device set? */ |
| 181 |
#define MB_INFO_BOOTDEV 0x00000002 |
| 182 |
/* is the command-line defined? */ |
| 183 |
#define MB_INFO_CMDLINE 0x00000004 |
| 184 |
/* are there modules to do something with? */ |
| 185 |
#define MB_INFO_MODS 0x00000008 |
| 186 |
|
| 187 |
/* These next two are mutually exclusive */ |
| 188 |
|
| 189 |
/* is there a symbol table loaded? */ |
| 190 |
#define MB_INFO_AOUT_SYMS 0x00000010 |
| 191 |
/* is there an ELF section header table? */ |
| 192 |
#define MB_INFO_ELF_SHDR 0x00000020 |
| 193 |
|
| 194 |
/* is there a full memory map? */ |
| 195 |
#define MB_INFO_MEM_MAP 0x00000040 |
| 196 |
|
| 197 |
/* Is there drive info? */ |
| 198 |
#define MB_INFO_DRIVE_INFO 0x00000080 |
| 199 |
|
| 200 |
/* Is there a config table? */ |
| 201 |
#define MB_INFO_CONFIG_TABLE 0x00000100 |
| 202 |
|
| 203 |
/* Is there a boot loader name? */ |
| 204 |
#define MB_INFO_BOOT_LOADER_NAME 0x00000200 |
| 205 |
|
| 206 |
/* Is there a APM table? */ |
| 207 |
#define MB_INFO_APM_TABLE 0x00000400 |
| 208 |
|
| 209 |
/* Is there video information? */ |
| 210 |
#define MB_INFO_VIDEO_INFO 0x00000800 |
| 211 |
|
| 212 |
/* |
| 213 |
* The following value must be present in the EAX register. |
| 214 |
*/ |
| 215 |
|
| 216 |
#define MULTIBOOT_VALID 0x2BADB002 |