Home | History | Annotate | Download | only in include
      1 #ifndef _MULTIBOOT_H
      2 #define _MULTIBOOT_H
      3 
      4 /**
      5  * @file
      6  *
      7  * Multiboot operating systems
      8  *
      9  */
     10 
     11 FILE_LICENCE ( GPL2_OR_LATER );
     12 
     13 #include <stdint.h>
     14 
     15 /** The magic number for the Multiboot header */
     16 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002
     17 
     18 /** Boot modules must be page aligned */
     19 #define MB_FLAG_PGALIGN 0x00000001
     20 
     21 /** Memory map must be provided */
     22 #define MB_FLAG_MEMMAP 0x00000002
     23 
     24 /** Video mode information must be provided */
     25 #define MB_FLAG_VIDMODE 0x00000004
     26 
     27 /** Image is a raw multiboot image (not ELF) */
     28 #define MB_FLAG_RAW 0x00010000
     29 
     30 /**
     31  * The magic number passed by a Multiboot-compliant boot loader
     32  *
     33  * Must be passed in register %eax when jumping to the Multiboot OS
     34  * image.
     35  */
     36 #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
     37 
     38 /** Multiboot information structure mem_* fields are valid */
     39 #define MBI_FLAG_MEM 0x00000001
     40 
     41 /** Multiboot information structure boot_device field is valid */
     42 #define MBI_FLAG_BOOTDEV 0x00000002
     43 
     44 /** Multiboot information structure cmdline field is valid */
     45 #define MBI_FLAG_CMDLINE 0x00000004
     46 
     47 /** Multiboot information structure module fields are valid */
     48 #define MBI_FLAG_MODS 0x00000008
     49 
     50 /** Multiboot information structure a.out symbol table is valid */
     51 #define MBI_FLAG_AOUT 0x00000010
     52 
     53 /** Multiboot information struture ELF section header table is valid */
     54 #define MBI_FLAG_ELF 0x00000020
     55 
     56 /** Multiboot information structure memory map is valid */
     57 #define MBI_FLAG_MMAP 0x00000040
     58 
     59 /** Multiboot information structure drive list is valid */
     60 #define MBI_FLAG_DRIVES 0x00000080
     61 
     62 /** Multiboot information structure ROM configuration field is valid */
     63 #define MBI_FLAG_CFGTBL 0x00000100
     64 
     65 /** Multiboot information structure boot loader name field is valid */
     66 #define MBI_FLAG_LOADER 0x00000200
     67 
     68 /** Multiboot information structure APM table is valid */
     69 #define MBI_FLAG_APM 0x00000400
     70 
     71 /** Multiboot information structure video information is valid */
     72 #define MBI_FLAG_VBE 0x00000800
     73 
     74 /** A multiboot header */
     75 struct multiboot_header {
     76 	uint32_t magic;
     77 	uint32_t flags;
     78 	uint32_t checksum;
     79 	uint32_t header_addr;
     80 	uint32_t load_addr;
     81 	uint32_t load_end_addr;
     82 	uint32_t bss_end_addr;
     83 	uint32_t entry_addr;
     84 } __attribute__ (( packed, may_alias ));
     85 
     86 /** A multiboot a.out symbol table */
     87 struct multiboot_aout_symbol_table {
     88 	uint32_t tabsize;
     89 	uint32_t strsize;
     90 	uint32_t addr;
     91 	uint32_t reserved;
     92 } __attribute__ (( packed, may_alias ));
     93 
     94 /** A multiboot ELF section header table */
     95 struct multiboot_elf_section_header_table {
     96 	uint32_t num;
     97 	uint32_t size;
     98 	uint32_t addr;
     99 	uint32_t shndx;
    100 } __attribute__ (( packed, may_alias ));
    101 
    102 /** A multiboot information structure */
    103 struct multiboot_info {
    104 	uint32_t flags;
    105 	uint32_t mem_lower;
    106 	uint32_t mem_upper;
    107 	uint32_t boot_device;
    108 	uint32_t cmdline;
    109 	uint32_t mods_count;
    110 	uint32_t mods_addr;
    111 	union {
    112 		struct multiboot_aout_symbol_table aout_syms;
    113 		struct multiboot_elf_section_header_table elf_sections;
    114 	} syms;
    115 	uint32_t mmap_length;
    116 	uint32_t mmap_addr;
    117 	uint32_t drives_length;
    118 	uint32_t drives_addr;
    119 	uint32_t config_table;
    120 	uint32_t boot_loader_name;
    121 	uint32_t apm_table;
    122 	uint32_t vbe_control_info;
    123 	uint32_t vbe_mode_info;
    124 	uint16_t vbe_mode;
    125 	uint16_t vbe_interface_seg;
    126 	uint16_t vbe_interface_off;
    127 	uint16_t vbe_interface_len;
    128 } __attribute__ (( packed, may_alias ));
    129 
    130 /** A multiboot module structure */
    131 struct multiboot_module {
    132 	uint32_t mod_start;
    133 	uint32_t mod_end;
    134 	uint32_t string;
    135 	uint32_t reserved;
    136 } __attribute__ (( packed, may_alias ));
    137 
    138 /** A multiboot memory map entry */
    139 struct multiboot_memory_map {
    140 	uint32_t size;
    141 	uint64_t base_addr;
    142 	uint64_t length;
    143 	uint32_t type;
    144 } __attribute__ (( packed, may_alias ));
    145 
    146 /** Usable RAM */
    147 #define MBMEM_RAM 1
    148 
    149 #endif /* _MULTIBOOT_H */
    150