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