aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2024-05-01 16:34:00 +0300
committerMarin Ivanov <[email protected]>2024-05-01 16:34:00 +0300
commited3ef0fdab8b0ccb57e67e3be4f8c8b7581343dd (patch)
tree1e4b58bd11e27ad9d7929e56bc34fe2be6d5b0c9 /src
parent7aaeee46c3bfc0ddaf6845a88a2eef5224f9ceac (diff)
boot: convert to multiboot2
Diffstat (limited to 'src')
-rw-r--r--src/grub.cfg2
-rw-r--r--src/main.zig24
2 files changed, 18 insertions, 8 deletions
diff --git a/src/grub.cfg b/src/grub.cfg
index 7904bf7..2629c03 100644
--- a/src/grub.cfg
+++ b/src/grub.cfg
@@ -1,3 +1,3 @@
menuentry "Zig Bare Bones" {
- multiboot /boot/kernel.elf
+ multiboot2 /boot/kernel.elf
}
diff --git a/src/main.zig b/src/main.zig
index adef54c..de91b83 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -2,19 +2,29 @@ const debug = @import("debugcon.zig");
const ALIGN = 1 << 0;
const MEMINFO = 1 << 1;
-const MAGIC = 0x1BADB002;
-const FLAGS = ALIGN | MEMINFO;
+const MAGIC = 0xE85250D6;
+// const FLAGS = ALIGN | MEMINFO;
+const FLAGS = 0;
const MultibootHeader = extern struct {
- magic: i32,
- flags: i32,
- checksum: i32,
+ magic: u32,
+ flags: u32,
+ len: u32,
+ checksum: u32,
+
+ tag0: u16,
+ tag1: u16,
+ tag2: u32,
};
-export const multiboot align(4) linksection(".multiboot") = MultibootHeader{
+export const multiboot2 align(4) linksection(".multiboot") = MultibootHeader{
.magic = MAGIC,
.flags = FLAGS,
- .checksum = -(MAGIC + FLAGS),
+ .len = 24,
+ .checksum = 0x100000000 - (MAGIC + FLAGS + 24),
+ .tag0 = 0,
+ .tag1 = 0,
+ .tag2 = 8,
};
export fn _start() callconv(.Naked) noreturn {