refactor: slightly refactor amd64

This commit is contained in:
Loïc Grégoire
2026-03-28 15:07:17 -04:00
parent 9b6d38bbcc
commit e654a58897
7 changed files with 4 additions and 21 deletions
+1 -1
View File
@@ -174,7 +174,7 @@ fn addKernel(b: *std.Build, plat: config.Platform, optimize: std.builtin.Optimiz
const platform_name = if (plat.bootloader) |bl|
switch (bl) {
.Limine => "limine",
.Limine => "boot/limine",
}
else if (plat.os == .linux) "um" else @tagName(plat.arch);
+1 -3
View File
@@ -1,9 +1,7 @@
const b = @import("base");
const ki = b.ke.private;
pub const name = "AMD64";
pub fn first_init() void {}
pub const name = "amd64";
pub fn early_init() void {
const impl_cpu = &ki.bootstrap_cpu.impl;
@@ -3,23 +3,16 @@ const ksyms = @import("ksyms");
const pl = b.pl;
const ke = b.ke;
const ki = ke.private;
pub const std_options = b.std_options;
pub const panic = b.panic;
pub const rtl = @import("rtl");
const std = @import("std");
var boot_info: pl.BootInfo = undefined;
export fn kmain() callconv(.c) void {
std.log.info("hello from kernel!", .{});
for (ksyms.ksyms) |sym| {
std.log.info(" 0x{x:0>16} {s}", .{ sym.addr, sym.name });
}
boot_info.memory_map.entry_count = 0;
var cpus: [1]*ke.Cpu = .{&ke.private.bootstrap_cpu};
@@ -27,5 +20,5 @@ export fn kmain() callconv(.c) void {
ke.ncpus = 1;
ke.cpus = &cpus;
ke.private.init(&boot_info);
ki.init(&boot_info);
}
-4
View File
@@ -10,10 +10,6 @@ else if (@hasDecl(config, "CONFIG_ARCH_UM"))
else
@compileError("unsupported architecture");
pub inline fn first_init() void {
return impl.first_init();
}
/// Early platform-specific initialization, called before anything else.
pub inline fn early_init() void {
return impl.early_init();
-2
View File
@@ -3,8 +3,6 @@ const b = @import("base");
pub const std_options = b.std_options;
pub const panic = b.panic;
pub const rtl = @import("rtl");
const c = @cImport({
@cInclude("SDL.h");
@cInclude("signal.h");
-2
View File
@@ -37,8 +37,6 @@ pub const GlobalState = struct {
pub var global_state: GlobalState = undefined;
pub threadlocal var my_cpu: *ke.Cpu = undefined;
pub fn devices_init() void {}
pub fn debug_write(char: u8) void {
_ = linux.write(linux.STDERR_FILENO, @ptrCast(&char), 1);
}