- Implemented execp*.
[planlOS.git] / system / include / ke / multiboot.h
blob62613b61567b51ff5b14fb26ac7eb42601655120
1 /*
2 Copyright (C) 2008 Mathias Gottschlag
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in the
6 Software without restriction, including without limitation the rights to use,
7 copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8 Software, and to permit persons to whom the Software is furnished to do so,
9 subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 /**
22 * \file multiboot.h
23 * Multiboot information
26 #ifndef KE_MULTIBOOT_H_INCLUDED
27 #define KE_MULTIBOOT_H_INCLUDED
29 #include <stdint.h>
31 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002
32 #define MULTIBOOT_HEADER_FLAGS 0x00000003
33 #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
35 /**
36 * a.out symbol table. Not used anywhere.
38 typedef struct AoutSymbolTable
40 uint32_t tabsize;
41 uint32_t strsize;
42 uint32_t addr;
43 uint32_t reserved;
44 } AoutSymbolTable;
46 /**
47 * ELF section header table holding the information about the kernel executable.
49 typedef struct ElfSectionHeaderTable
51 uint32_t num;
52 uint32_t size;
53 uint32_t addr;
54 uint32_t shindex;
55 } ElfSectionHeaderTable;
57 /**
58 * Multiboot module information.
60 typedef struct MbModule
62 /**
63 * Start of the physical module memory.
65 uint32_t start;
66 /**
67 * End of the physical module memory.
69 uint32_t end;
70 /**
71 * File name of the module.
73 uint32_t string;
74 uint32_t reserved;
75 } MbModule;
77 /**
78 * Multiboot memory map.
80 typedef struct MbMemoryMap
82 /**
83 * Size of the rest of the structure not including this member (can be more
84 * than 20 bytes).
86 uint32_t size;
87 /**
88 * Low 32 bits of the base address.
90 uint32_t baseaddrlow;
91 /**
92 * High 32 bits of the base address.
94 uint32_t baseaddrhigh;
95 /**
96 * Low 32 bits of the length of the memory range.
98 uint32_t lengthlow;
99 /**
100 * High 32 bits of the length of the memory range.
102 uint32_t lengthhigh;
104 * Type of the memory range.
106 uint32_t type;
107 } MbMemoryMap;
110 * Multiboot information structure.
112 typedef struct MultibootInfo
115 * Flags telling what information is included in the struct.
117 uint32_t flags;
119 * Amount of base memory.
121 uint32_t lowermem;
123 * Approximated amount of upper memory.
125 uint32_t uppermem;
127 * Device the operating system was booted from. The first byte contains the
128 * BIOS number of the device, the rest contains the partition information.
130 uint32_t bootdevice;
132 * Kernel command line.
134 uint32_t cmdline;
136 * Number of modules loaded by the boot loader.
138 uint32_t modcount;
140 * Pointer to the module info block (array of MbModule).
142 uint32_t modaddr;
144 * Kernel symbol information.
146 union
148 AoutSymbolTable aoutsym;
149 ElfSectionHeaderTable elfsections;
150 } u;
152 * Length of the memory map.
154 uint32_t mmaplength;
156 * Pointer to the first memory range information (MbMemoryMap).
158 uint32_t mmapaddr;
159 } MultibootInfo;
161 #define CHECK_FLAG(flags,bit) ((flags) & (1 << (bit)))
163 #endif