iPXE
multiboot.h
Go to the documentation of this file.
00001 #ifndef _MULTIBOOT_H
00002 #define _MULTIBOOT_H
00003 
00004 /**
00005  * @file
00006  *
00007  * Multiboot operating systems
00008  *
00009  */
00010 
00011 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00012 
00013 #include <stdint.h>
00014 
00015 /** The magic number for the Multiboot header */
00016 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002
00017 
00018 /** Boot modules must be page aligned */
00019 #define MB_FLAG_PGALIGN 0x00000001
00020 
00021 /** Memory map must be provided */
00022 #define MB_FLAG_MEMMAP 0x00000002
00023 
00024 /** Video mode information must be provided */
00025 #define MB_FLAG_VIDMODE 0x00000004
00026 
00027 /** Image is a raw multiboot image (not ELF) */
00028 #define MB_FLAG_RAW 0x00010000
00029 
00030 /**
00031  * The magic number passed by a Multiboot-compliant boot loader
00032  *
00033  * Must be passed in register %eax when jumping to the Multiboot OS
00034  * image.
00035  */
00036 #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
00037 
00038 /** Multiboot information structure mem_* fields are valid */
00039 #define MBI_FLAG_MEM 0x00000001
00040 
00041 /** Multiboot information structure boot_device field is valid */
00042 #define MBI_FLAG_BOOTDEV 0x00000002
00043 
00044 /** Multiboot information structure cmdline field is valid */
00045 #define MBI_FLAG_CMDLINE 0x00000004
00046 
00047 /** Multiboot information structure module fields are valid */
00048 #define MBI_FLAG_MODS 0x00000008
00049 
00050 /** Multiboot information structure a.out symbol table is valid */
00051 #define MBI_FLAG_AOUT 0x00000010
00052 
00053 /** Multiboot information struture ELF section header table is valid */
00054 #define MBI_FLAG_ELF 0x00000020
00055 
00056 /** Multiboot information structure memory map is valid */
00057 #define MBI_FLAG_MMAP 0x00000040
00058 
00059 /** Multiboot information structure drive list is valid */
00060 #define MBI_FLAG_DRIVES 0x00000080
00061 
00062 /** Multiboot information structure ROM configuration field is valid */
00063 #define MBI_FLAG_CFGTBL 0x00000100
00064 
00065 /** Multiboot information structure boot loader name field is valid */
00066 #define MBI_FLAG_LOADER 0x00000200
00067 
00068 /** Multiboot information structure APM table is valid */
00069 #define MBI_FLAG_APM 0x00000400
00070 
00071 /** Multiboot information structure video information is valid */
00072 #define MBI_FLAG_VBE 0x00000800
00073 
00074 /** A multiboot header */
00075 struct multiboot_header {
00076         uint32_t magic;
00077         uint32_t flags;
00078         uint32_t checksum;
00079         uint32_t header_addr;
00080         uint32_t load_addr;
00081         uint32_t load_end_addr;
00082         uint32_t bss_end_addr;
00083         uint32_t entry_addr;
00084 } __attribute__ (( packed, may_alias ));
00085 
00086 /** A multiboot a.out symbol table */
00087 struct multiboot_aout_symbol_table {
00088         uint32_t tabsize;
00089         uint32_t strsize;
00090         uint32_t addr;
00091         uint32_t reserved;
00092 } __attribute__ (( packed, may_alias ));
00093 
00094 /** A multiboot ELF section header table */
00095 struct multiboot_elf_section_header_table {
00096         uint32_t num;
00097         uint32_t size;
00098         uint32_t addr;
00099         uint32_t shndx;
00100 } __attribute__ (( packed, may_alias ));
00101 
00102 /** A multiboot information structure */
00103 struct multiboot_info {
00104         uint32_t flags;
00105         uint32_t mem_lower;
00106         uint32_t mem_upper;
00107         uint32_t boot_device;
00108         uint32_t cmdline;
00109         uint32_t mods_count;
00110         uint32_t mods_addr;
00111         union {
00112                 struct multiboot_aout_symbol_table aout_syms;
00113                 struct multiboot_elf_section_header_table elf_sections;
00114         } syms;
00115         uint32_t mmap_length;
00116         uint32_t mmap_addr;
00117         uint32_t drives_length;
00118         uint32_t drives_addr;
00119         uint32_t config_table;
00120         uint32_t boot_loader_name;
00121         uint32_t apm_table;
00122         uint32_t vbe_control_info;
00123         uint32_t vbe_mode_info;
00124         uint16_t vbe_mode;
00125         uint16_t vbe_interface_seg;
00126         uint16_t vbe_interface_off;
00127         uint16_t vbe_interface_len;
00128 } __attribute__ (( packed, may_alias ));
00129 
00130 /** A multiboot module structure */
00131 struct multiboot_module {
00132         uint32_t mod_start;
00133         uint32_t mod_end;
00134         uint32_t string;
00135         uint32_t reserved;
00136 } __attribute__ (( packed, may_alias ));
00137 
00138 /** A multiboot memory map entry */
00139 struct multiboot_memory_map {
00140         uint32_t size;
00141         uint64_t base_addr;
00142         uint64_t length;
00143         uint32_t type;
00144 } __attribute__ (( packed, may_alias ));
00145 
00146 /** Usable RAM */
00147 #define MBMEM_RAM 1
00148 
00149 #endif /* _MULTIBOOT_H */