QDNix
Quick’n’dirty *NIX
multiboot.h
1 #ifndef SYS_X86_MACHINE_MULTIBOOT_H
2 # define SYS_X86_MACHINE_MULTIBOOT_H 1
3 
4 # define MULTIBOOT_HEADER_MAGIC 0x1BADB002
5 # define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
6 
7 # define MULTIBOOT_MOD_ALIGN 1 << 12
8 # define MULTIBOOT_INFO_ALIGN 1 << 2
9 
10 # define MULTIBOOT_HEADER_PAGE_ALIGN 1 << 0
11 # define MULTIBOOT_HEADER_MEM_INFO 1 << 1
12 # define MULTIBOOT_HEADER_VIDEO_MODE 1 << 2
13 
14 # define MULTIBOOT_INFO_MEM 1 << 0
15 # define MULTIBOOT_INFO_BOOT_DEVICE 1 << 1
16 # define MULTIBOOT_INFO_CMDLINE 1 << 2
17 # define MULTIBOOT_INFO_MODS 1 << 3
18 # define MULTIBOOT_INFO_AOUT_SYMS 1 << 4
19 # define MULTIBOOT_INFO_AOUT_SHDR 1 << 5
20 # define MULTIBOOT_INFO_MMAP 1 << 6
21 # define MULTIBOOT_INFO_DRIVES 1 << 7
22 # define MULTIBOOT_INFO_CONFIG_TABLE 1 << 8
23 # define MULTIBOOT_INFO_BOOTLOADER_NAME 1 << 9
24 # define MULTIBOOT_INFO_APM_TABLE 1 << 10
25 # define MULTIBOOT_INFO_VBE 1 << 11
26 # define MULTIBOOT_INFO_FRAMEBUFFER 1 << 12
27 
28 # define MULTIBOOT_DRIVE_CHS 0
29 # define MULTIBOOT_DRIVE_LBA 1
30 
31 # ifndef __ASSEMBLER__
32 
33 # include <stdint.h>
34 
35 typedef struct
36 {
37  uint32_t flags;
38 
39  uint32_t mem_lower;
40  uint32_t mem_upper;
41 
42  uint32_t boot_device;
43 
44  uint32_t cmd;
45 
46  uint32_t mods_count;
47  uint32_t mods_addr;
48 
49  uint32_t syms[4];
50 
51  uint32_t mmap_length;
52  uint32_t mmap_addr;
53 
54  uint32_t drives_length;
55  uint32_t drives_addr;
56 
57  uint32_t config_table;
58 
59  uint32_t bootloader_name;
60 
61  uint32_t apm_table;
62 
63  uint32_t vbe_control_info;
64  uint32_t vbe_mode_info;
65  uint32_t vbe_interface_seg;
66  uint32_t vbe_interface_off;
67  uint32_t vbe_interface_len;
68 
69  uint64_t framebuffer_addr;
70  uint32_t framebuffer_pitch;
71  uint32_t framebuffer_width;
72  uint32_t framebuffer_height;
73  uint8_t framebuffer_bpp;
74  uint8_t framebuffer_type;
75 
76 } Multiboot;
77 
78 typedef struct
79 {
80  uint32_t size;
81  uint64_t address;
82  uint64_t length;
83  uint32_t type;
84 } __attribute__((packed)) MultibootMemEntry;
85 
86 typedef struct
87 {
88  uint32_t size;
89  uint8_t drive_number;
90  uint8_t drive_mode;
91  uint16_t drive_cylinders;
92  uint8_t drive_heads;
93  uint8_t drive_sectors;
94 } __attribute__((packed)) MultibootDriveEntry;
95 
96 int multiboot_entry(Multiboot *boot_info);
97 
98 # endif /* !__ASSEMBLER__ */
99 
100 #endif /* !SYS_X86_MACHINE_MULTIBOOT_H */