Evgeny Kalugin | 8e8bf00 | 2013-10-24 11:21:07 +0300 | [diff] [blame] | 1 | /* Copyright (C) 1999, 2001 Free Software Foundation, Inc. |
| 2 | |
| 3 | This program is free software; you can redistribute it and/or modify |
| 4 | it under the terms of the GNU General Public License as published by |
| 5 | the Free Software Foundation; either version 2 of the License, or |
| 6 | (at your option) any later version. |
| 7 | |
| 8 | This program is distributed in the hope that it will be useful, |
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | GNU General Public License for more details. |
| 12 | |
| 13 | You should have received a copy of the GNU General Public License |
| 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 16 | |
| 17 | #ifndef __MULTIBOOT_H__ |
| 18 | #define __MULTIBOOT_H__ |
| 19 | |
| 20 | /* |
| 21 | * Multiboot header structure. |
| 22 | */ |
| 23 | #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 |
| 24 | #define MULTIBOOT_HEADER_MODS_ALIGNED 0x00000001 |
| 25 | #define MULTIBOOT_HEADER_WANT_MEMORY 0x00000002 |
| 26 | #define MULTIBOOT_HEADER_HAS_VBE 0x00000004 |
| 27 | #define MULTIBOOT_HEADER_HAS_ADDR 0x00010000 |
| 28 | |
| 29 | /* The magic number passed by a Multiboot-compliant boot loader. */ |
| 30 | #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 |
| 31 | |
| 32 | #define MBI_MEMLIMITS (1u<< 0) |
| 33 | #define MBI_BOOTDEV (1u<< 1) |
| 34 | #define MBI_CMDLINE (1u<< 2) |
| 35 | #define MBI_MODULES (1u<< 3) |
| 36 | #define MBI_AOUT_SYMS (1u<< 4) |
| 37 | #define MBI_ELF_SYMS (1u<< 5) |
| 38 | #define MBI_MEMMAP (1u<< 6) |
| 39 | #define MBI_DRIVES (1u<< 7) |
| 40 | #define MBI_BIOSCONFIG (1u<< 8) |
| 41 | #define MBI_LOADERNAME (1u<< 9) |
| 42 | #define MBI_APM (1u<<10) |
| 43 | |
| 44 | #ifndef __ASSEMBLY__ |
| 45 | |
| 46 | /* The symbol table for a.out. */ |
| 47 | typedef struct { |
| 48 | u32 tabsize; |
| 49 | u32 strsize; |
| 50 | u32 addr; |
| 51 | u32 reserved; |
| 52 | } aout_symbol_table_t; |
| 53 | |
| 54 | /* The section header table for ELF. */ |
| 55 | typedef struct { |
| 56 | u32 num; |
| 57 | u32 size; |
| 58 | u32 addr; |
| 59 | u32 shndx; |
| 60 | } elf_section_header_table_t; |
| 61 | |
| 62 | /* The Multiboot information. */ |
| 63 | typedef struct { |
| 64 | u32 flags; |
| 65 | |
| 66 | /* Valid if flags sets MBI_MEMLIMITS */ |
| 67 | u32 mem_lower; |
| 68 | u32 mem_upper; |
| 69 | |
| 70 | /* Valid if flags sets MBI_BOOTDEV */ |
| 71 | u32 boot_device; |
| 72 | |
| 73 | /* Valid if flags sets MBI_CMDLINE */ |
| 74 | u32 cmdline; |
| 75 | |
| 76 | /* Valid if flags sets MBI_MODULES */ |
| 77 | u32 mods_count; |
| 78 | u32 mods_addr; |
| 79 | |
| 80 | /* Valid if flags sets ... */ |
| 81 | union { |
| 82 | aout_symbol_table_t aout_sym; /* ... MBI_AOUT_SYMS */ |
| 83 | elf_section_header_table_t elf_sec; /* ... MBI_ELF_SYMS */ |
| 84 | } u; |
| 85 | |
| 86 | /* Valid if flags sets MBI_MEMMAP */ |
| 87 | u32 mmap_length; |
| 88 | u32 mmap_addr; |
| 89 | |
| 90 | /* Valid if flags sets MBI_DRIVES */ |
| 91 | u32 drives_length; |
| 92 | u32 drives_addr; |
| 93 | |
| 94 | /* Valid if flags sets MBI_BIOSCONFIG */ |
| 95 | u32 config_table; |
| 96 | |
| 97 | /* Valid if flags sets MBI_LOADERNAME */ |
| 98 | u32 boot_loader_name; |
| 99 | |
| 100 | /* Valid if flags sets MBI_APM */ |
| 101 | u32 apm_table; |
| 102 | } multiboot_info_t; |
| 103 | |
| 104 | /* The module structure. */ |
| 105 | typedef struct { |
| 106 | u32 mod_start; |
| 107 | u32 mod_end; |
| 108 | u32 string; |
| 109 | u32 reserved; |
| 110 | } module_t; |
| 111 | |
| 112 | /* The memory map. Be careful that the offset 0 is base_addr_low |
| 113 | but no size. */ |
| 114 | typedef struct { |
| 115 | u32 size; |
| 116 | u32 base_addr_low; |
| 117 | u32 base_addr_high; |
| 118 | u32 length_low; |
| 119 | u32 length_high; |
| 120 | u32 type; |
| 121 | } memory_map_t; |
| 122 | |
| 123 | |
| 124 | #endif /* __ASSEMBLY__ */ |
| 125 | |
| 126 | |
| 127 | #endif /* _BOOTSTUB_MB_H */ |