From 9a2d5cbdc7972d1d5bfb1ea93f82f66d113faa17 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 7 Jul 2021 19:13:11 +0200 Subject: Strange implementations --- src/loader/inc/impl/mb2.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/loader/inc/impl/mb2.h (limited to 'src/loader/inc/impl/mb2.h') 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 +#include +#include + +#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 -- cgit v1.2.3