summaryrefslogtreecommitdiff
path: root/kernel/mboot/mboot.h
blob: 7e8c09a337f4f0623bd586d8dadf528984266864 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**
 * @file mboot.h
 *
 * @author Freya Murphy <freya@freyacat.org>
 *
 * Internal multiboot structures
 */

#ifndef __MBOOT_H_
#define __MBOOT_H_

#include <lib.h>

#define MBOOT_HEADER_MAGIC 0x36D76289

#define MBOOT_CMDLINE 1
#define MBOOT_MEMORY_MAP 6
#define MBOOT_FRAMEBUFFER 8
#define MBOOT_ELF_SYMBOLS 9
#define MBOOT_OLD_RSDP 14
#define MBOOT_NEW_RSDP 15

struct mboot_info {
	uint32_t total_size;
	uint32_t reserved;
	char tags[];
};

struct mboot_tag {
	uint32_t type;
	uint32_t size;
	char data[];
};

struct mboot_tag_elf_sections {
	uint32_t type;
	uint32_t size;
	uint16_t num;
	uint16_t entsize;
	uint16_t shndx;
	uint16_t reserved;
	char sections[];
};

struct mboot_tag_elf_sections_entry {
	uint32_t sh_name;
	uint32_t sh_type;
	uint64_t sh_flags;
	uint64_t sh_addr;
	uint64_t sh_offset;
	uint64_t sh_size;
	uint32_t sh_link;
	uint32_t sh_info;
	uint64_t sh_addralign;
	uint64_t sh_entsize;
};

struct mboot_mmap_entry {
	uint64_t addr;
	uint64_t len;
	uint32_t type;
	uint32_t zero;
};

struct mboot_tag_mmap {
	uint32_t type;
	uint32_t size;
	uint32_t entry_size;
	uint32_t entry_version;
	struct mboot_mmap_entry entries[];
};

struct mboot_tag_old_rsdp {
	uint32_t type;
	uint32_t size;
	char rsdp[];
};

struct mboot_tag_new_rsdp {
	uint32_t type;
	uint32_t size;
	char rsdp[];
};

struct mboot_tag_cmdline {
	uint32_t type;
	uint32_t size;
	uint8_t cmdline[];
};

struct mboot_tag_framebuffer {
	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;
	uint16_t reserved;
};

void *locate_mboot_table(uint32_t type);

#endif /* mboot.h */