]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/ia32/multiboot.h
update
[l4.git] / kernel / fiasco / src / kern / ia32 / multiboot.h
1 #ifndef MULTIBOOT_H
2 #define MULTIBOOT_H
3
4 #include "types.h"
5
6 class Multiboot_header
7 {
8 public:
9   enum
10     {
11       /* The entire multiboot_header must be contained
12        * within the first MULTIBOOT_SEARCH bytes of the kernel image.  */
13       Search = 8192,
14
15       /* Magic value identifying the multiboot_header.  */
16       Magic = 0x1badb002,
17
18       /* Features flags for 'flags'.
19        * If a boot loader sees a flag in MULTIBOOT_MUSTKNOW set
20        * and it doesn't understand it, it must fail.  */
21       Mustknow = 0x0000ffff,
22
23       /* Align all boot modules on page (4KB) boundaries.  */
24       Page_align = 0x00000001,
25
26       /* Must be provided memory information in multiboot_info structure */
27       Memory_info = 0x00000002,
28
29       /* Use the load address fields above instead of the ones in the a.out
30        * header to figure out what to load where, and what to do afterwards.
31        * This should only be needed for a.out kernel images (ELF and other
32        * formats can generally provide the needed information).  */
33       Aout_kludge = 0x00010000,
34
35       /* The boot loader passes this value in register EAX to signal the kernel
36        * that the multiboot method is being used */
37       Valid = 0x2badb002,
38     };
39
40   /* Must be MULTIBOOT_MAGIC */
41   Unsigned32 magic;
42
43   /* Feature flags - see below.  */
44   Unsigned32 flags;
45
46   /* Checksum: magic + flags + checksum == 0 */
47   Unsigned32 checksum;
48
49   /* These are only valid if MULTIBOOT_AOUT_KLUDGE is set.  */
50   Unsigned32 header_addr;
51   Unsigned32 load_addr;
52   Unsigned32 load_end_addr;
53   Unsigned32 bss_end_addr;
54   Unsigned32 entry;
55 } __attribute__((packed));
56
57 /* VBE controller information.  */
58 class Multiboot_vbe_controller
59 {
60 public:
61   Unsigned8  signature[4];
62   Unsigned16 version;
63   Unsigned32 oem_string;
64   Unsigned32 capabilities;
65   Unsigned32 video_mode;
66   Unsigned16 total_memory;
67   Unsigned16 oem_software_rev;
68   Unsigned32 oem_vendor_name;
69   Unsigned32 oem_product_name;
70   Unsigned32 oem_product_rev;
71   Unsigned8  reserved[222];
72   Unsigned8  oem_data[256];
73 } __attribute__((packed));
74
75 /* VBE mode information.  */
76 class Multiboot_vbe_mode
77 {
78 public:
79   Unsigned16 mode_attributes;
80   Unsigned8  win_a_attributes;
81   Unsigned8  win_b_attributes;
82   Unsigned16 win_granularity;
83   Unsigned16 win_size;
84   Unsigned16 win_a_segment;
85   Unsigned16 win_b_segment;
86   Unsigned32 win_func;
87   Unsigned16 bytes_per_scanline;
88
89   /* >=1.2 */
90   Unsigned16 x_resolution;
91   Unsigned16 y_resolution;
92   Unsigned8  x_char_size;
93   Unsigned8  y_char_size;
94   Unsigned8  number_of_planes;
95   Unsigned8  bits_per_pixel;
96   Unsigned8  number_of_banks;
97   Unsigned8  memory_model;
98   Unsigned8  bank_size;
99   Unsigned8  number_of_image_pages;
100   Unsigned8  reserved0;
101
102   /* direct color */
103   Unsigned8 red_mask_size;
104   Unsigned8 red_field_position;
105   Unsigned8 green_mask_size;
106   Unsigned8 green_field_position;
107   Unsigned8 blue_mask_size;
108   Unsigned8 blue_field_position;
109   Unsigned8 reserved_mask_size;
110   Unsigned8 reserved_field_position;
111   Unsigned8 direct_color_mode_info;
112
113   /* >=2.0 */
114   Unsigned32 phys_base;
115   Unsigned32 reserved1;
116   Unsigned16 reversed2;
117
118   /* >=3.0 */
119   Unsigned16 linear_bytes_per_scanline;
120   Unsigned8 banked_number_of_image_pages;
121   Unsigned8 linear_number_of_image_pages;
122   Unsigned8 linear_red_mask_size;
123   Unsigned8 linear_red_field_position;
124   Unsigned8 linear_green_mask_size;
125   Unsigned8 linear_green_field_position;
126   Unsigned8 linear_blue_mask_size;
127   Unsigned8 linear_blue_field_position;
128   Unsigned8 linear_reserved_mask_size;
129   Unsigned8 linear_reserved_field_position;
130   Unsigned32 max_pixel_clock;
131
132   Unsigned8 reserved3[189];
133 } __attribute__((packed));
134
135 class Multiboot_info
136 {
137 public:
138   enum
139     {
140       Memory       = (1L<<0),
141       Boot_device  = (1L<<1),
142       Cmdline      = (1L<<2),
143       Mods         = (1L<<3),
144       Aout_syms    = (1L<<4),
145       Elf_shdr     = (1L<<5),
146       Mem_map      = (1L<<6),
147       Drive_info   = (1L<<7),
148       Cfg_table    = (1L<<8),
149       Boot_ld_name = (1L<<9),
150       Apm_table    = (1L<<10),
151       Video_info   = (1L<<11),
152     };
153
154   /* These flags indicate which parts of the multiboot_info are valid;
155    * see below for the actual flag bit definitions.  */
156   Unsigned32 flags;
157
158   /* Lower/Upper memory installed in the machine.
159    * Valid only if MULTIBOOT_MEMORY is set in flags word above.  */
160   Unsigned32 mem_lower;
161   Unsigned32 mem_upper;
162
163   /* BIOS disk device the kernel was loaded from.
164    * Valid only if MULTIBOOT_BOOT_DEVICE is set in flags word above.  */
165   Unsigned8 boot_device[4];
166
167   /* Command-line for the OS kernel: a null-terminated ASCII string.
168    * Valid only if MULTIBOOT_CMDLINE is set in flags word above.  */
169   Unsigned32 cmdline;
170
171   /* List of boot modules loaded with the kernel.
172    * Valid only if MULTIBOOT_MODS is set in flags word above.  */
173   Unsigned32 mods_count;
174   Unsigned32 mods_addr;
175
176   /* Symbol information for a.out or ELF executables. */
177   union
178     {
179       struct __attribute__((packed))
180         {
181           /* a.out symbol information valid only if MULTIBOOT_AOUT_SYMS
182              is set in flags word above.  */
183           Unsigned32  tabsize;  
184           Unsigned32  strsize;
185           Unsigned32  addr;
186           Unsigned32  reserved;
187         } a;
188
189       struct __attribute__((packed))
190         {
191           /* ELF section header information valid only if
192              MULTIBOOT_ELF_SHDR is set in flags word above.  */
193           Unsigned32  num;
194           Unsigned32  size;
195           Unsigned32  addr;
196           Unsigned32  shndx;
197         } e;
198     } syms;
199
200   /* Memory map buffer.
201      Valid only if MULTIBOOT_MEM_MAP is set in flags word above.  */
202   Unsigned32 mmap_count;
203   Unsigned32 mmap_addr;
204
205   /* Drive Info buffer */
206   Unsigned32 drives_length;
207   Unsigned32 drives_addr;
208
209   /* ROM configuration table */
210   Unsigned32 config_table;
211
212   /* Boot Loader Name */
213   Unsigned32 boot_loader_name;
214
215   /* APM table */
216   Unsigned32 apm_table;
217
218   /* Video */
219   Unsigned32 vbe_control_info;
220   Unsigned32 vbe_mode_info;
221   Unsigned16 vbe_mode;
222   Unsigned16 vbe_interface_seg;
223   Unsigned16 vbe_interface_off;
224   Unsigned16 vbe_interface_len;
225 } __attribute__((packed));
226
227 /* The mods_addr field above contains the physical address of the first
228    of 'mods_count' multiboot_module structures.  */
229 class Multiboot_module
230 {
231 public:
232   /* Physical start and end addresses of the module data itself.  */
233   Unsigned32 mod_start;
234   Unsigned32 mod_end;
235
236   /* Arbitrary ASCII string associated with the module.  */
237   Unsigned32 string;
238
239   /* Boot loader must set to 0; OS must ignore.  */
240   Unsigned32 reserved;
241 } __attribute__((packed));
242
243
244 /* The mmap_addr field above contains the physical address of the first
245    of the AddrRangeDesc structure.  "size" represents the size of the
246    rest of the structure and optional padding.  The offset to the beginning
247    of the next structure is therefore "size + 4".  */
248 struct AddrRangeDesc
249 {
250   Unsigned32 size;
251   Unsigned32 BaseAddrLow;
252   Unsigned32 BaseAddrHigh;
253   Unsigned32 LengthLow;
254   Unsigned32 LengthHigh;
255   Unsigned32 Type;
256   /* unspecified optional padding... */
257 } __attribute__((packed));
258
259 #endif