feat: fireworks!

This commit is contained in:
Loïc Grégoire
2026-04-18 20:44:52 -04:00
parent 712a8012af
commit 8fc133cc3c
18 changed files with 186 additions and 127 deletions
+9
View File
@@ -28,6 +28,15 @@ pub const map_kernel = if (!is_um)
const rodata_size = rodata_end - rodata_start;
const data_size = data_end - data_start;
const start_phys = kaddr.physical_base;
const start_virt = kaddr.virtual_base;
const until_size = text_start - start_virt;
mi.kernel_pmap.map_contiguous_range(start_virt, start_phys, until_size, .{
.read = true,
.write = true,
.global = true,
});
mi.kernel_pmap.map_contiguous_range(text_start, kaddr.physical_base + (text_start - kaddr.virtual_base), text_size, .{
.read = true,
.execute = true,
+9
View File
@@ -51,6 +51,15 @@ var batch_pool: std.atomic.Value(GlobalHead) = .init(.{
.tag = 0,
});
export const phys_percpu_init linksection(r.percpu_init) = &init_cpu;
fn init_cpu() callconv(.c) void {
const cpu = percpu.local();
cpu.active_batch = null;
cpu.active_count = 0;
cpu.depot_count = 0;
}
/// Push a batch of free pages to the global pool.
fn push_to_pool(batch: *mm.Page) void {
var old_head = batch_pool.load(.acquire);
+8 -6
View File
@@ -766,12 +766,14 @@ pub fn late_init() linksection(r.init) void {
z.cpus = gpa.alloc(Cpu, ke.ncpus) catch @panic("Failed to allocate per-CPU magazine state");
for (0..ke.ncpus) |i| {
z.cpus[i].lock = .init();
z.cpus[i].alloc = null;
z.cpus[i].free = null;
z.cpus[i].alloc_rounds = 0;
z.cpus[i].free_rounds = 0;
z.cpus[i].magazine_size = z.magtype.?.rounds;
z.cpus[i] = .{
.lock = .init(),
.alloc = null,
.free = null,
.alloc_rounds = 0,
.free_rounds = 0,
.magazine_size = z.magtype.?.rounds,
};
}
}
zone = z.next;