asuro¶
Kernel main entry point implementing the full Asuro boot sequence.
Overview¶
asuro contains kmain, the first Pascal-level function called by the bootloader after the assembly stub hands off control. It performs the complete linear boot sequence: hardware initialization, memory management setup, driver loading, filesystem mounting, process manager initialization, desktop launch, and final transition into the timer-driven idle loop.
kmain accepts the Multiboot2 info pointer and magic value directly from the bootloader. It validates the magic number immediately; a mismatch triggers a kernel panic before any further initialization proceeds.
The boot sequence is instrumented with boot.splash progress updates from 5% through 100%, giving visual feedback during the lengthy driver and unit-test phases. All logging is routed through io.syslog from the very first line after serial initialization.
After all subsystems are initialized the function calls yield, which enables interrupts and halts the CPU in a loop. All subsequent work is driven by the timer ISR and the preemptive scheduler.
Dependencies¶
arch.x86.gdt,arch.x86.idt,arch.x86.irq,arch.x86.isr,arch.x86.isr.mgr,arch.x86.isr.tmr0arch.x86.fault,arch.x86.cpu,arch.x86.memory.physical,arch.x86.memory.virtualarch.x86.v86,arch.x86.proc.sched,arch.x86.panic,arch.x86.bdamemory.heap,io.stdio,io.syslog,debug.tracerdriver.io.serial,driver.timer.rtcdriver.video,driver.video.gpu,driver.video.vesa,driver.video.doublebuffer,driver.video.bgadriver.video.lvgl,driver.video.desktop,driver.video.windowsdriver.hid.ps2.keyboard,driver.hid.ps2.mousedriver.bus.pci,driver.bus.usb(and sub-units: ehci, ohci, uhci, xhci, hub, core, types)driver.hid.usb.keyboard,driver.hid.usb.mousedriver.storage.mgr,driver.storage.vol.mgr,driver.storage.fs.mgrdriver.storage.fs.fat32,driver.storage.fs.flatfs,driver.storage.fs.iso9660driver.storage.ctl.ahci,driver.storage.ctl.usb,driver.storage.vfs,driver.storage.testdriver.net,driver.net.dev.e1000driver.mgr,driver.exp.testdriverproc.mgr,proc.testprocsapp.mgr,app.vterminal,app.partcmd,app.volcmd,app.uidebugboot.splashcore.panic,core.rand,core.strings,core.utilcore.enc.base64,core.enc.md5,core.enc.fnv1a,core.enc.djb2core.ds.*(fifo, cfifo, cfifols, circ, lifo, lists, hashmap, bloom, minh, maxh, prio)core.gfx.color,core.gfx.fontssvc.gfxd,svc.usbdwasm,wasm.vm.io,wasm.test,wasm.test.framework
Functions and Procedures¶
kmain¶
Exported as kmain (public alias). Executes the full boot sequence in the order listed below.
terminal_command_bsod (internal)¶
Registered as the BSOD shell command. Requires exactly two parameters (error title and info string); passes them to core.panic.panic. Writes a usage error to stderr if the parameter count is wrong.
yield (internal)¶
Enables interrupts with STI then enters an infinite HLT loop. Called as the last statement in kmain to idle the CPU; all subsequent execution is driven by timer and device interrupts.
Boot Sequence¶
The steps performed by kmain in order:
System.init— FPC RTL initialization.driver.io.serial.init— serial port for early logging.io.syslog.init— kernel log system.- Multiboot magic validation — panics if not
MULTIBOOT_BOOTLOADER_MAGIC. arch.x86.gdt.init— GDT load; validates CS =$08or panics.arch.x86.idt.init,arch.x86.irq.init,arch.x86.isr.mgr.init,arch.x86.fault.init,driver.timer.rtc.init— interrupt infrastructure.arch.x86.memory.physical.init,arch.x86.memory.virtual.init,memory.heap.init— memory management.arch.x86.v86.init— Virtual 8086 monitor.io.stdio.init— command registry; registersBSODcommand.arch.x86.cpu.init— CPUID detection.debug.tracer.init— call trace ring buffer.driver.mgr.init, GPU/video/VESA/double-buffer/BGA initialization — display subsystem.lvgl_init— LVGL initialized with front buffer dimensions.arch.x86.panic.init— LVGL-based BSOD panic screen.boot.splash.init— boot splash screen.driver.storage.vfs.init,driver.storage.test.init— VFS.- WASURO VM initialization (
wasm.vm.io,wasm.wasm_init). - Storage manager, volume manager, filesystem manager initialization.
STI+ timer hook (arch.x86.isr.tmr0.hook) — interrupts enabled.- Filesystem drivers: FAT32, FlatFS, ISO 9660.
proc.mgr.init— process manager (first call, before device drivers).- Device drivers: PS/2 keyboard, PS/2 mouse, test driver, e1000 NIC, AHCI.
- Bus drivers: USB, PCI.
driver.storage.vfs.auto_mount_volumes— auto-mount discovered volumes.driver.net.init— network stack.app.mgr.init— application and command registration.proc.mgr.init— second call (re-initializes process table for post-driver state).core.rand.srand— RNG seeded from RTC date/time.- Unit test suite — runs tests for strings, USB layers, data structures, WASM, and VFS.
boot.splash.teardown,driver.video.desktop.init— desktop environment launched.app.vterminal.init— visual terminal registered with desktop.svc.gfxd.init,svc.usbd.init— graphics and USB daemon processes spawned.arch.x86.proc.sched.init— preemptive context switching enabled (replaces ISR_32).yield— CPU enters idle HLT loop.
Notes¶
proc.mgr.init is called twice: once before device drivers (so that submit_io has a valid CurrentProcess pointer) and again after app.mgr.init to reset the process table to a clean post-initialization state.
The debug.tracer.freeze call at the top of kmain disables tracing before the call stack is established; debug.tracer.init re-enables it later with the initial 'kmain' trace entry.
The WASURO I/O write-char hook is pointed at io.syslog.logchar so WASM VM diagnostic output is routed through the kernel log before the process manager is up.