Repository navigation
BooleOS 0.18.0 - Phase 18: Safety/portability foundation (HAL, msg(ID), Safe Mode)
BooleOS 0.18.0 - Phase 18: Safety/portability foundation (HAL, msg(ID), Safe Mode)
All you need to run it is QEMU; the exact command is in the README.txt inside the ISO package.
booleos-0.18.0-iso-img(originally-nullos).zip: the bootable ISO built from this tag (the image itself still says NullOS, because the project was renamed after this version), the blank disk image when this version has one, and aREADME.txtwith the QEMU command and what this ISO doesbooleos-0.18.0-docs-original.zip: the docs of this version, exactly as they were
Changes
Added
- Hardware abstraction layer (
kernel/hal.h,kernel/hal.c,
docs/hal.md): an arch-neutral interface over the existing drivers, as thin
forwarding wrappers (the drivers were not rewritten).- Console:
console_putc,console_puts,console_put_hex,
console_put_dec,console_set_color,console_clear,
console_set_cursor,console_color_t(CONSOLE_*). - Input:
input_poll_key,input_poll_raw,input_flush. - Block device:
block_read_sector,block_write_sector. - Power:
power_reboot,power_shutdown(reachable throughhal.h). - Boot info:
hal_boot_init,boot_get_memory_map,boot_get_module,
boot_get_info_region,boot_get_cmdline,boot_has_flag, backed by new
Multiboot2 parsers (memory map, command line) inkernel/multiboot2.h.
The kernel used to ignore the command line entirely (thedebugword of the
"serial debug mode" GRUB entry was never read).
- Console:
msg(ID), a central table for all user-visible text (one English
column; not a translation system):kernel/messages.h/.cfor the kernel
(boot log, errors, dumps, exception names,psstates) and
user/lib/messages.h/.cfor the shell, editor andcat(umsg_id_t,
UMSG_*, linked only into those programs).msg()never returns NULL
("(?)"for a bad ID) and works from the exception handler. Output is
unchanged.selftest/forktestandinit/spintestare not migrated.- Safe Mode (
docs/safemode.md), a recovery environment inside the same
kernel binary that runs in ring 0 before the PMM, VMM, heap, scheduler,
execand syscalls exist:- a boot configuration store in one raw sector (LBA 1, inside FAT16's
reserved region, read and written only through the HAL block I/O, magic
line# nullos-config v1, empty defaults when the sector is invalid,
guarded by the boot sector'sreserved_sectors) —kernel/bootcfg.h/.c; - a boot failure counter (
boot_fail_count): incremented right after the
disk is up, reset on the first keyboard read; at
BOOTCFG_FAIL_THRESHOLD(3) failed boots in a row, or withsafemodeon
the boot command line, the kernel enters Safe Mode instead of booting; - a text UI (
kernel/safemode.c, static buffers, no heap): reboot normally
(resets the counter), a reboot submenu, disk info from the raw boot
sector, and a sector hexdump; Safe Mode is left only by rebooting; - a restricted read-only shell (menu item 5,
kernel/safeshell.c) that
initializes the PMM, VMM, heap and FAT16 on demand, once per session, and
offershelp,ls,cat,pwd,cd,backcalling FAT16 directly —
no processes, noexec; - GRUB entries "NullOS (Safe Mode)" (
safemodeflag) and "NullOS
v (previous release)", which boots the last release's kernel and
ramfs kept together in the trackedtools/prev/;make snapshotrecords
the current build there (run by hand after tagging a release, never
automatically).tools/prev/holds the v0.17.1 build.
- a boot configuration store in one raw sector (LBA 1, inside FAT16's
Changed
- Everything outside the drivers goes through the HAL:
kmain,syscall.c,
process.c,scheduler.c,exec.c,power.c,memory/{pmm,vmm,heap}.c,
drivers/pci.c, all disk access infs/fat16.c, andidt.c's exception
handler and progress lines (the HAL console holds no state of its own, so
this adds no risk there). Driver bring-up calls stay direct.kmain's
Multiboot magic check goes throughhal_boot_init(). ata_init()runs right after interrupts are enabled, before the PMM (it is
still called once), so the boot log shows[ATA]before[PMM].pmm_init()consumes the bootloader's real memory map instead of one fixed
contiguous block: only usable regions are freed (rounded inward to pages,
fragmented maps supported), the first 1 MB and 1–4 MB stay reserved, and
kmainmarks the ramfs module and the Multiboot2 info block used by their
real addresses. The allocation ceiling is an explicit 8 MB (PMM_LIMIT_ADDR,
2048 pages): the kernel touches physical pages through its 0–8 MB identity
map, so nothing above it is handed out. This is a mitigation of a
pre-existing bug recorded inPROGRESS.md(fix: Phase 22);[PMM] Total
in the boot log now shows the allocatable 8192 KB (it used to show the old
compile-time 32768 KB cap).tools/make_disk.shpasses-R 8tomkfs.vfatso sector 1 is explicitly
outside FAT16 (existing disks already have it: 4 reserved sectors).PROGRESS.mdrecords two pre-existing problems found during this phase:
the kernel writes to physical pages through the identity map without
checking (elf.c,process.c; Phase 22), andeditwith no file name
cannot save (Ctrl+S reports the misleading "saved (no disk)").kernel/version.h:0.18.0, phase18, "Safety/portability foundation".
Fixed
pmm_free_pages()over-reported by the total page count since Phase 2:
pmm_usedstarted at 0 while the bitmap started all-used, so releasing a
region drove it negative (the old boot log showedFree: 61440KBfor
Total: 32768KB). It now starts at the total; boot free is 1024 pages
(4096 KB), the real figure.
Full history: CHANGELOG.md