Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

multiboot.h

Go to the documentation of this file.
00001 /* ndk - [ multiboot.h ]
00002  *
00003  * Modified version of grub tutorial code to
00004  * provide ndk and interface to interact with
00005  * a multiboot complaint bootloader
00006  *
00007  * (c)2004 dcipher / neuraldk
00008  *           www.neuraldk.org
00009  */
00010 
00019 #ifndef __ndk_multiboot_h__
00020 #define __ndk_multiboot_h__
00021 
00022 #include "console.h"
00023 
00024 /* Forward declarations. */
00025 void multibootInit(unsigned long magic, unsigned long addr);
00026 void mb_main(unsigned long magic, unsigned long addr);
00027 
00028 /* multiboot.h - the header for Multiboot */
00029 /* Copyright (C) 1999, 2001  Free Software Foundation, Inc.
00030 
00031    This program is free software; you can redistribute it and/or modify
00032    it under the terms of the GNU General Public License as published by
00033    the Free Software Foundation; either version 2 of the License, or
00034    (at your option) any later version.
00035 
00036    This program is distributed in the hope that it will be useful,
00037    but WITHOUT ANY WARRANTY; without even the implied warranty of
00038    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00039    GNU General Public License for more details.
00040 
00041    You should have received a copy of the GNU General Public License
00042    along with this program; if not, write to the Free Software
00043    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
00044 
00045 /* Macros. */
00046 
00047 /* The magic number for the Multiboot header. */
00048 #define MULTIBOOT_HEADER_MAGIC          0x1BADB002
00049 
00050 /* The flags for the Multiboot header. */
00051 #ifdef __ELF__
00052 # define MULTIBOOT_HEADER_FLAGS         0x00000003
00053 #else
00054 # define MULTIBOOT_HEADER_FLAGS         0x00010003
00055 #endif
00056 
00057 /* The magic number passed by a Multiboot-compliant boot loader. */
00058 #define MULTIBOOT_BOOTLOADER_MAGIC      0x2BADB002
00059 
00060 /* The size of our stack (16KB). */
00061 #define STACK_SIZE                      0x4000
00062 
00063 /* C symbol format. HAVE_ASM_USCORE is defined by configure. */
00064 #ifdef HAVE_ASM_USCORE
00065 # define EXT_C(sym)                     _ ## sym
00066 #else
00067 # define EXT_C(sym)                     sym
00068 #endif
00069 
00070 #ifndef ASM
00071 /* Do not include here in boot.S. */
00072 
00073 /* Types. */
00074 
00075 /* The Multiboot header. */
00076 typedef struct multiboot_header
00077 {
00078    unsigned long magic;
00079    unsigned long flags;
00080    unsigned long checksum;
00081    unsigned long header_addr;
00082    unsigned long load_addr;
00083    unsigned long load_end_addr;
00084    unsigned long bss_end_addr;
00085    unsigned long entry_addr;
00086 } __attribute__ ((packed)) multiboot_header_t;
00087 
00088 /* The symbol table for a.out. */
00089 typedef struct aout_symbol_table
00090 {
00091    unsigned long tabsize;
00092    unsigned long strsize;
00093    unsigned long addr;
00094    unsigned long reserved;
00095 } __attribute__ ((packed)) aout_symbol_table_t;
00096 
00097 /* The section header table for ELF. */
00098 typedef struct elf_section_header_table
00099 {
00100    unsigned long num;
00101    unsigned long size;
00102    unsigned long addr;
00103    unsigned long shndx;
00104 } __attribute__ ((packed)) elf_section_header_table_t;
00105 
00106 /* The Multiboot information. */
00107 typedef struct multiboot_info
00108 {
00109    unsigned long flags;
00110    unsigned long mem_lower;
00111    unsigned long mem_upper;
00112    unsigned long boot_device;
00113    unsigned long cmdline;
00114    unsigned long mods_count;
00115    unsigned long mods_addr;
00116    union
00117    {
00118       aout_symbol_table_t aout_sym;
00119       elf_section_header_table_t elf_sec;
00120    } u;
00121    unsigned long mmap_length;
00122    unsigned long mmap_addr;
00123 } __attribute__ ((packed)) multiboot_info_t;
00124 
00125 /* The module structure. */
00126 typedef struct module
00127 {
00128    unsigned long mod_start;
00129    unsigned long mod_end;
00130    unsigned long string;
00131    unsigned long reserved;
00132 } __attribute__ ((packed)) module_t;
00133 
00134 /* The memory map. Be careful that the offset 0 is base_addr_low
00135    but no size. */
00136 typedef struct memory_map
00137 {
00138    unsigned long size;
00139    unsigned long base_addr_low;
00140    unsigned long base_addr_high;
00141    unsigned long length_low;
00142    unsigned long length_high;
00143    unsigned long type;
00144 } __attribute__ ((packed)) memory_map_t;
00145 
00146 extern multiboot_info_t *multibootInfo;
00147 #endif /* ! ASM */
00148 
00149 #endif
00150 

Generated on Wed Mar 22 20:36:33 2006 for ndk by  doxygen 1.4.4