1*1b8adde7SWilliam Kucharski/* @r{multiboot.h - the header for Multiboot} */ 2*1b8adde7SWilliam Kucharski/* @r{Copyright (C) 1999, 2001 Free Software Foundation, Inc. 3*1b8adde7SWilliam Kucharski 4*1b8adde7SWilliam Kucharski This program is free software; you can redistribute it and/or modify 5*1b8adde7SWilliam Kucharski it under the terms of the GNU General Public License as published by 6*1b8adde7SWilliam Kucharski the Free Software Foundation; either version 2 of the License, or 7*1b8adde7SWilliam Kucharski (at your option) any later version. 8*1b8adde7SWilliam Kucharski 9*1b8adde7SWilliam Kucharski This program is distributed in the hope that it will be useful, 10*1b8adde7SWilliam Kucharski but WITHOUT ANY WARRANTY; without even the implied warranty of 11*1b8adde7SWilliam Kucharski MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12*1b8adde7SWilliam Kucharski GNU General Public License for more details. 13*1b8adde7SWilliam Kucharski 14*1b8adde7SWilliam Kucharski You should have received a copy of the GNU General Public License 15*1b8adde7SWilliam Kucharski along with this program; if not, write to the Free Software 16*1b8adde7SWilliam Kucharski Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.} */ 17*1b8adde7SWilliam Kucharski 18*1b8adde7SWilliam Kucharski/* @r{Macros.} */ 19*1b8adde7SWilliam Kucharski 20*1b8adde7SWilliam Kucharski/* @r{The magic number for the Multiboot header.} */ 21*1b8adde7SWilliam Kucharski#define MULTIBOOT_HEADER_MAGIC 0x1BADB002 22*1b8adde7SWilliam Kucharski 23*1b8adde7SWilliam Kucharski/* @r{The flags for the Multiboot header.} */ 24*1b8adde7SWilliam Kucharski#ifdef __ELF__ 25*1b8adde7SWilliam Kucharski# define MULTIBOOT_HEADER_FLAGS 0x00000003 26*1b8adde7SWilliam Kucharski#else 27*1b8adde7SWilliam Kucharski# define MULTIBOOT_HEADER_FLAGS 0x00010003 28*1b8adde7SWilliam Kucharski#endif 29*1b8adde7SWilliam Kucharski 30*1b8adde7SWilliam Kucharski/* @r{The magic number passed by a Multiboot-compliant boot loader.} */ 31*1b8adde7SWilliam Kucharski#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 32*1b8adde7SWilliam Kucharski 33*1b8adde7SWilliam Kucharski/* @r{The size of our stack (16KB).} */ 34*1b8adde7SWilliam Kucharski#define STACK_SIZE 0x4000 35*1b8adde7SWilliam Kucharski 36*1b8adde7SWilliam Kucharski/* @r{C symbol format. HAVE_ASM_USCORE is defined by configure.} */ 37*1b8adde7SWilliam Kucharski#ifdef HAVE_ASM_USCORE 38*1b8adde7SWilliam Kucharski# define EXT_C(sym) _ ## sym 39*1b8adde7SWilliam Kucharski#else 40*1b8adde7SWilliam Kucharski# define EXT_C(sym) sym 41*1b8adde7SWilliam Kucharski#endif 42*1b8adde7SWilliam Kucharski 43*1b8adde7SWilliam Kucharski#ifndef ASM 44*1b8adde7SWilliam Kucharski/* @r{Do not include here in boot.S.} */ 45*1b8adde7SWilliam Kucharski 46*1b8adde7SWilliam Kucharski/* @r{Types.} */ 47*1b8adde7SWilliam Kucharski 48*1b8adde7SWilliam Kucharski/* @r{The Multiboot header.} */ 49*1b8adde7SWilliam Kucharskitypedef struct multiboot_header 50*1b8adde7SWilliam Kucharski@{ 51*1b8adde7SWilliam Kucharski unsigned long magic; 52*1b8adde7SWilliam Kucharski unsigned long flags; 53*1b8adde7SWilliam Kucharski unsigned long checksum; 54*1b8adde7SWilliam Kucharski unsigned long header_addr; 55*1b8adde7SWilliam Kucharski unsigned long load_addr; 56*1b8adde7SWilliam Kucharski unsigned long load_end_addr; 57*1b8adde7SWilliam Kucharski unsigned long bss_end_addr; 58*1b8adde7SWilliam Kucharski unsigned long entry_addr; 59*1b8adde7SWilliam Kucharski@} multiboot_header_t; 60*1b8adde7SWilliam Kucharski 61*1b8adde7SWilliam Kucharski/* @r{The symbol table for a.out.} */ 62*1b8adde7SWilliam Kucharskitypedef struct aout_symbol_table 63*1b8adde7SWilliam Kucharski@{ 64*1b8adde7SWilliam Kucharski unsigned long tabsize; 65*1b8adde7SWilliam Kucharski unsigned long strsize; 66*1b8adde7SWilliam Kucharski unsigned long addr; 67*1b8adde7SWilliam Kucharski unsigned long reserved; 68*1b8adde7SWilliam Kucharski@} aout_symbol_table_t; 69*1b8adde7SWilliam Kucharski 70*1b8adde7SWilliam Kucharski/* @r{The section header table for ELF.} */ 71*1b8adde7SWilliam Kucharskitypedef struct elf_section_header_table 72*1b8adde7SWilliam Kucharski@{ 73*1b8adde7SWilliam Kucharski unsigned long num; 74*1b8adde7SWilliam Kucharski unsigned long size; 75*1b8adde7SWilliam Kucharski unsigned long addr; 76*1b8adde7SWilliam Kucharski unsigned long shndx; 77*1b8adde7SWilliam Kucharski@} elf_section_header_table_t; 78*1b8adde7SWilliam Kucharski 79*1b8adde7SWilliam Kucharski/* @r{The Multiboot information.} */ 80*1b8adde7SWilliam Kucharskitypedef struct multiboot_info 81*1b8adde7SWilliam Kucharski@{ 82*1b8adde7SWilliam Kucharski unsigned long flags; 83*1b8adde7SWilliam Kucharski unsigned long mem_lower; 84*1b8adde7SWilliam Kucharski unsigned long mem_upper; 85*1b8adde7SWilliam Kucharski unsigned long boot_device; 86*1b8adde7SWilliam Kucharski unsigned long cmdline; 87*1b8adde7SWilliam Kucharski unsigned long mods_count; 88*1b8adde7SWilliam Kucharski unsigned long mods_addr; 89*1b8adde7SWilliam Kucharski union 90*1b8adde7SWilliam Kucharski @{ 91*1b8adde7SWilliam Kucharski aout_symbol_table_t aout_sym; 92*1b8adde7SWilliam Kucharski elf_section_header_table_t elf_sec; 93*1b8adde7SWilliam Kucharski @} u; 94*1b8adde7SWilliam Kucharski unsigned long mmap_length; 95*1b8adde7SWilliam Kucharski unsigned long mmap_addr; 96*1b8adde7SWilliam Kucharski@} multiboot_info_t; 97*1b8adde7SWilliam Kucharski 98*1b8adde7SWilliam Kucharski/* @r{The module structure.} */ 99*1b8adde7SWilliam Kucharskitypedef struct module 100*1b8adde7SWilliam Kucharski@{ 101*1b8adde7SWilliam Kucharski unsigned long mod_start; 102*1b8adde7SWilliam Kucharski unsigned long mod_end; 103*1b8adde7SWilliam Kucharski unsigned long string; 104*1b8adde7SWilliam Kucharski unsigned long reserved; 105*1b8adde7SWilliam Kucharski@} module_t; 106*1b8adde7SWilliam Kucharski 107*1b8adde7SWilliam Kucharski/* @r{The memory map. Be careful that the offset 0 is base_addr_low 108*1b8adde7SWilliam Kucharski but no size.} */ 109*1b8adde7SWilliam Kucharskitypedef struct memory_map 110*1b8adde7SWilliam Kucharski@{ 111*1b8adde7SWilliam Kucharski unsigned long size; 112*1b8adde7SWilliam Kucharski unsigned long base_addr_low; 113*1b8adde7SWilliam Kucharski unsigned long base_addr_high; 114*1b8adde7SWilliam Kucharski unsigned long length_low; 115*1b8adde7SWilliam Kucharski unsigned long length_high; 116*1b8adde7SWilliam Kucharski unsigned long type; 117*1b8adde7SWilliam Kucharski@} memory_map_t; 118*1b8adde7SWilliam Kucharski 119*1b8adde7SWilliam Kucharski#endif /* @r{! ASM} */ 120