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