feature: boot.mgr replace hardcoded init sequence with dependency-driven boot manager

Introduce boot.mgr - a self-registering, dependency-ordered boot
initialization framework with barrier-based phasing and glob pattern
matching. Units now declare their own init procedures and dependencies
via registerBoot()/registerBarrier() in their initialization sections,
boot.mgr.run() topologically sorts and executes them.

- Add src/boot/boot.mgr.pas with topoSort, glob matching, barrier
  two-pass algorithm, and boot tree printer
- Gut src/asuro.pas (kmain): now just stores multiboot info, calls
  System.init(), boot.mgr.run, and yield()
- Add initialization sections with registerBoot() to 53 existing units
- Add new units: core.pas, test.pas, driver.storage.boot.pas,
  app.wasm.pas, app.bsod.pas (factored out of asuro.pas)
- Define 9 barrier phases: immediate -> early -> middle -> storage ->
  bus -> device -> bus.late -> late -> final
- Fix xHCI ISR: exclude PRC/WRC from PORTSC change bit clearing to
  prevent race with port reset busy-wait
- Fix driver.bus.usb.core fire_completion_hooks: guard against uint32
  underflow when CompletionHookCount = 0
- Move auto_mount_volumes from device barrier to late barrier so it
  runs after PCI scan discovers storage controllers
- Add toolchain/compile_initcalls.sh for boot entry extraction
- Add Boot Registration sections to all 51 doc files; create 4 new
  doc files; rewrite boot.mgr.md; update mkdocs.yml nav
This commit is contained in:
t3hn3rd committed 2026-03-13 15:37:43 +00:00
1 parent dd56ffbcb4
commit 2d190c221a
116 files changed
+1922 -465

No files matched your search

+4
View File
@@ -15,6 +15,7 @@ unit io.stdio;
interface
uses
boot.mgr,
memory.heap, core.strings, core.util, arch.x86.util, debug.tracer;
type
@@ -670,4 +671,7 @@ begin
io.syslog.logln('STDIO', 'Initialized.');
end;
initialization
boot.mgr.registerBoot('io.stdio', @init, 'Standard I/O Abstraction', BOOT_MGR_BARRIER_EARLY);
end.
+13 -4
View File
@@ -11,6 +11,9 @@ unit io.syslog;
interface
uses
boot.mgr;
type
TLogHook = procedure(msg: pchar);
@@ -52,10 +55,11 @@ const
LINE_BUF_SIZE = 256;
var
Hooks : array[0..MAX_HOOKS-1] of TLogHook;
HookCount : uint32 = 0;
LineBuf : array[0..LINE_BUF_SIZE-1] of char;
LinePos : uint32 = 0;
Hooks : array[0..MAX_HOOKS-1] of TLogHook;
HookCount : uint32 = 0;
LineBuf : array[0..LINE_BUF_SIZE-1] of char;
LinePos : uint32 = 0;
Initialized : boolean = false;
{ ---- Hook management ---- }
@@ -110,6 +114,7 @@ end;
procedure logChar(c: char);
begin
{ Also send each char to driver.io.serial directly for immediate byte-level output }
if not Initialized then exit; { Avoid calling driver.io.serial before it's ready }
driver.io.serial.send(COM1, uint8(c), 10000);
if c = #10 then begin
dispatchLine;
@@ -285,10 +290,14 @@ begin
Hooks[i] := nil;
HookCount := 0;
LinePos := 0;
Initialized:= true;
{ Note: We don't register serialHook here because logChar already sends
each character to driver.io.serial directly. The hook system is for line-level
consumers (file logging, debug panels, etc.) that want complete lines.
If we registered serialHook, driver.io.serial would get double output. }
end;
initialization
boot.mgr.registerBoot('io.syslog', @init, 'Syslog Interface', 'driver.io.serial');
end.