allocate AP kernel/IST stacks at bring-up, not statically
Hoist max_cpus into danos (root.zig), raise it to 128, and stop reserving a static [max_cpus][16 KiB] IST array. Only the BSP's IST stack is static (needed before the allocator); each AP's is heap-allocated when it comes online. Shrinks the kernel from ~1.1 MB to ~139 KiB in ReleaseSmall.
This commit is contained in:
@@ -283,6 +283,13 @@ fn bringUpSecondaries() void {
|
||||
continue;
|
||||
};
|
||||
const stack_top = (@intFromPtr(stack.ptr) + stack.len) & ~@as(usize, 15);
|
||||
// This core's IST (double-fault) stack — allocated only now that the core is
|
||||
// real, rather than reserved statically for every possible core.
|
||||
const ist = heap.allocator().alloc(u8, arch.ist_stack_size) catch {
|
||||
log.print(" cpu apic_id {d}: no IST stack; skipped\n", .{core.apic_id});
|
||||
continue;
|
||||
};
|
||||
arch.setApIstStack(index, (@intFromPtr(ist.ptr) + ist.len) & ~@as(usize, 15));
|
||||
const pc = scheduler.prepareSecondary(index, core.apic_id);
|
||||
var attempt: u32 = 1;
|
||||
while (attempt <= max_wake_attempts) : (attempt += 1) {
|
||||
|
||||
Reference in New Issue
Block a user