aboutsummaryrefslogtreecommitdiffstats
path: root/multiboot.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2024-09-28 10:01:26 -0400
committerClyne Sullivan <clyne@bitgloo.com>2024-09-28 10:01:26 -0400
commit376d7ec265085ae3a77664356a2ad35921cfccaf (patch)
treeb2afd73c602889a59be763542c086371344ecabe /multiboot.cpp
parent8f9329da623bf0812df44f60867180020283ff3f (diff)
millisecond pit; fix multiboot headers for optimization
Diffstat (limited to 'multiboot.cpp')
-rw-r--r--multiboot.cpp51
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;