aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2024-05-02 17:48:15 +0300
committerMarin Ivanov <[email protected]>2024-05-02 17:48:15 +0300
commitddaeafc36ab692f6a1d3af4b08ca6ca0bf942d2b (patch)
treea3ba08d97f2f7008f0709e3c7acb42c14007ccd3
parentd2315e49803fd4c982ccbaf0594d65da4842a701 (diff)
cleanup: extract bootstrap and multiboot2 header from main.zig
-rw-r--r--src/bootstrap/boot.zig28
-rw-r--r--src/bootstrap/boot32.s (renamed from src/boot32.s)0
-rw-r--r--src/bootstrap/boot64.s (renamed from src/boot64.s)0
-rw-r--r--src/main.zig27
4 files changed, 29 insertions, 26 deletions
diff --git a/src/bootstrap/boot.zig b/src/bootstrap/boot.zig
new file mode 100644
index 0000000..fcb60eb
--- /dev/null
+++ b/src/bootstrap/boot.zig
@@ -0,0 +1,28 @@
+comptime {
+ asm (@embedFile("boot64.s"));
+ asm (@embedFile("boot32.s"));
+}
+
+const MAGIC = 0xE85250D6;
+const ARCHITECTURE = 0;
+
+const MultibootHeader = extern struct {
+ magic: u32,
+ architecture: u32,
+ header_len: u32,
+ checksum: u32,
+
+ tag0: u16,
+ tag1: u16,
+ tag2: u32,
+};
+
+export const multiboot2 align(4) linksection(".multiboot") = MultibootHeader{
+ .magic = MAGIC,
+ .architecture = ARCHITECTURE,
+ .header_len = 24,
+ .checksum = 0x100000000 - (MAGIC + ARCHITECTURE + 24),
+ .tag0 = 0,
+ .tag1 = 0,
+ .tag2 = 8,
+};
diff --git a/src/boot32.s b/src/bootstrap/boot32.s
index dc02102..dc02102 100644
--- a/src/boot32.s
+++ b/src/bootstrap/boot32.s
diff --git a/src/boot64.s b/src/bootstrap/boot64.s
index 493912b..493912b 100644
--- a/src/boot64.s
+++ b/src/bootstrap/boot64.s
diff --git a/src/main.zig b/src/main.zig
index 443e440..36dcd5e 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -1,35 +1,10 @@
comptime {
- asm (@embedFile("boot64.s"));
- asm (@embedFile("boot32.s"));
+ _ = @import("bootstrap/boot.zig");
}
const debug = @import("debugcon.zig");
const console = @import("console.zig");
-const MAGIC = 0xE85250D6;
-const ARCHITECTURE = 0;
-
-const MultibootHeader = extern struct {
- magic: u32,
- architecture: u32,
- header_len: u32,
- checksum: u32,
-
- tag0: u16,
- tag1: u16,
- tag2: u32,
-};
-
-export const multiboot2 align(4) linksection(".multiboot") = MultibootHeader{
- .magic = MAGIC,
- .architecture = ARCHITECTURE,
- .header_len = 24,
- .checksum = 0x100000000 - (MAGIC + ARCHITECTURE + 24),
- .tag0 = 0,
- .tag1 = 0,
- .tag2 = 8,
-};
-
export fn kmain() noreturn {
console.initialize();
console.setColor(0x2F);