diff options
Diffstat (limited to 'multiboot.cpp')
-rw-r--r-- | multiboot.cpp | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/multiboot.cpp b/multiboot.cpp index 0a30938..719bb5c 100644 --- a/multiboot.cpp +++ b/multiboot.cpp @@ -4,6 +4,15 @@ extern TextOutput& term; +struct multiboot2_tag +{ + alignas(8) + std::uint16_t id; + std::uint16_t flags; + std::uint32_t length; + std::uint32_t data[1]; +} __attribute__((packed)); + struct multiboot2 { static constexpr std::uint32_t MAGIC = 0xE85250D6; @@ -12,33 +21,29 @@ struct multiboot2 static constexpr std::uint32_t CHECKSUM = -(MAGIC + FLAGS + LENGTH); alignas(8) - std::uint32_t magic = MAGIC; - std::uint32_t flags = FLAGS; - std::uint32_t length = LENGTH; - std::uint32_t checksum = CHECKSUM; -} __attribute__((packed)); - -struct multiboot2_tag -{ - alignas(8) - std::uint16_t id; - std::uint16_t flags; + std::uint32_t magic; + std::uint32_t flags; std::uint32_t length; - std::uint32_t data[]; -} __attribute__((packed)); - -__attribute__((section(".multiboot2"))) -multiboot2 multibootHeader; + std::uint32_t checksum; -__attribute__((section(".multiboot2"))) -multiboot2_tag multibootTagInfoRequest = { - 1, 0, sizeof(multiboot2_tag) + sizeof(std::uint32_t), - {4} -}; + multiboot2_tag tags[]; +} __attribute__((packed)); __attribute__((section(".multiboot2"))) -multiboot2_tag multibootTagEnd = { - 0, 0, sizeof(multiboot2_tag), {} +multiboot2 multibootHeader = { + .magic = multiboot2::MAGIC, + .flags = multiboot2::FLAGS, + .length = multiboot2::LENGTH, + .checksum = multiboot2::CHECKSUM, + .tags = { + { + 1, 0, sizeof(multiboot2_tag) + sizeof(std::uint32_t), + {4} + }, + { + 0, 0, 8, {} + } + } }; std::uint32_t multiboot_magic; |