1 /* multiboot.h - the header for Multiboot */
2 /* Copyright (C) 1999  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 along
15    with this program; if not, write to the Free Software Foundation, Inc.,
16    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18 
19 #ifndef __ASM__
20 #pragma once
21 #endif
22 
23 /* Macros. */
24 
25 /* The magic number for the Multiboot header. */
26 #define MULTIBOOT_HEADER_MAGIC          HEX(1BADB002)
27 
28 /* The flags for the Multiboot header. */
29 #define MULTIBOOT_HEADER_FLAGS          HEX(00010003)
30 
31 /* The magic number passed by a Multiboot-compliant boot loader. */
32 #define MULTIBOOT_BOOTLOADER_MAGIC      HEX(2BADB002)
33 
34 /* The size of our stack (16KB). */
35 #define STACK_SIZE                      0x4000
36 
37 /* C symbol format. HAVE_ASM_USCORE is defined by configure. */
38 #ifdef HAVE_ASM_USCORE
39 # define EXT_C(sym)                     _ ## sym
40 #else
41 # define EXT_C(sym)                     sym
42 #endif
43 
44 #define MB_INFO_FLAG_MEM_SIZE            HEX(00000001)
45 #define MB_INFO_FLAG_BOOT_DEVICE        HEX(00000002)
46 #define MB_INFO_FLAG_COMMAND_LINE        HEX(00000004)
47 #define MB_INFO_FLAG_MODULES            HEX(00000008)
48 #define MB_INFO_FLAG_AOUT_SYMS            HEX(00000010)
49 #define MB_INFO_FLAG_ELF_SYMS            HEX(00000020)
50 #define MB_INFO_FLAG_MEMORY_MAP            HEX(00000040)
51 #define MB_INFO_FLAG_DRIVES                HEX(00000080)
52 #define MB_INFO_FLAG_CONFIG_TABLE        HEX(00000100)
53 #define MB_INFO_FLAG_BOOT_LOADER_NAME    HEX(00000200)
54 #define MB_INFO_FLAG_APM_TABLE            HEX(00000400)
55 #define MB_INFO_FLAG_GRAPHICS_TABLE        HEX(00000800)
56 
57 #ifndef __ASM__
58 /* Do not include here in boot.S. */
59 
60 /* Types. */
61 
62 /* The Multiboot header. */
63 typedef struct multiboot_header
64 {
65   unsigned long magic;
66   unsigned long flags;
67   unsigned long checksum;
68   unsigned long header_addr;
69   unsigned long load_addr;
70   unsigned long load_end_addr;
71   unsigned long bss_end_addr;
72   unsigned long entry_addr;
73 } multiboot_header_t;
74 
75 /* The symbol table for a.out. */
76 typedef struct aout_symbol_table
77 {
78   unsigned long tabsize;
79   unsigned long strsize;
80   unsigned long addr;
81   unsigned long reserved;
82 } aout_symbol_table_t;
83 
84 /* The section header table for ELF. */
85 typedef struct elf_section_header_table
86 {
87   unsigned long num;
88   unsigned long size;
89   unsigned long addr;
90   unsigned long shndx;
91 } elf_section_header_table_t;
92 
93 /* The Multiboot information. */
94 typedef struct multiboot_info
95 {
96   unsigned long flags;
97   unsigned long mem_lower;
98   unsigned long mem_upper;
99   unsigned long boot_device;
100   unsigned long cmdline;
101   unsigned long mods_count;
102   unsigned long mods_addr;
103   union
104   {
105     aout_symbol_table_t aout_sym;
106     elf_section_header_table_t elf_sec;
107   } u;
108   unsigned long mmap_length;
109   unsigned long mmap_addr;
110   unsigned long drives_length;
111   unsigned long drives_addr;
112 } multiboot_info_t;
113 
114 /* The memory map. Be careful that the offset 0 is base_addr_low
115    but no size. */
116 typedef struct memory_map
117 {
118   //unsigned long size;
119   unsigned long base_addr_low;
120   unsigned long base_addr_high;
121   unsigned long length_low;
122   unsigned long length_high;
123   unsigned long type;
124   unsigned long reserved;
125 } memory_map_t;
126 
127 #endif /* ! __ASM__ */
128