feat(pl/pc): add APIC timer support

This commit is contained in:
Loïc Grégoire
2026-04-18 11:18:33 -04:00
parent 1aa6743f43
commit a1db75746a
13 changed files with 175 additions and 48 deletions
+23 -16
View File
@@ -193,29 +193,36 @@ fn addKernel(b: *std.Build, plat: config.Platform, optimize: std.builtin.Optimiz
kernel.root_module.omit_frame_pointer = false;
const modules: []const *std.Build.Module = &.{ config_module, ksyms_module, rtl, arch, kernel.root_module };
if (plat.os == .freestanding) {
kernel.linkage = .static;
kernel.pie = false;
kernel.root_module.pic = false;
kernel.root_module.strip = false;
kernel.root_module.stack_check = false;
kernel.root_module.stack_protector = false;
kernel.root_module.unwind_tables = .none;
for (modules) |m| {
m.pic = false;
m.strip = false;
m.stack_check = false;
m.stack_protector = false;
m.unwind_tables = .none;
m.omit_frame_pointer = false;
m.code_model = switch (plat.arch) {
.x86_64 => .kernel,
.riscv64 => .medium,
else => .large,
};
switch (plat.arch) {
.x86_64 => {
m.red_zone = false;
},
else => {},
}
}
kernel.entry = .{ .symbol_name = "kmain" };
kernel.root_module.code_model = switch (plat.arch) {
.x86_64 => .kernel,
.riscv64 => .medium,
else => .large,
};
switch (plat.arch) {
.x86_64 => kernel.root_module.red_zone = false,
else => {},
}
switch (plat.arch) {
.x86_64 => {
kernel.root_module.addAssemblyFile(b.path("src/kern/amd64/locore.s"));