1/** 2 * \file 3 * \brief Definition of multiboot header formats. 4 * Spec: http://www.gnu.org/software/grub/manual/multiboot/multiboot.html 5 */ 6 7/* 8 * Copyright (c) 2009, ETH Zurich. 9 * All rights reserved. 10 * 11 * This file is distributed under the terms in the attached LICENSE file. 12 * If you do not find this file, copies can be found by writing to: 13 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 14 */ 15 16#ifndef _MULTIBOOT_H 17#define _MULTIBOOT_H 18 19#define MULTIBOOT_HEADER_MAGIC 0x1BADB002 20#define MULTIBOOT_HEADER_FLAG_MODS_PGALIGNED 1 21#define MULTIBOOT_HEADER_FLAG_NEED_MEMINFO 2 22#define MULTIBOOT_HEADER_FLAG_NEED_VIDMODE 4 23 24#define MULTIBOOT_INFO_MAGIC 0x2BADB002 25#define MULTIBOOT_INFO_FLAG_HAS_MEMINFO 0x001 26#define MULTIBOOT_INFO_FLAG_HAS_BOOTDEV 0x002 27#define MULTIBOOT_INFO_FLAG_HAS_CMDLINE 0x004 28#define MULTIBOOT_INFO_FLAG_HAS_MODS 0x008 29#define MULTIBOOT_INFO_FLAG_HAS_AOUT_SYMS 0x010 30#define MULTIBOOT_INFO_FLAG_HAS_ELF_SYMS 0x020 31#define MULTIBOOT_INFO_FLAG_HAS_MMAP 0x040 32#define MULTIBOOT_INFO_FLAG_HAS_DRIVES 0x080 33#define MULTIBOOT_INFO_FLAG_HAS_CONFIG 0x100 34#define MULTIBOOT_INFO_FLAG_HAS_LOADERNAME 0x200 35#define MULTIBOOT_INFO_FLAG_HAS_APM 0x400 36#define MULTIBOOT_INFO_FLAG_HAS_VBE 0x800 37 38#if !defined(__ASSEMBLER__) 39 40struct multiboot_elf { 41 uint32_t num; 42 uint32_t size; 43 uint32_t addr; 44 uint32_t shndx; 45}; 46 47/// Multiboot information structure passed from bootloader to OS 48struct multiboot_info { 49 uint32_t flags; 50 51 // if MULTIBOOT_INFO_FLAG_HAS_MEMINFO is set 52 uint32_t mem_lower; 53 uint32_t mem_upper; 54 55 // if MULTIBOOT_INFO_FLAG_HAS_BOOTDEV 56 uint32_t boot_device; 57 58 // if MULTIBOOT_INFO_FLAG_HAS_CMDLINE 59 uint32_t cmdline; 60 61 // if MULTIBOOT_INFO_FLAG_HAS_MODS 62 uint32_t mods_count; 63 uint32_t mods_addr; 64 65 union { 66 // if MULTIBOOT_INFO_FLAG_HAS_AOUT_SYMS 67 struct { 68 uint32_t tabsize; 69 uint32_t strsize; 70 uint32_t addr; 71 uint32_t reserved; 72 } aout; 73 74 // if MULTIBOOT_INFO_FLAG_HAS_ELF_SYMS 75 struct multiboot_elf elf; 76 } syms; 77 78 // if MULTIBOOT_INFO_FLAG_HAS_MMAP 79 uint32_t mmap_length; 80 uint32_t mmap_addr; 81 82 // if MULTIBOOT_INFO_FLAG_HAS_DRIVES 83 uint32_t drives_length; 84 uint32_t drives_addr; 85 86 // if MULTIBOOT_INFO_FLAG_HAS_CONFIG 87 uint32_t config_table; 88 89 // if MULTIBOOT_INFO_FLAG_HAS_LOADERNAME 90 uint32_t boot_loader_name; 91 92 // if MULTIBOOT_INFO_FLAG_HAS_APM 93 uint32_t apm_table; 94 95 // if MULTIBOOT_INFO_FLAG_HAS_VBE 96 uint32_t vbe_control_info; 97 uint32_t vbe_mode_info; 98 uint16_t vbe_mode; 99 uint16_t vbe_interface_seg; 100 uint16_t vbe_interface_off; 101 uint16_t vbe_interface_len; 102 103#ifdef __k1om__ 104 uint8_t xeon_phi_id; 105#else 106 uint8_t padding; 107#endif 108}; 109 110#define MULTIBOOT_MODULE_SIZE(mod) ((mod).mod_end - (mod).mod_start) 111 112struct multiboot_modinfo { 113 uint32_t mod_start; 114 uint32_t mod_end; 115 uint32_t string; 116 uint32_t reserved; 117}; 118 119#define MULTIBOOT_MEM_TYPE_RAM 1 120// special type for the host memory mapping of the xeon phi 121#define MULTIBOOT_MEM_TYPE_HOST_MEMORY 2 122// Memory-mapped devices 123#define MULTIBOOT_MEM_TYPE_DEVICE 13 124 125struct multiboot_mmap { 126 uint32_t size; 127 uint64_t base_addr; 128 uint64_t length; 129 uint32_t type; 130} __attribute__ ((packed)); 131 132#endif /* !defined(__ASSEMBLER__) */ 133 134#endif /* _MULTIBOOT_H */ 135