refactor: move directories around a bit

This commit is contained in:
Loïc Grégoire
2026-03-30 20:05:45 -04:00
parent faf76ca485
commit 827e8bf0ca
11 changed files with 34 additions and 11 deletions
+62
View File
@@ -0,0 +1,62 @@
const b = @import("base");
const amd64 = b.arch;
const std = @import("std");
const ki = b.ke.private;
const cpu = amd64.cpu;
pub const name = "PC";
const com1 = 0x3F8;
fn com1_init() linksection(b.init) void {
cpu.outb(com1 + 0x3, 0x80);
cpu.outb(com1 + 0x0, 0x0c);
cpu.outb(com1 + 0x1, 0x00);
cpu.outb(com1 + 0x3, 0x03);
cpu.outb(com1 + 0x2, 0xc7);
cpu.outb(com1 + 0x4, 0x00);
}
fn com1_write(c: u8) void {
while ((cpu.inb(com1 + 0x5) & 0x20) == 0) {}
if (c == '\n') {
cpu.outb(com1, '\r');
}
cpu.outb(com1, c);
}
pub fn early_init() linksection(b.init) void {
com1_init();
cpu.detect_cpu_features();
const f = cpu.cpu_features;
std.log.info("amd64/cpu: {s}", .{&f.brand_string});
std.log.info("amd64/cpu: vendor={s} x2apic={} la57={} nx={} pcid={} pge={} smap={} smep={} pdpe1g={} invtsc={} xsave={} fxsave={} tsc-deadline={}", .{
&f.vendor_string,
@intFromBool(f.x2apic),
@intFromBool(f.five_level_paging),
@intFromBool(f.nx),
@intFromBool(f.pcid),
@intFromBool(f.pge),
@intFromBool(f.smap),
@intFromBool(f.smep),
@intFromBool(f.gib_pages),
@intFromBool(f.invariant_tsc),
@intFromBool(f.xsave),
@intFromBool(f.fxsave),
@intFromBool(f.tsc_deadline),
});
}
pub fn late_init() void {}
pub fn devices_init() void {}
pub fn debug_write(c: u8) void {
com1_write(c);
}
pub fn arm_timer(_: u64) void {}