summaryrefslogtreecommitdiffhomepage
path: root/src/loader/inc/impl/mb2.h
diff options
context:
space:
mode:
authorMarvin Borner2021-07-07 19:13:11 +0200
committerMarvin Borner2021-07-07 19:13:11 +0200
commit9a2d5cbdc7972d1d5bfb1ea93f82f66d113faa17 (patch)
tree08ceb8427b64a08c89a5526dfbf8b66c78f9d12c /src/loader/inc/impl/mb2.h
parent6355c3e08c9f4d3db122252abce5837c364d5b81 (diff)
Strange implementations
Diffstat (limited to 'src/loader/inc/impl/mb2.h')
-rw-r--r--src/loader/inc/impl/mb2.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/loader/inc/impl/mb2.h b/src/loader/inc/impl/mb2.h
new file mode 100644
index 0000000..3f64dbd
--- /dev/null
+++ b/src/loader/inc/impl/mb2.h
@@ -0,0 +1,61 @@
+// MIT License, Copyright (c) 2021 Marvin Borner
+
+#ifndef IMPL_MB2_H
+#define IMPL_MB2_H
+
+#include <cfg.h>
+#include <def.h>
+#include <dev.h>
+
+#define MB2_MAGIC 0xe85250d6 // Identifies kernel
+#define MB2_LOAD_MAGIC 0x36d76289 // Passed to kernel
+
+struct mb2_header {
+ u32 total_size;
+ u32 unknown;
+} PACKED;
+
+struct mb2_tag {
+ u32 type;
+ u32 size;
+} PACKED;
+
+struct mb2_memory {
+ u32 addr_low;
+ u32 addr_high;
+ u32 size_low;
+ u32 size_high;
+ u32 type;
+ u32 reserved;
+} PACKED;
+
+struct mb2_module {
+ u32 start;
+ u32 end;
+ char string[1];
+} PACKED;
+
+struct mb2_fb {
+ u32 addr_low;
+ u32 addr_high;
+ u32 pitch;
+ u32 width;
+ u32 height;
+ u8 bpp;
+ u8 type;
+} PACKED;
+
+enum mb2_tags {
+ MB2_TAG_END = 0,
+ MB2_TAG_CMDLINE = 1,
+ MB2_TAG_MODULE = 3,
+ MB2_TAG_MEMORY = 6,
+ MB2_TAG_FB = 8,
+ MB2_TAG_ACPI_1 = 14,
+ MB2_TAG_ACPI_2 = 15,
+};
+
+u8 mb2_detect(struct cfg_entry *cfg);
+void mb2_exec(struct cfg_entry *cfg);
+
+#endif