# Spec conformance — kido-sched (2026-10-14)

Checked against `imports/kido.json` (portable + adaptive from birth,
outer kernel-node compensating BUBO's x86-bound heritage) and the
Gate-approved module interfaces (boot, hal-arm64, mem, entry-arm64).

## kido.json conformance

- **Portable:** scheduler core is portable C11; ARM64 specifics isolated
  in kido-sched-arm64.S. Arch discipline enforced by #error. MET.
- **Adaptive:** drivers selected at boot (HAL wiring applied this
  session); scheduler consumes the HAL timer opportunistically, never
  assumes it. MET.
- **Honest status:** cooperative-only is declared in the header (P1);
  preemption is a loud non-goal, not a silent omission. MET.

## Interface conformance

| Requirement | Result |
|---|---|
| Task control blocks (id, state, entry, stack) | MET — kido_task_t |
| Run queue, round-robin | MET — static table + pick_next, 33 hosted checks |
| Task creation with stack carving | MET — explicit bounded carve; kido-mem seed list (bare metal), static array (hosted) |
| Voluntary yield | MET — kido_sched_yield, AAPCS64-correct |
| Loud halt on empty queue | MET (by D1 mapping — see below) |
| Context switch ARM64 | MET — .S saves/restores x19-x28/FP/LR/SP; cross-assembled, encodings verified in disassembly |
| Timer ticks for accounting | MET — per-task ticks_run from HAL timer; NULL-tolerant |
| Approved files untouched except wiring | MET — only kido-boot.c adapt() bare-metal branch + guarded includes (the ONE approved wiring) |
| Wiring: adapt() calls kido_hal_arm64_fill() | MET — board_id from entry shim bootinfo; compiles hosted + ARM64 + x86_64 bare-metal; hosted boot regression PASS (HANDOFF=5) |

## Deliberation conformance (P1–P6, C1–C4)

- P1 cooperative, no fake preemption: MET — header declares it.
- P2 static table, never allocates: MET.
- P3 explicit carving, allocator replaces it: MET (+ improvement: DONE slots recycle with their stacks — no carve leak on churn).
- P4 minimal callee-saved context in .S: MET — inline asm rejected for soundness, separate .S used.
- P5 ticks for accounting only: MET.
- P6 empty queue halts LOUD: MET by documented D1 mapping.
- C1 starvation: documented. C2 carve/allocator overlap: declared temporary. C3 hosted execution gap: queued QEMU. C4 UP-only: asserted in header.

## Score

**14 MET / 0 PARTIAL / 3 DEFERRED / 2 explicitly unproven.**

DEFERRED (all declared):
1. Preemptive scheduling (needs GIC + timer IRQ — HAL loud stubs).
2. The allocator replacing explicit carving.
3. `KIDO_ERR_NO_TASKS` header code replacing the D1 STUB_REACHED mapping — queued for N8toriousAi's Gate approval (touches the approved header).

UNPROVEN (stated honestly):
1. Register-level task switching has not EXECUTED (cross-assembled only). Queued: QEMU task-switch integration when kido_main wires the scheduler.
2. Bare-metal stack carving against a real DTB region (probe stub still fires first; carve anchor verified only via hosted array).
