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:
1 parent
dd56ffbcb4
commit
2d190c221a
116 files changed
+1922
-465
No files matched your search
+9
-19
@@ -76,6 +76,7 @@ procedure registerHaltProc(proc : THaltProc);
|
||||
implementation
|
||||
|
||||
uses
|
||||
boot.mgr,
|
||||
io.syslog,
|
||||
debug.tracer,
|
||||
driver.video,
|
||||
@@ -866,6 +867,8 @@ var
|
||||
traceCard : Plv_obj;
|
||||
traceHeader : Plv_obj;
|
||||
begin
|
||||
io.syslog.logln('PANIC', 'Initializing Core Panic Handler.');
|
||||
|
||||
{ Allocate text buffers — kernel-heap, persist for system lifetime }
|
||||
faultTextBuf := pchar(kalloc(512));
|
||||
regTextBuf := pchar(kalloc(PANIC_TEXT_BUF_SIZE));
|
||||
@@ -1100,24 +1103,11 @@ begin
|
||||
|
||||
{ Mark BSOD screen as ready for panic rendering }
|
||||
ScreenReady := true;
|
||||
|
||||
io.syslog.logln('PANIC', 'Core Panic Handler Initialized.');
|
||||
end;
|
||||
|
||||
{ ====================================================================
|
||||
Unit initialization — set safe defaults before init() is called.
|
||||
==================================================================== }
|
||||
begin
|
||||
ScreenReady := false;
|
||||
PanicInProgress := false;
|
||||
HaltProc := @fallbackHalt;
|
||||
faultTextBuf := nil;
|
||||
regTextBuf := nil;
|
||||
traceTextBuf := nil;
|
||||
systemTextBuf := nil;
|
||||
bsodScreen := nil;
|
||||
faultLabel := nil;
|
||||
regLabel := nil;
|
||||
traceLabel := nil;
|
||||
systemLabel := nil;
|
||||
panicTexture := nil;
|
||||
panicDsc := nil;
|
||||
end.
|
||||
initialization
|
||||
boot.mgr.registerBoot('core.panic', @init, 'Core Panic Handler', 'arch.*.panic');
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,20 @@
|
||||
unit core;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
boot.mgr,
|
||||
core.rand,
|
||||
driver.timer.rtc;
|
||||
|
||||
implementation
|
||||
|
||||
procedure init();
|
||||
begin
|
||||
core.rand.srand((getDateTime.Seconds SHL 24) OR (getDateTime.Minutes SHL 16) OR (getDateTime.Hours SHL 8) OR (getDateTime.Day));
|
||||
end;
|
||||
|
||||
initialization
|
||||
boot.mgr.registerBoot('core', @init, 'Core Initialization', BOOT_MGR_BARRIER_LATE);
|
||||
|
||||
end.
|
||||
Reference in new issue
Block a user