Move to multi arch support and added memory map

This commit is contained in:
2026-07-03 11:11:19 +01:00
parent c2435760c4
commit 628c4f6d57
11 changed files with 423 additions and 41 deletions
+9 -1
View File
@@ -11,6 +11,13 @@ pub fn build(b: *std.Build) void {
.root_source_file = b.path("src/root.zig"),
});
// Architecture-specific kernel code (CPU ops, entry, later GDT/IDT/paging).
// The generic kernel imports this as "arch" and never names x86_64, so a new
// architecture is a matter of pointing this module at a different directory.
const arch_mod = b.addModule("arch", .{
.root_source_file = b.path("src/arch/x86_64/cpu.zig"),
});
// --- Kernel: freestanding x86_64 ELF, jumped to by the bootloader ---
// SSE2 is part of the x86_64 baseline and UEFI leaves it enabled at handoff,
// so we keep it: disabling it forces soft-float and makes the compiler unable
@@ -35,10 +42,11 @@ pub fn build(b: *std.Build) void {
.stack_protector = false,
.imports = &.{
.{ .name = "danos", .module = mod },
.{ .name = "arch", .module = arch_mod },
},
}),
});
exe.setLinkerScript(b.path("src/linker.ld"));
exe.setLinkerScript(b.path("src/arch/x86_64/linker.ld"));
exe.entry = .{ .symbol_name = "_start" };
// Physical address the bootloader loads the kernel to (identity-mapped under
// UEFI). Overrides Zig's default image base so the linker script's layout is