Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:10

0001 /*  multiboot2.h - Multiboot 2 header file.  */
0002 /*  Copyright (C) 1999,2003,2007,2008,2009,2010  Free Software Foundation, Inc.
0003  *
0004  *  Permission is hereby granted, free of charge, to any person obtaining a copy
0005  *  of this software and associated documentation files (the "Software"), to
0006  *  deal in the Software without restriction, including without limitation the
0007  *  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
0008  *  sell copies of the Software, and to permit persons to whom the Software is
0009  *  furnished to do so, subject to the following conditions:
0010  *
0011  *  The above copyright notice and this permission notice shall be included in
0012  *  all copies or substantial portions of the Software.
0013  *
0014  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL ANY
0017  *  DEVELOPER OR DISTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0018  *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
0019  *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
0020  *  IN THE SOFTWARE.
0021  */
0022 
0023 #ifndef _MULTIBOOT2_HEADER_H_
0024 #define _MULTIBOOT2_HEADER_H_
0025 
0026 /* How many bytes from the start of the file we search for the header.  */
0027 #define MULTIBOOT_SEARCH 32768
0028 #define MULTIBOOT_HEADER_ALIGN 8
0029 
0030 /* The magic field should contain this.  */
0031 #define MULTIBOOT2_HEADER_MAGIC 0xe85250d6
0032 
0033 /* This should be in %eax.  */
0034 #define MULTIBOOT2_BOOTLOADER_MAGIC 0x36d76289
0035 
0036 /* Alignment of multiboot modules.  */
0037 #define MULTIBOOT_MOD_ALIGN 0x00001000
0038 
0039 /* Alignment of the multiboot info structure.  */
0040 #define MULTIBOOT_INFO_ALIGN 0x00000008
0041 
0042 /* Flags set in the 'flags' member of the multiboot header.  */
0043 
0044 #define MULTIBOOT_TAG_ALIGN                  8
0045 #define MULTIBOOT_TAG_TYPE_END               0
0046 #define MULTIBOOT_TAG_TYPE_CMDLINE           1
0047 #define MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME  2
0048 #define MULTIBOOT_TAG_TYPE_MODULE            3
0049 #define MULTIBOOT_TAG_TYPE_BASIC_MEMINFO     4
0050 #define MULTIBOOT_TAG_TYPE_BOOTDEV           5
0051 #define MULTIBOOT_TAG_TYPE_MMAP              6
0052 #define MULTIBOOT_TAG_TYPE_VBE               7
0053 #define MULTIBOOT_TAG_TYPE_FRAMEBUFFER       8
0054 #define MULTIBOOT_TAG_TYPE_ELF_SECTIONS      9
0055 #define MULTIBOOT_TAG_TYPE_APM               10
0056 #define MULTIBOOT_TAG_TYPE_EFI32             11
0057 #define MULTIBOOT_TAG_TYPE_EFI64             12
0058 #define MULTIBOOT_TAG_TYPE_SMBIOS            13
0059 #define MULTIBOOT_TAG_TYPE_ACPI_OLD          14
0060 #define MULTIBOOT_TAG_TYPE_ACPI_NEW          15
0061 #define MULTIBOOT_TAG_TYPE_NETWORK           16
0062 #define MULTIBOOT_TAG_TYPE_EFI_MMAP          17
0063 #define MULTIBOOT_TAG_TYPE_EFI_BS            18
0064 #define MULTIBOOT_TAG_TYPE_EFI32_IH          19
0065 #define MULTIBOOT_TAG_TYPE_EFI64_IH          20
0066 #define MULTIBOOT_TAG_TYPE_LOAD_BASE_ADDR    21
0067 
0068 #define MULTIBOOT_HEADER_TAG_END  0
0069 #define MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST  1
0070 #define MULTIBOOT_HEADER_TAG_ADDRESS  2
0071 #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS  3
0072 #define MULTIBOOT_HEADER_TAG_CONSOLE_FLAGS  4
0073 #define MULTIBOOT_HEADER_TAG_FRAMEBUFFER  5
0074 #define MULTIBOOT_HEADER_TAG_MODULE_ALIGN  6
0075 #define MULTIBOOT_HEADER_TAG_EFI_BS  7
0076 #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64  9
0077 #define MULTIBOOT_HEADER_TAG_RELOCATABLE  10
0078 
0079 #define MULTIBOOT_ARCHITECTURE_I386  0
0080 #define MULTIBOOT_ARCHITECTURE_MIPS32  4
0081 #define MULTIBOOT_HEADER_TAG_OPTIONAL 1
0082 
0083 #define MULTIBOOT_LOAD_PREFERENCE_NONE 0
0084 #define MULTIBOOT_LOAD_PREFERENCE_LOW 1
0085 #define MULTIBOOT_LOAD_PREFERENCE_HIGH 2
0086 
0087 #define MULTIBOOT_CONSOLE_FLAGS_CONSOLE_REQUIRED 1
0088 #define MULTIBOOT_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED 2
0089 
0090 #ifndef __ASSEMBLER__
0091 
0092 typedef unsigned char multiboot_uint8_t;
0093 typedef unsigned short multiboot_uint16_t;
0094 typedef unsigned int multiboot_uint32_t;
0095 typedef unsigned long long multiboot_uint64_t;
0096 
0097 struct multiboot_header
0098 {
0099   /* Must be MULTIBOOT_MAGIC - see above.  */
0100   multiboot_uint32_t magic;
0101 
0102   /* ISA */
0103   multiboot_uint32_t architecture;
0104 
0105   /* Total header length.  */
0106   multiboot_uint32_t header_length;
0107 
0108   /* The above fields plus this one must equal 0 mod 2^32. */
0109   multiboot_uint32_t checksum;
0110 };
0111 
0112 struct multiboot_header_tag
0113 {
0114   multiboot_uint16_t type;
0115   multiboot_uint16_t flags;
0116   multiboot_uint32_t size;
0117 };
0118 
0119 struct multiboot_header_tag_information_request
0120 {
0121   multiboot_uint16_t type;
0122   multiboot_uint16_t flags;
0123   multiboot_uint32_t size;
0124   multiboot_uint32_t requests[0];
0125 };
0126 
0127 struct multiboot_header_tag_address
0128 {
0129   multiboot_uint16_t type;
0130   multiboot_uint16_t flags;
0131   multiboot_uint32_t size;
0132   multiboot_uint32_t header_addr;
0133   multiboot_uint32_t load_addr;
0134   multiboot_uint32_t load_end_addr;
0135   multiboot_uint32_t bss_end_addr;
0136 };
0137 
0138 struct multiboot_header_tag_entry_address
0139 {
0140   multiboot_uint16_t type;
0141   multiboot_uint16_t flags;
0142   multiboot_uint32_t size;
0143   multiboot_uint32_t entry_addr;
0144 };
0145 
0146 struct multiboot_header_tag_console_flags
0147 {
0148   multiboot_uint16_t type;
0149   multiboot_uint16_t flags;
0150   multiboot_uint32_t size;
0151   multiboot_uint32_t console_flags;
0152 };
0153 
0154 struct multiboot_header_tag_framebuffer
0155 {
0156   multiboot_uint16_t type;
0157   multiboot_uint16_t flags;
0158   multiboot_uint32_t size;
0159   multiboot_uint32_t width;
0160   multiboot_uint32_t height;
0161   multiboot_uint32_t depth;
0162 };
0163 
0164 struct multiboot_header_tag_module_align
0165 {
0166   multiboot_uint16_t type;
0167   multiboot_uint16_t flags;
0168   multiboot_uint32_t size;
0169 };
0170 
0171 struct multiboot_header_tag_relocatable
0172 {
0173   multiboot_uint16_t type;
0174   multiboot_uint16_t flags;
0175   multiboot_uint32_t size;
0176   multiboot_uint32_t min_addr;
0177   multiboot_uint32_t max_addr;
0178   multiboot_uint32_t align;
0179   multiboot_uint32_t preference;
0180 };
0181 
0182 struct multiboot_color
0183 {
0184   multiboot_uint8_t red;
0185   multiboot_uint8_t green;
0186   multiboot_uint8_t blue;
0187 };
0188 
0189 struct multiboot_mmap_entry
0190 {
0191   multiboot_uint64_t addr;
0192   multiboot_uint64_t len;
0193 #define MULTIBOOT_MEMORY_AVAILABLE 1
0194 #define MULTIBOOT_MEMORY_RESERVED 2
0195 #define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
0196 #define MULTIBOOT_MEMORY_NVS 4
0197 #define MULTIBOOT_MEMORY_BADRAM 5
0198   multiboot_uint32_t type;
0199   multiboot_uint32_t zero;
0200 };
0201 typedef struct multiboot_mmap_entry multiboot_memory_map_t;
0202 
0203 struct multiboot_tag
0204 {
0205   multiboot_uint32_t type;
0206   multiboot_uint32_t size;
0207 };
0208 
0209 struct multiboot_tag_string
0210 {
0211   multiboot_uint32_t type;
0212   multiboot_uint32_t size;
0213   char string[0];
0214 };
0215 
0216 struct multiboot_tag_module
0217 {
0218   multiboot_uint32_t type;
0219   multiboot_uint32_t size;
0220   multiboot_uint32_t mod_start;
0221   multiboot_uint32_t mod_end;
0222   char cmdline[0];
0223 };
0224 
0225 struct multiboot_tag_basic_meminfo
0226 {
0227   multiboot_uint32_t type;
0228   multiboot_uint32_t size;
0229   multiboot_uint32_t mem_lower;
0230   multiboot_uint32_t mem_upper;
0231 };
0232 
0233 struct multiboot_tag_bootdev
0234 {
0235   multiboot_uint32_t type;
0236   multiboot_uint32_t size;
0237   multiboot_uint32_t biosdev;
0238   multiboot_uint32_t slice;
0239   multiboot_uint32_t part;
0240 };
0241 
0242 struct multiboot_tag_mmap
0243 {
0244   multiboot_uint32_t type;
0245   multiboot_uint32_t size;
0246   multiboot_uint32_t entry_size;
0247   multiboot_uint32_t entry_version;
0248   struct multiboot_mmap_entry entries[0];
0249 };
0250 
0251 struct multiboot_vbe_info_block
0252 {
0253   multiboot_uint8_t external_specification[512];
0254 };
0255 
0256 struct multiboot_vbe_mode_info_block
0257 {
0258   multiboot_uint8_t external_specification[256];
0259 };
0260 
0261 struct multiboot_tag_vbe
0262 {
0263   multiboot_uint32_t type;
0264   multiboot_uint32_t size;
0265 
0266   multiboot_uint16_t vbe_mode;
0267   multiboot_uint16_t vbe_interface_seg;
0268   multiboot_uint16_t vbe_interface_off;
0269   multiboot_uint16_t vbe_interface_len;
0270 
0271   struct multiboot_vbe_info_block vbe_control_info;
0272   struct multiboot_vbe_mode_info_block vbe_mode_info;
0273 };
0274 
0275 struct multiboot_tag_framebuffer_common
0276 {
0277   multiboot_uint32_t type;
0278   multiboot_uint32_t size;
0279 
0280   multiboot_uint64_t framebuffer_addr;
0281   multiboot_uint32_t framebuffer_pitch;
0282   multiboot_uint32_t framebuffer_width;
0283   multiboot_uint32_t framebuffer_height;
0284   multiboot_uint8_t framebuffer_bpp;
0285 #define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
0286 #define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
0287 #define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
0288   multiboot_uint8_t framebuffer_type;
0289   multiboot_uint16_t reserved;
0290 };
0291 
0292 struct multiboot_tag_framebuffer
0293 {
0294   struct multiboot_tag_framebuffer_common common;
0295 
0296   union
0297   {
0298     struct
0299     {
0300       multiboot_uint16_t framebuffer_palette_num_colors;
0301       struct multiboot_color framebuffer_palette[0];
0302     };
0303     struct
0304     {
0305       multiboot_uint8_t framebuffer_red_field_position;
0306       multiboot_uint8_t framebuffer_red_mask_size;
0307       multiboot_uint8_t framebuffer_green_field_position;
0308       multiboot_uint8_t framebuffer_green_mask_size;
0309       multiboot_uint8_t framebuffer_blue_field_position;
0310       multiboot_uint8_t framebuffer_blue_mask_size;
0311     };
0312   };
0313 };
0314 
0315 struct multiboot_tag_elf_sections
0316 {
0317   multiboot_uint32_t type;
0318   multiboot_uint32_t size;
0319   multiboot_uint32_t num;
0320   multiboot_uint32_t entsize;
0321   multiboot_uint32_t shndx;
0322   char sections[0];
0323 };
0324 
0325 struct multiboot_tag_apm
0326 {
0327   multiboot_uint32_t type;
0328   multiboot_uint32_t size;
0329   multiboot_uint16_t version;
0330   multiboot_uint16_t cseg;
0331   multiboot_uint32_t offset;
0332   multiboot_uint16_t cseg_16;
0333   multiboot_uint16_t dseg;
0334   multiboot_uint16_t flags;
0335   multiboot_uint16_t cseg_len;
0336   multiboot_uint16_t cseg_16_len;
0337   multiboot_uint16_t dseg_len;
0338 };
0339 
0340 struct multiboot_tag_efi32
0341 {
0342   multiboot_uint32_t type;
0343   multiboot_uint32_t size;
0344   multiboot_uint32_t pointer;
0345 };
0346 
0347 struct multiboot_tag_efi64
0348 {
0349   multiboot_uint32_t type;
0350   multiboot_uint32_t size;
0351   multiboot_uint64_t pointer;
0352 };
0353 
0354 struct multiboot_tag_smbios
0355 {
0356   multiboot_uint32_t type;
0357   multiboot_uint32_t size;
0358   multiboot_uint8_t major;
0359   multiboot_uint8_t minor;
0360   multiboot_uint8_t reserved[6];
0361   multiboot_uint8_t tables[0];
0362 };
0363 
0364 struct multiboot_tag_old_acpi
0365 {
0366   multiboot_uint32_t type;
0367   multiboot_uint32_t size;
0368   multiboot_uint8_t rsdp[0];
0369 };
0370 
0371 struct multiboot_tag_new_acpi
0372 {
0373   multiboot_uint32_t type;
0374   multiboot_uint32_t size;
0375   multiboot_uint8_t rsdp[0];
0376 };
0377 
0378 struct multiboot_tag_network
0379 {
0380   multiboot_uint32_t type;
0381   multiboot_uint32_t size;
0382   multiboot_uint8_t dhcpack[0];
0383 };
0384 
0385 struct multiboot_tag_efi_mmap
0386 {
0387   multiboot_uint32_t type;
0388   multiboot_uint32_t size;
0389   multiboot_uint32_t descr_size;
0390   multiboot_uint32_t descr_vers;
0391   multiboot_uint8_t efi_mmap[0];
0392 };
0393 
0394 struct multiboot_tag_efi32_ih
0395 {
0396   multiboot_uint32_t type;
0397   multiboot_uint32_t size;
0398   multiboot_uint32_t pointer;
0399 };
0400 
0401 struct multiboot_tag_efi64_ih
0402 {
0403   multiboot_uint32_t type;
0404   multiboot_uint32_t size;
0405   multiboot_uint64_t pointer;
0406 };
0407 
0408 struct multiboot_tag_load_base_addr
0409 {
0410   multiboot_uint32_t type;
0411   multiboot_uint32_t size;
0412   multiboot_uint32_t load_base_addr;
0413 };
0414 
0415 #endif // __ASSEMBLER__
0416 
0417 #endif // _MULTIBOOT2_HEADER_H_