]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
feat: AP scheduler entry (SMP Phase 3)
authorTulio A M Mendes <[email protected]>
Mon, 16 Feb 2026 19:00:38 +0000 (16:00 -0300)
committerTulio A M Mendes <[email protected]>
Mon, 16 Feb 2026 19:00:38 +0000 (16:00 -0300)
commitda6ce662266f54c673350e20087c0ba6db8c2383
tree79d3175842d9a147c3f816f57b175e1b4b632791
parent95f04a0a742c908d8121b72ebb0eaefd5582758c
feat: AP scheduler entry (SMP Phase 3)

Enable scheduling on Application Processors:

- Load IDT on APs via idt_load_ap() — root cause of AP crashes was
  missing lidt, causing triple-fault when LAPIC timer fires
- Create per-CPU idle process for each AP in sched_ap_init()
- Start LAPIC timer on APs using BSP-calibrated ticks (no PIT
  recalibration needed — all CPUs share same bus clock)
- AP timer handler calls schedule() for local CPU runqueue
- BSP signals APs via ap_sched_go flag after timer_init completes
- Allocations in sched_ap_init done outside sched_lock to avoid
  ABBA deadlock with heap lock
- TSS updates restricted to CPU 0 (shared TSS, only BSP runs
  user processes)
- AP stack increased to 8KB to match kernel thread stack size

All processes still assigned to CPU 0 — Phase 4 will add load
balancing to distribute processes across CPUs.

83/83 smoke tests pass (8s), cppcheck clean.
include/arch/x86/idt.h
include/arch/x86/lapic.h
src/arch/x86/idt.c
src/arch/x86/lapic.c
src/arch/x86/smp.c
src/hal/x86/timer.c
src/kernel/main.c
src/kernel/scheduler.c