/* multiboot.h - Multiboot header file. */1/* Copyright (C) 1999,2003,2007,2008,2009 Free Software Foundation, Inc.2*3* Permission is hereby granted, free of charge, to any person obtaining a copy4* of this software and associated documentation files (the "Software"), to5* deal in the Software without restriction, including without limitation the6* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or7* sell copies of the Software, and to permit persons to whom the Software is8* furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice shall be included in11* all copies or substantial portions of the Software.12*13* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ANY16* DEVELOPER OR DISTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,17* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR18* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.19*20*/2122#ifndef MULTIBOOT_HEADER23#define MULTIBOOT_HEADER 12425/* How many bytes from the start of the file we search for the header. */26#define MULTIBOOT_SEARCH 81922728/* The magic field should contain this. */29#define MULTIBOOT_HEADER_MAGIC 0x1BADB0023031/* This should be in %eax. */32#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB0023334/* The bits in the required part of flags field we don't support. */35#define MULTIBOOT_UNSUPPORTED 0x0000fffc3637/* Alignment of multiboot modules. */38#define MULTIBOOT_MOD_ALIGN 0x000010003940/* Alignment of the multiboot info structure. */41#define MULTIBOOT_INFO_ALIGN 0x000000044243/* Flags set in the 'flags' member of the multiboot header. */4445/* Align all boot modules on i386 page (4KB) boundaries. */46#define MULTIBOOT_PAGE_ALIGN 0x000000014748/* Must pass memory information to OS. */49#define MULTIBOOT_MEMORY_INFO 0x000000025051/* Must pass video information to OS. */52#define MULTIBOOT_VIDEO_MODE 0x000000045354/* This flag indicates the use of the address fields in the header. */55#define MULTIBOOT_AOUT_KLUDGE 0x000100005657/* Flags to be set in the 'flags' member of the multiboot info structure. */5859/* is there basic lower/upper memory information? */60#define MULTIBOOT_INFO_MEMORY 0x0000000161/* is there a boot device set? */62#define MULTIBOOT_INFO_BOOTDEV 0x0000000263/* is the command-line defined? */64#define MULTIBOOT_INFO_CMDLINE 0x0000000465/* are there modules to do something with? */66#define MULTIBOOT_INFO_MODS 0x000000086768/* These next two are mutually exclusive */6970/* is there a symbol table loaded? */71#define MULTIBOOT_INFO_AOUT_SYMS 0x0000001072/* is there an ELF section header table? */73#define MULTIBOOT_INFO_ELF_SHDR 0X000000207475/* is there a full memory map? */76#define MULTIBOOT_INFO_MEM_MAP 0x000000407778/* Is there drive info? */79#define MULTIBOOT_INFO_DRIVE_INFO 0x000000808081/* Is there a config table? */82#define MULTIBOOT_INFO_CONFIG_TABLE 0x000001008384/* Is there a boot loader name? */85#define MULTIBOOT_INFO_BOOT_LOADER_NAME 0x000002008687/* Is there a APM table? */88#define MULTIBOOT_INFO_APM_TABLE 0x000004008990/* Is there video information? */91#define MULTIBOOT_INFO_VIDEO_INFO 0x000008009293#ifndef ASM_FILE9495typedef unsigned short multiboot_uint16_t;96typedef unsigned int multiboot_uint32_t;97typedef unsigned long long multiboot_uint64_t;9899struct multiboot_header100{101/* Must be MULTIBOOT_MAGIC - see above. */102multiboot_uint32_t magic;103104/* Feature flags. */105multiboot_uint32_t flags;106107/* The above fields plus this one must equal 0 mod 2^32. */108multiboot_uint32_t checksum;109110/* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */111multiboot_uint32_t header_addr;112multiboot_uint32_t load_addr;113multiboot_uint32_t load_end_addr;114multiboot_uint32_t bss_end_addr;115multiboot_uint32_t entry_addr;116117/* These are only valid if MULTIBOOT_VIDEO_MODE is set. */118multiboot_uint32_t mode_type;119multiboot_uint32_t width;120multiboot_uint32_t height;121multiboot_uint32_t depth;122};123124/* The symbol table for a.out. */125struct multiboot_aout_symbol_table126{127multiboot_uint32_t tabsize;128multiboot_uint32_t strsize;129multiboot_uint32_t addr;130multiboot_uint32_t reserved;131};132typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;133134/* The section header table for ELF. */135struct multiboot_elf_section_header_table136{137multiboot_uint32_t num;138multiboot_uint32_t size;139multiboot_uint32_t addr;140multiboot_uint32_t shndx;141};142typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t;143144struct multiboot_info145{146/* Multiboot info version number */147multiboot_uint32_t flags;148149/* Available memory from BIOS */150multiboot_uint32_t mem_lower;151multiboot_uint32_t mem_upper;152153/* "root" partition */154multiboot_uint32_t boot_device;155156/* Kernel command line */157multiboot_uint32_t cmdline;158159/* Boot-Module list */160multiboot_uint32_t mods_count;161multiboot_uint32_t mods_addr;162163union164{165multiboot_aout_symbol_table_t aout_sym;166multiboot_elf_section_header_table_t elf_sec;167} u;168169/* Memory Mapping buffer */170multiboot_uint32_t mmap_length;171multiboot_uint32_t mmap_addr;172173/* Drive Info buffer */174multiboot_uint32_t drives_length;175multiboot_uint32_t drives_addr;176177/* ROM configuration table */178multiboot_uint32_t config_table;179180/* Boot Loader Name */181multiboot_uint32_t boot_loader_name;182183/* APM table */184multiboot_uint32_t apm_table;185186/* Video */187multiboot_uint32_t vbe_control_info;188multiboot_uint32_t vbe_mode_info;189multiboot_uint16_t vbe_mode;190multiboot_uint16_t vbe_interface_seg;191multiboot_uint16_t vbe_interface_off;192multiboot_uint16_t vbe_interface_len;193};194typedef struct multiboot_info multiboot_info_t;195196struct multiboot_mmap_entry197{198multiboot_uint32_t size;199multiboot_uint64_t addr;200multiboot_uint64_t len;201#define MULTIBOOT_MEMORY_AVAILABLE 1202#define MULTIBOOT_MEMORY_RESERVED 2203multiboot_uint32_t type;204} __attribute__((packed));205typedef struct multiboot_mmap_entry multiboot_memory_map_t;206207struct multiboot_mod_list208{209/* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */210multiboot_uint32_t mod_start;211multiboot_uint32_t mod_end;212213/* Module command line */214multiboot_uint32_t cmdline;215216/* padding to take it to 16 bytes (must be zero) */217multiboot_uint32_t pad;218};219typedef struct multiboot_mod_list multiboot_module_t;220221#endif /* ! ASM_FILE */222223#endif /* ! MULTIBOOT_HEADER */224225226