summaryrefslogtreecommitdiff
path: root/kernel/include/multiboot2.h
blob: 994dbc51f5c05f57badc7458c3fc4259d895759e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef MULTIBOOT2_H
#define MULTIBOOT2_H

#include <types.h>

struct mb2_tag_header {
	uint32_t type;
	uint32_t size;
} __attribute__((packed, aligned(8)));
typedef struct mb2_tag_header mb2_tag_header;

struct mb2_tag_fb {
	uint32_t type;
	uint32_t size;
	uint64_t framebuffer_addr;
	uint32_t framebuffer_pitch;
	uint32_t framebuffer_width;
	uint32_t framebuffer_height;
	uint8_t framebuffer_bpp;
	uint8_t framebuffer_type;
} __attribute__((packed, aligned(8)));
typedef struct mb2_tag_fb mb2_tag_fb;

struct mb2_tag_mmap {
	uint32_t type;
	uint32_t size;
	uint32_t entry_size;
	uint32_t entry_version;
};
typedef struct mb2_tag_mmap mb2_tag_mmap;

struct mb2_tag_mmap_entry {
	uint64_t base_addr;
	uint64_t length;
	uint32_t type;
	uint32_t reserved;
};
typedef struct mb2_tag_mmap_entry mb2_tag_mmap_entry;

struct mb2_tag_module {
	uint32_t type;
	uint32_t size;
	uint32_t mod_start;
	uint32_t mod_end;
	char* name;
};
typedef struct mb2_tag_module mb2_tag_module;


// multiboot2 magic check
#define MB2_MAGIC		0x36D76289

// multiboot2 tag
#define MB2_TAG_END		0
#define MB2_TAG_CMDLINE		1
#define MB2_TAG_BOOTLOADER	2
#define MB2_TAG_MODULE		3
#define MB2_TAG_MEM		4
#define MB2_TAG_BIOS		5
#define MB2_TAG_MMAP		6
#define MB2_TAG_VBE		7
#define MB2_TAG_FB		8

extern mb2_tag_module* ext2_module;

void read_mb2(mb2_tag_header* multiboot_bootinfo, uint32_t multiboot_magic);
void init_fb(mb2_tag_fb* tag_fb);
void init_mmap(mb2_tag_mmap* tag_mmap);
void init_module(mb2_tag_module* tag_module);

#endif