SchOS/.claude/memory/MEMORY.md
Nexoniarz e577791e5e memory: the SMP crash is SMP-only, and what the font work cost
Two notes worth keeping out of the commit log because they are about where to
start next time rather than what changed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-21 21:05:52 +02:00

7.7 KiB

  • SchOS rename + git — Schunix is SchOS and the kernel is SchIFT; the tree is under local git, and the two bugs the rename caused.
  • Cross-platform build - Windows, Linux, macOS and BSD all build it; clang everywhere, and the four host assumptions that used to break.
  • Memory sync - memory lives in the repo at .claude/memory/; tools/memory-sync.sh moves it between machines.
  • The Linux machine - Fedora laptop at /home/nexoniarz/Documents/SchOS; the three things only it can test, all now green.
  • Bugs the Fedora move exposed - mkfs.c's DT_* ordering, and a stack walker that page-faulted on an all-ones frame pointer.
  • Performance and init - BSIZE must equal SCHFS_BLKSIZE (4-34x), and why Ctrl-C could kill pid 1.
  • Trusting bootcheck - it silently stopped running; count the [ok] lines, never just grep FAIL.
  • schinit - process 1 is launchd-shaped; job manifests, and why setsid() cost the shell its terminal.
  • BIOS/UEFI split - boot/bios and boot/uefi, and the hand-off contract a second loader must satisfy.
  • UEFI loader - it boots to an interactive shell now; the SCH64 entry, the GDT trap, and the four bugs that stood in the way.
  • ioremap and BARs - never P2V a BAR; firmware puts 64-bit BARs far above the direct map.
  • Schunix build environment — builds natively on Windows with clang/lld + mingw + Git Bash; WSL is gone, and the five latent bugs the move exposed.
  • Syscalls: one table — declare in kernel/sys/table.inc only; linux_abi.c is generated, never hand-edited.
  • Linux ABI decision — the native syscall ABI is being dropped; Linux numbering becomes the only ABI.
  • Rewrite priorities — what actually blocks the OS, in order, plus a confirmed SMP bug in the syscall entry path.
  • SMP and RAM-floor bugs — SMP works (five bugs, and why __thread is wrong for per-CPU data); the 224 MB floor is gone.
  • SchFS and ramdisk root — the agreed BeFS/ZFS/btrfs synthesis, and the completed make ramroot + mkfs dedup work.
  • SchFS B-tree, phase 1 — the CoW B-tree is built and passing; run make schfs-test after touching it.
  • SchFS phase 2: real mount — mkschfs writes images, the kernel mounts them read-only; make schfs-check, plus four traps worth remembering.
  • SchFS phase 3: writes — full write API, free map derived not stored, and mount -t schfs works; the VFS now dispatches through struct fs_ops.
  • DIRSIZ 14 -> 30 — filenames used to truncate silently; fixed by holding the HTree bucket at 256 bytes.
  • Linux open flags — include/fcntl.h must hold Linux's values; a mismatch made >> truncate.
  • Shared memory and mmap — shm + file-backed mmap work; pages you don't own must never reach kfree.
  • Wall clock — the RTC was never read, so date said 1970; kernel/core/time.c fixes it, plus the stale-image trap.
  • TTF rasteriser — glyf outlines (not CFF, and why); the composite-glyph trap that loses the letter "i".
  • Text rendering — the layer replacing the 8x16 cell grid; metrics, surfaces, coverage blending, UTF-8.
  • Console and TTY — ANSI parser, termios, UTF-8; the font is CP437 not Latin-1, plus five bugs that masqueraded as broken commands.
  • Build speed — no-op make is ~2s now; what made it 1m48 and the traps that would undo it.
  • PCI and drivers — bus enumeration, and where a driver that finds its own hardware goes.
  • ISO boot — make iso; needs El Torito no-emulation + ATAPI because the loader never uses INT 13h.
  • Ramdisk root sizing — the "disk full" was DOOM WADs, not FSSIZE; three Makefile knobs, and why excluding them is a licensing rule.
  • Framebuffer device — /dev/fb0 is real and speaks Linux fbdev; never assume where the framebuffer lives.
  • Crash screen — PSOGM lives in kernel/core/panic.c; echo c > /proc/sysrq to trigger, make crashshot to photograph.
  • QR encoder — kernel/core/qr.c for crash reports; make qrcheck, and the segno padding bug that is not ours.
  • Boot splash and logo — the loader draws the logo, not the kernel; STAGE2_SECTORS was in five places and is now in one.
  • SchAPI direction — Schunix as a macOS-shaped system; the stable ABI is a library, not the syscall table.
  • Schcom v0 - the compositor runs; Wayland-shaped, verified by checking pixels from the host.
  • SchFS next + platform roadmap - snapshots/scrub/compression/encryption, one home for the format, a unified loader, audio; and the 614 MB ceiling that was fixed.
  • Roadmap and projects/ — the agreed order through to Schcom/SchWM/SchDE; the GUI and installer live outside the OS tree.
  • Driver infrastructure — dynamic IRQ registration, a DMA arena, PCI capabilities; PCI interrupts are level/active-low.
  • Network stack choice — don't write TCP; lwIP over FreeBSD over NetBSD, with the licence evidence.
  • e1000 and driver layout — the NIC driver, drivers/ split by device class, and virtio-gpu as the QEMU default.
  • virtio-gpu — the display class's second implementation; run with -vga std -device virtio-gpu-pci.
  • Device model — one bus-agnostic list at /proc/devices; bus is provenance, class is capability, and the settled Linux-driver decision.
  • usb.ids — shipped as /usr/share/usb.ids, BSD option of a dual licence; cached, not fetched per build.
  • USB and xHCI — enumeration and control transfers work; written from the spec, because porting BSD's stack means porting newbus first.
  • Licensing — Apache-2.0, copyright Nexoniarz; BSD drivers are usable and Linux ones are not.
  • Layout migration — the bt/ → ports/ + lib/ + cmd/ restructure and the two Makefile traps it exposed.
  • Verify by driving the shell — booting to a prompt proves nothing; run real commands over serial with paced input.
  • /dev and /proc — how both are built; ps and top work now, one cosmetic gap left.
  • TTY foreground pgrp coupling — TIOCGPGRP and getpgrp() must agree or the shell spins forever; how to spot that hang.
  • Sockets and evdev — AF_UNIX with one table lock, /dev/input/eventN, and why keycodes need a table for USB but not PS/2.
  • The removed acceptance test — deleted 2026-08-08 with its trademark references; what it found and the two techniques worth keeping.
  • Sharing preference — never push or publish; unfinished work stays local.
  • SMP userspace corruption — the intermittent rip 0x0 crash is SMP-only and still open; what is ruled out.