|
|
@@ -13,8 +13,8 @@ Targets i586 (first-gen Pentium); runs under QEMU or on real hardware.
|
|
|
| `kernel/` | The kernel, its drivers and services, `kernel.ld`, `ap_tramp.*`, `kexec_tramp.S`, `irqret.inc`; host tests `ccmp_test.c`, `touchpad_gesture_test.c` |
|
|
|
| `common/` | Freestanding code linked into both kernel and userland: `inflate.c/h`, `font_8x16.c/h` |
|
|
|
| `include/` | ABI headers shared by boot, kernel, userland and host tools: `syscall.h`, `wm_abi.h`, `version.h`, `bootinfo.h`, `phys.h`, `rootfs.h`, `wifi_cfg.h`, `rtl8821a_tbl.h` |
|
|
|
-| `user/` | `ucmd_lib.h` (the ring-3 syscall wrappers) and `ucmd.ld` |
|
|
|
-| `user/apps/<name>/` | One ring-3 program per directory: entry file `ucmd_<name>.c` plus private modules (`browser/` holds `browser.c`, `browser_html.c`, `js_*.c`, `svg_raster.c`; `chat/` holds `chat_login.c`; `gallery/` holds the real `gallery.c` behind the `ucmd_gallery.c` launcher; `hello/` has its own `hello.ld`) |
|
|
|
+| `user/` | `ucmd_lib.h` (the ring-3 syscall wrappers), `service_proto.h` (the init/service protocol and unit table) and `ucmd.ld` |
|
|
|
+| `user/apps/<name>/` | One ring-3 program per directory: entry file `ucmd_<name>.c` plus private modules (`browser/` holds `browser.c`, `browser_html.c`, `js_*.c`, `svg_raster.c`; `chat/` holds `chat_login.c`; `gallery/` holds the real `gallery.c` behind the `ucmd_gallery.c` launcher; `init/` is the PID-1 service manager; `service/` holds the CLI/GUI client and its shared `service_defs.c`/`service_proto.c`; `hello/` has its own `hello.ld`) |
|
|
|
| `user/lib/<lib>/` | Ring-3 libraries: `libc`, `ngui`, `ufont`, `img`, `tls` (crypto incl. `wpa_crypto.c`), `uhttp`, `ujson`, `uwm` (`uwm_lib.c`), `wifi` (`wifi_store.c`, `wpa.c`); host tests live next to their library |
|
|
|
| `tools/` | Host tools (`mkpack.c`, `mkrootfs.c`, `mkrtwtbl.c`, `mkcursors.c`, `mkicons.c`, `jsstrip.c`, `mkwoff.py`, `kexec_send.c`, `netkexec_send.c`, `netmonitor.c`, `flash.sh`, `xcursor_trim.py`), the QMP test scripts and `cursor_test.c` |
|
|
|
| `assets/` | Imported assets: `assets/cursors/adwaita/` (the Adwaita 24 px Xcursor files) and `assets/icons/adwaita/` (the Adwaita symbolic SVGs used as UI icons), both LGPL-3 / CC-BY-SA-3.0, with README and licences |
|
|
|
@@ -57,7 +57,7 @@ this file **and** the matching page:
|
|
|
| `docs/filesystems.html` | VFS/`fs_ops`, FAT, ramfs pack, `/share`, WebDAV |
|
|
|
| `docs/graphics.html` | VBE/shadow, damage, blit, WM, canvas ABI, ngui, images |
|
|
|
| `docs/network.html` | netdev, ARP/ICMP/UDP/DHCP/DNS, TCP, TLS, netconsole/netkexec |
|
|
|
-| `docs/userland.html` | Ring-3 model, ELF spawn, syscalls, shell/PATH, pack, apps |
|
|
|
+| `docs/userland.html` | Ring-3 model, ELF spawn and parent/detach, syscalls, init/services, shell/PATH, pack, apps |
|
|
|
| `docs/development.html` | Toolchain, make targets, hot reload, tests, debugging |
|
|
|
|
|
|
Rules:
|
|
|
@@ -130,7 +130,7 @@ make clean
|
|
|
- Build flags (in `Makefile`): `-m32 -march=i586 -ffreestanding -fno-pie -nostdlib
|
|
|
-fno-stack-protector -mno-sse -mno-sse2 -mno-mmx -O2`. The ring-3 WM and
|
|
|
viewer are per-object `-Os` with function sections, like the other size-
|
|
|
- sensitive GUIs, because the 2 MB gzip rootfs pack is close to its cap.
|
|
|
+ sensitive GUIs, to keep the gzip rootfs pack small (its cap is 4 MB).
|
|
|
- `make browser-host` is a development-only harness, not part of the images: it
|
|
|
builds `browser.c`, ngui, the image/TLS stack and QuickJS as a 32-bit Linux
|
|
|
program against the same `SYS_*` ABI (`host/syscall.c`, an SDL3 window,
|
|
|
@@ -154,9 +154,11 @@ make clean
|
|
|
`cmds-lite.pack` (everything but `firmware/*`, the cursor bundle,
|
|
|
`install/kernel.bin` and `bin/browser.app`), because the ~1 MB WiFi
|
|
|
firmware and the ~500 KB gzip browser do not fit a 1.44 MB floppy; a
|
|
|
- floppy boot runs the browser from `BROWSER` on `root.img`. The kernel itself no longer
|
|
|
- carries the pack; the boot path loads it into RAM and `ramfs_init` takes a
|
|
|
- private copy (`bin/<name>` mounted at `/ramfs`).
|
|
|
+ floppy boot runs the browser from `BROWSER` on `root.img`. `bin/init` and
|
|
|
+ `bin/service` are in **both** packs; the current lite gzip pack is ~682 KB
|
|
|
+ and the floppy image still has ~390 KB of internal padding. The kernel
|
|
|
+ itself no longer carries the pack; the boot path loads it into RAM and
|
|
|
+ `ramfs_init` takes a private copy (`bin/<name>` mounted at `/ramfs`).
|
|
|
- The WiFi firmware `firmware/iwlwifi-7265D-29.ucode` (Chromebook) and
|
|
|
`firmware/iwlwifi-6000-4.ucode` (ThinkPad X201) are decompressed from the
|
|
|
host's linux-firmware (`WIFI_FW_7265D` / `WIFI_FW_6000` override the
|
|
|
@@ -228,7 +230,8 @@ and `make net-dev`/`kernel-net-dev` reload over the network. `bootlog save
|
|
|
12-dword `struct boot_info` (magic/checksum/rsdp/flags/pack range) to
|
|
|
`0x500`, enters protected mode and jumps to `kernel_entry` (`entry.S`,
|
|
|
re-points ESP to the current stack top, then `kernel_main`). The pack
|
|
|
- never occupies the low gap, so the cap is `PACK_MAX` (2 MB) and the
|
|
|
+ never occupies the low gap, so the cap is `PACK_MAX` (4 MB, copied to
|
|
|
+ `0x900000..0xD00000`) and the
|
|
|
kernel BSS/boot stack may extend past `0x60000`. The stage prints
|
|
|
`Loading rootfs [d=<drive> lba=<hex> e=<0|1> m=<C|L>]...`, then a dot
|
|
|
after the header and one per 16 KB chunk, so a BIOS hang is localised.
|
|
|
@@ -237,8 +240,9 @@ and `make net-dev`/`kernel-net-dev` reload over the network. `bootlog save
|
|
|
3. `kernel.c` — `kernel_main` zeroes BSS then inits serial → memory/paging →
|
|
|
ACPI/MADT → I/O → power → idle → processes → timer (PIT; 1 kHz busy,
|
|
|
100 Hz idle + IDT) → SMP AP bring-up → PS/2 mouse (the I2C touchpad
|
|
|
- probe only on Airmont) → VGA shadow buffer → ramfs inflate → WM →
|
|
|
- publish `vfs_scan_busy` → `wm_server_boot_ready()` → wait (idle `hlt`,
|
|
|
+ probe only on Airmont) → VGA shadow buffer → ramfs inflate →
|
|
|
+ `wm_server_init()` → start `/ramfs/bin/init` as PID 1 → init spawns the
|
|
|
+ WM → publish `vfs_scan_busy` → `wm_server_boot_ready()` → wait (idle `hlt`,
|
|
|
1 s cap) until the first terminal has presented → USB bring-up and scan
|
|
|
(non-preemptible, as before the WM existed: reset/SOF timing) → NIC probe
|
|
|
→ kworker → the `bootscan` kernel thread (non-USB storage scan + FAT
|
|
|
@@ -252,7 +256,9 @@ and `make net-dev`/`kernel-net-dev` reload over the network. `bootlog save
|
|
|
first terminal presents (the bootscan window is not counted): the end
|
|
|
point of a boot-time measurement
|
|
|
(~0.5-0.6 s after the kernel starts on QEMU's USB image; the bootscan
|
|
|
- window is created first).
|
|
|
+ window is created first). The kernel never starts the WM: init is the
|
|
|
+ only creator, and `wm_server_attach` admits an init child named `wm`.
|
|
|
+ Without `/ramfs/bin/init` there is no WM; the boot console stays visible.
|
|
|
4. `mbr.S` — MBR (USB/HDD boot); loads the active partition's boot sector
|
|
|
(partition 1 at LBA 63).
|
|
|
5. **UEFI (`boot/efi/`)** — an x86-64 PE32+ `BOOTX64.EFI` loads from the ESP. It
|
|
|
@@ -293,7 +299,7 @@ a Pentium 1 (and a Pentium II board without ACPI) on the UP path.
|
|
|
| `0x60000` | No longer a rootfs staging area: the legacy stage copies each 16 KB chunk straight to `0x900000`. The kernel BSS/boot stack may use this range |
|
|
|
| `_end` | Kernel end (linker symbol; `kernel.ld` keeps `_end <= 0x90000` so the top of the low-memory gap and the EBDA stay untouched). BSS and the boot stack may extend past `0x60000` |
|
|
|
| (in-image) | Bootstrap/protected-mode stack: 8 KB `.stack` NOLOAD section, `__boot_stack_top`/`__boot_stack_bottom` (travels with the kernel) |
|
|
|
-| `0x900000`| Legacy boot-time rootfs pack written directly by `vesa_stage.S` (reserved by `mm_init` until `ramfs_init` takes its copy, then freed); `mm_init` places the frame bitmap in the first RAM after it (`0xAF3000` with today's pack); process stacks and kexec staging also start here |
|
|
|
+| `0x900000`| Legacy boot-time rootfs pack written directly by `vesa_stage.S` (reserved by `mm_init` until `ramfs_init` takes its copy, then freed); `mm_init` places the frame bitmap in the first RAM after it (`0xB08000` with today's ~2.13 MB pack, at most `0xD00000`; the `mm: bitmap ...` boot line reports the actual address); process stacks and kexec staging also start here |
|
|
|
| `0x100000`| VGA shadow buffer (`VGA_SHADOW_BASE`, `vga.h`) |
|
|
|
|
|
|
The legacy stage uses `0x3000..0x6FFF` as a 16 KB-chunk rootfs staging
|
|
|
@@ -348,12 +354,47 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
is the only global-tick source. APs do not start taking user work until
|
|
|
`smp_enable_sched()`, i.e. after device/FS setup. LAPIC IPIs (vector 0x31)
|
|
|
request a reschedule; they must be EOIed on the target LAPIC.
|
|
|
- `SYS_PROCINFO` exposes weight/state/CPU/ticks and the `kernel_thread` flag
|
|
|
- for the ring-3 `top` and `process` commands, and `sched`/`renice` plus
|
|
|
- `SYS_SCHEDINFO` expose the scheduler counters.
|
|
|
+ `SYS_PROCINFO` exposes pid/parent_pid, weight/state/CPU/ticks, pages and
|
|
|
+ the `kernel_thread` flag for the ring-3 `top` and `process` commands, and
|
|
|
+ `sched`/`renice` plus `SYS_SCHEDINFO` expose the scheduler counters.
|
|
|
Ring 0 is preemptible at tick boundaries unless `preempt_count` is set (FAT
|
|
|
and the shadow flush) or the BKL is held; voluntary blocks/yields go through
|
|
|
the `int 0x81` gate.
|
|
|
+ Every PCB carries `parent_pid` (0 = root). `process_exit()`,
|
|
|
+ `process_kill()` and the reaper kill the whole descendant subtree; a
|
|
|
+ child born while its parent dies is aborted. `SYS_SPAWN` has a flags word:
|
|
|
+ the default parents the child to the caller, `SYS_SPAWN_DETACH` attaches it
|
|
|
+ to the caller's parent (the terminal/WM session), or to 0 if that parent is
|
|
|
+ gone. `init` and kernel threads are roots; the WM and services are init's
|
|
|
+ children, the terminal/start-menu apps are the WM's, and terminal commands
|
|
|
+ are the terminal's. `SYS_SPAWN_KCMD` stays parented. The process monitor's
|
|
|
+ End task kills the subtree.
|
|
|
+- **Init and services**: `kernel/init.c/h` loads `/ramfs/bin/init` as PID 1
|
|
|
+ after `wm_server_init()` and before the WM. It records `init_pid` inside
|
|
|
+ `process_create_user_full()` before the process is runnable, refuses
|
|
|
+ `SYS_KILL(init)`, and the kworker restarts init if it dies. The ring-3
|
|
|
+ manager (`user/apps/init/ucmd_init.c`) is the only WM creator: it
|
|
|
+ `SYS_SPAWN`s `/ramfs/bin/wm`, monitors it, and respawns it after a crash.
|
|
|
+ It owns one private tty per running service, drains it to
|
|
|
+ `/share/svc-<name>.log` (32 KB), and writes `/share/svc-<name>.state`.
|
|
|
+ `/share/init.state` carries its pid/control tty/WM pid; `/share/init.log`
|
|
|
+ is its own log. `init` serves a small line protocol on a tty allocated
|
|
|
+ with `SYS_TTY_ALLOC`; the `service` CLI/GUI (`user/apps/service/`) sends
|
|
|
+ `NBI1 <seq> <op> <name> <resp_tty>` and reads the response tty. The
|
|
|
+ shared table/protocol lives in `user/service_proto.h`,
|
|
|
+ `user/apps/service/service_defs.c` and `service_proto.c`. Service starts,
|
|
|
+ stops, restarts and kills are init's state machine; a service that exits
|
|
|
+ unexpectedly is marked stopped (no v1 auto-restart), while the WM is
|
|
|
+ restart-on-death. On init restart it first kills every leftover ring-3
|
|
|
+ process (kernel threads stay), then starts the WM and the services whose
|
|
|
+ saved desired state is running. The control syscalls are
|
|
|
+ `SYS_TTY_ALLOC` (tty owned by the caller, no stdout rebind),
|
|
|
+ `SYS_TTY_WRITE` (non-blocking, no partial writes), `SYS_TTY_CLOSE` (owner)
|
|
|
+ and `SYS_IS_INIT`; `TTY_MAX` is 16. The first service is `websrv`
|
|
|
+ (`/ramfs/bin/websrv 8080`, autostart off: it owns the raw NIC receiver, so
|
|
|
+ stop it before browsing/`curl`/`net-dev`). `service logs init|websrv`,
|
|
|
+ `service logtail`, `service --gui` and `service status` are the user
|
|
|
+ tools; `bootscan` is a kernel thread/log viewer, not a service.
|
|
|
- **SMP / ACPI**: `acpi.c/h` (RSDP → RSDT/XSDT → MADT; CPU/LAPIC and IOAPIC
|
|
|
base lists; 4 MB table page mapping; the FADT PM1 control blocks, flags and
|
|
|
the DSDT (or SSDT) `\_S5` sleep types; malformed tables are ignored),
|
|
|
@@ -390,7 +431,10 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
(both hand the kernel the same ACPI tables); the Bochs/QEMU ports are
|
|
|
only the emulator fallback. If no path works the command returns instead
|
|
|
of halting: the WM shows `poweroff failed` and the FADT/S5/`SCI_EN` state
|
|
|
- is in the netlog.
|
|
|
+ is in the netlog. `acpi_reset()` caches and writes the ACPI 2.0
|
|
|
+ `RESET_REG`/`RESET_VALUE` pair (`RESET_REG_SUP`), and is what `reboot`
|
|
|
+ tries before the Intel PCH, keyboard-controller and triple-fault
|
|
|
+ fallbacks.
|
|
|
- **Memory**: `phys.h` — `MM_MAX_PHYS` (1 GB, the lowmem/identity-map
|
|
|
ceiling, also used by the UEFI loader for the pack buffer), `MM_KMAP_VA`
|
|
|
(`0x4FC00000`) and `MM_HIGH_LIMIT` (4 GB). Lowmem ends where ring-3 space
|
|
|
@@ -491,7 +535,13 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
`uwm_lib.c`). The kernel maps the shadow and each window's RGB565 front
|
|
|
canvas at `WM_CONTENT_VA_BASE`, routes input, owns the cursor, kexec
|
|
|
detection and the boot-console handoff. Every window is a canvas client;
|
|
|
- there is no in-kernel WM or terminal fallback. The WM paints the desktop,
|
|
|
+ there is no in-kernel WM or terminal fallback. Init is the only WM
|
|
|
+ creator (`SYS_SPAWN("/ramfs/bin/wm")`); the kernel never starts one.
|
|
|
+ `wm_server_attach` admits only a process named `wm` whose `parent_pid` is
|
|
|
+ the current init pid, cleans up a dead previous WM, maps the shadow and
|
|
|
+ disables the boot console. If init or `/ramfs/bin/wm` is absent the boot
|
|
|
+ console stays; there is no fallback. The WM watchdog still kills a wedged
|
|
|
+ WM (`wm_last_seen` > 15 s) and init respawns it. The WM paints the desktop,
|
|
|
spawns the `/ramfs/bin/bootscan` live-log window first and only then the
|
|
|
first terminal after `wm_server_boot_ready()`, so the terminal is the
|
|
|
newest window and keeps the keyboard focus on startup, and composites the
|
|
|
@@ -557,9 +607,9 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
first row is the dim `Applications` caption, `theme.panel_alt` hover rows
|
|
|
and a rounded Power tile. It lists every self-contained GUI app in the
|
|
|
pack -- Terminal, Files, Web, Gallery, Chat, Clock, Text editor, Colors,
|
|
|
- Mines, Cards, Disks, Tasks, Settings and Date & Time -- with a coloured
|
|
|
- letter tile and a hover highlight, shrinks its row height to fit short
|
|
|
- panels, and closes on an outside press. The last row, Power, opens a
|
|
|
+ Mines, Cards, Disks, Tasks, Services, Settings and Date & Time -- with a
|
|
|
+ coloured letter tile and a hover highlight, shrinks its row height to fit
|
|
|
+ short panels, and closes on an outside press. The last row, Power, opens a
|
|
|
submenu with Reboot and Power off; both spawn the privileged kernel
|
|
|
command through `SYS_SPAWN_KCMD` with no tty. The menu floats above every
|
|
|
window and is redrawn with the brightness OSD overlay. The bar notice and
|
|
|
@@ -604,8 +654,8 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
popover and then continues with the normal click handling; a second click
|
|
|
on the status cluster toggles it.
|
|
|
The start menu entries spawn the same pack binaries (`Chat` ->
|
|
|
- `/ramfs/bin/chat`, `Tasks` -> `/ramfs/bin/process`, `Disks` ->
|
|
|
- `/ramfs/bin/disks`, ...). When the full date/time would cross
|
|
|
+ `/ramfs/bin/chat`, `Tasks` -> `/ramfs/bin/process`, `Services` ->
|
|
|
+ `/ramfs/bin/service --gui`, `Disks` -> `/ramfs/bin/disks`, ...). When the full date/time would cross
|
|
|
`WM_BAR_LEFT_END`, the clock falls back to `MM-DD HH:MM` and is hidden if
|
|
|
even that does not fit.
|
|
|
`terminal.c` keeps the privileged kernel command
|
|
|
@@ -1568,9 +1618,18 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
ELF through the VFS and spawns it as a ring-3 process; `hello` is just
|
|
|
`bin/hello`. New command: create `user/apps/<name>/ucmd_<name>.c` and add
|
|
|
`<name>` to UCMDS — the pack, the mount and the PATH listing pick it up
|
|
|
- automatically (a command that links libraries also needs an `.elf` rule). `SYS_SPAWN` still
|
|
|
- loads ELFs from any VFS mount, so commands can also live on `/share` or a
|
|
|
- FAT disk (`path /share/bin`, or an absolute path). They talk to the kernel through
|
|
|
+ automatically (a command that links libraries also needs an `.elf` rule).
|
|
|
+ `init` and `service` are in both packs; `init` is PID 1 and refuses a
|
|
|
+ user-run start through `SYS_IS_INIT`.
|
|
|
+ `SYS_SPAWN` still loads ELFs from any VFS mount, so commands can also live
|
|
|
+ on `/share` or a FAT disk (`path /share/bin`, or an absolute path). Its
|
|
|
+ `struct sys_spawn` carries a flags word: default parented, or
|
|
|
+ `SYS_SPAWN_DETACH` to attach to the caller's parent (the session). There
|
|
|
+ is deliberately no old-ABI compatibility: the kernel, pack, `root.img`,
|
|
|
+ UEFI payload and host harness must be rebuilt together. The browser and
|
|
|
+ gallery launchers spawn the real app parented and wait for it, so a
|
|
|
+ terminal launch stays foreground and Ctrl-C/terminal close kills the app;
|
|
|
+ files/disks/chat and the WiFi helpers use detached spawns. They talk to the kernel through
|
|
|
`int 0x80` (`syscall.h`: putstr/ticks/sleep/exit, the whole-file service in
|
|
|
`sys_fs.c`, the state snapshots in `sys_info.c` and the network service in
|
|
|
`sys_net.c`) and inherit the terminal's screen, so their output lands in
|
|
|
@@ -1596,7 +1655,8 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
ELF ships in the pack as `bin/gallery.app`; `ucmd_gallery.c` is the tiny
|
|
|
`bin/gallery` launcher, which prefers `/share/GALLERY` (development upload
|
|
|
via `make gallery-dev`), then the pack copy, then the `GALLERY` disk
|
|
|
- fallback on `root.img`/FAT mounts.
|
|
|
+ fallback on `root.img`/FAT mounts. Like the browser launcher it spawns
|
|
|
+ the real app parented and waits for it.
|
|
|
- **Boot scan window**: `ucmd_bootscan.c` is the `bootscan` window, a live
|
|
|
tail of the `bootscan` kernel thread's own COM1 output. `boot_storage_main()`
|
|
|
calls `bootcon_scan_begin()`/`bootcon_scan_end()`; while active,
|
|
|
@@ -1621,12 +1681,15 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
histories of CPU busy (summed `SYS_SCHEDINFO` idle ticks over all CPUs),
|
|
|
physical memory in use (`SYS_MEMINFO`) and NIC throughput (the 32-bit frame
|
|
|
byte counters in `SYS_NET_INFO`). Three cards draw the graphs with ngui
|
|
|
- rectangles/lines; the process table below is sortable by PID, state, CPU,
|
|
|
- memory, time or name (click a header) and scrolls with PgUp/PgDn or the
|
|
|
- wheel.
|
|
|
- Selecting a row shows its details; `End task` asks for a second click, then
|
|
|
- calls `SYS_KILL`. Kernel threads and the monitor itself are protected
|
|
|
- (`sys_procinfo.kernel_thread`, `SYS_GETPID`). Esc closes the window.
|
|
|
+ rectangles/lines; the process table is a tree: children are indented under
|
|
|
+ their `parent_pid`, while each sibling group stays sortable by PID, state,
|
|
|
+ CPU, memory, time or name (click a header). PgUp/PgDn or the wheel
|
|
|
+ scrolls.
|
|
|
+ Selecting a row shows its pid/ppid and details; `End task` asks for a second
|
|
|
+ click, then
|
|
|
+ calls `SYS_KILL`, which also kills the process's descendants. Kernel
|
|
|
+ threads and the monitor itself are protected (`sys_procinfo.kernel_thread`,
|
|
|
+ `SYS_GETPID`); init is protected in the kernel. Esc closes the window.
|
|
|
- **Solitaire**: `ucmd_solitaire.c` — a Windows 95 style Klondike game on the
|
|
|
canvas service: green felt, a Game/Help menu (ngui buttons and menu items:
|
|
|
new game, draw one/three, blue or red deck), four foundations, seven tableau
|
|
|
@@ -1644,8 +1707,9 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
`ucmd_browser.c` is the tiny `bin/browser` launcher; it prefers
|
|
|
`/share/BROWSER` (`make browser-dev` uploads it via the board's `websrv`;
|
|
|
stop `websrv` before browsing HTTP, because it owns the NIC), then the pack
|
|
|
- copy, then `BROWSER` on `root.img`/IDE/SATA fat mounts. The launcher
|
|
|
- forwards its argument and cwd.
|
|
|
+ copy, then the disk fallback; it spawns the real app parented and waits for
|
|
|
+ it, so a terminal launch stays foreground and Ctrl-C/terminal close kills
|
|
|
+ the app. The launcher forwards its argument and cwd.
|
|
|
`uhttp.c/h` is the shared ring-3 HTTP client extracted from curl: URL
|
|
|
parsing/resolution (unsafe path bytes are percent-encoded; path
|
|
|
normalization stops at `?`/`#`), redirects, chunked decoding, timeouts
|
|
|
@@ -2114,8 +2178,11 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
scripted page and whenever the page width changes. A geometry read
|
|
|
after a DOM change (`offsetWidth`, `getBoundingClientRect`, ...) runs a
|
|
|
synchronous layout first (`js_force_layout()`: measure + render into the
|
|
|
- page back buffer, at most 40 ms per 100 ms), like a browser's forced
|
|
|
- reflow; `documentElement.clientWidth/Height` are the viewport.
|
|
|
+ page back buffer), like a browser's forced reflow. The guard is a count
|
|
|
+ (`FORCE_LAYOUT_PER_PASS`, 8 per main-loop pass), not a time budget: on
|
|
|
+ the ION one cloudron.io re-layout takes longer than any sensible budget,
|
|
|
+ and a refused reflow left Bootstrap placing its tooltip from stale boxes.
|
|
|
+ `documentElement.clientWidth/Height` are the viewport.
|
|
|
**Hover**: each frame the element under the pointer (`hover_target()`:
|
|
|
the innermost box, or the link/control hit inside it) is compared with
|
|
|
the last one, and `page_hover_events()` dispatches `mouseout`/
|
|
|
@@ -2128,7 +2195,33 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
An absolute/fixed box with an auto width and one horizontal offset is
|
|
|
shrink-to-fit, absolute/fixed children add nothing to a parent's
|
|
|
shrink-to-fit width and do not end a float row, and `<a href="">` is a
|
|
|
- link to the page itself. The logged-in
|
|
|
+ link to the page itself. A fixed box pinned by `top` and `bottom` with
|
|
|
+ an auto height spans the viewport between them (a modal backdrop).
|
|
|
+ **Opacity and transitions**: `opacity` is a 0..255 alpha
|
|
|
+ (`br_style.opacity`; `opacity_hidden` is alpha 0). A translucent
|
|
|
+ absolute/fixed box gets group opacity: the deferred painter saves the
|
|
|
+ page area (`alpha_begin()`), paints the box and blends it back over its
|
|
|
+ layout box (`alpha_end()`); in-flow elements still paint opaque.
|
|
|
+ `transition`/`transition-property|duration|timing-function` reduce to a
|
|
|
+ mask of opacity/transform, one duration and an easing (`tr_mask`,
|
|
|
+ `tr_ms`, `tr_ease`). The render pass remembers each element's last
|
|
|
+ target opacity and `translate()` offset (`pstate[]`; `translate()` takes
|
|
|
+ percentages of the own box, `tx_pct`/`ty_pct`); a changed target on an
|
|
|
+ element with a matching transition starts an animation from the value on
|
|
|
+ screen (`anim_value()`, up to 32 at once), the page re-renders every
|
|
|
+ pass while one runs, and `transitionend` is dispatched when it ends
|
|
|
+ (`anim_after_frame()`); animations of elements no longer painted are
|
|
|
+ dropped. The start value is whatever the previous paint saw, which is
|
|
|
+ why a forced reflow is a paint pass: Bootstrap reads `offsetWidth` after
|
|
|
+ showing the modal and before adding `.in`, so its backdrop fades in and
|
|
|
+ the dialog slides down. **Stacking for input**: each painted
|
|
|
+ absolute/fixed box with a background or a `z-index` (and without
|
|
|
+ `pointer-events: none`, parsed and inherited as `pe_none`) adds an
|
|
|
+ occluder hit below its own link hits (`hit_add_occluder()`): links
|
|
|
+ painted under it stop matching (`find_hit_ex()`), and the box search for
|
|
|
+ clicks/hover is limited to the covering box's subtree, so a click on a
|
|
|
+ modal's backdrop reaches `.modal` (Bootstrap closes it) instead of the
|
|
|
+ page behind. The logged-in
|
|
|
dashboard (sidebar with expandable groups, header, app grid, hash-routed
|
|
|
views) was verified in QEMU against a local stand-in that proxies the
|
|
|
public dashboard assets and mocks `/api/v1` and the OIDC endpoints. The
|
|
|
@@ -2360,7 +2453,7 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
`mkdir <path>`, `rmdir <path>`, `hello`, `acpidump` (writes the mapped
|
|
|
DSDT to `/share/DSDT.BIN`), `reboot`, `poweroff`,
|
|
|
`display`, `cpuinfo`, `mouseinfo`, `gfxbench`, `lsusb`, `touchpad [rightclick off|tap|corner|both] [tapclick on|off] [scroll on|off|natural|traditional]`, `lspci [id]`, `peek <addr> [len]`, `poke <addr> <val>`, `storage`, `disks` (the ngui storage manager), `meminfo`, `top`, `process` (the ngui task manager), `bootscan` (the live boot storage-scan window), `sched`, `format [-y] <device> [size]` (binary units, e.g. `format ide0 100mb` or `1gb`; no size formats the whole disk; `-y` skips the prompt), `install [-y] <target> [source|self]` (clone the live image, or write the running image; auto-detects the source, preferring `usb0`; `auto` targets the only non-USB NebOS disk),
|
|
|
-`ps`, `renice <pid> <weight>`, `kill <pid>`, `idle [auto|hlt|c1e|c3|c6]`, `power`, `powerinfo`, `cpufreq [auto|min|max|off|<pstate>]`, `spin [ms]`, `membench` (ring-3 speed check: TSC, ALU, heap/BSS memcpy, syscall rates), `backlight [0-100|up|down]` (also `probe`), `keytest` (raw scancode tap), `help`, `clear`, `serial test`, `kexec`, `dbg`, `view <file>` (image viewer; PNG, baseline/progressive JPEG, animated GIF, BMP, TGA, PNM, ICO, PAM), `browser [url|file]` (disk app launcher), and `chat [config-path]` (Cloudron Chat client).
|
|
|
+`ps`, `renice <pid> <weight>`, `kill <pid>`, `idle [auto|hlt|c1e|c3|c6]`, `power`, `powerinfo`, `cpufreq [auto|min|max|off|<pstate>]`, `spin [ms]`, `membench` (ring-3 speed check: TSC, ALU, heap/BSS memcpy, syscall rates), `backlight [0-100|up|down]` (also `probe`), `keytest` (raw scancode tap), `help`, `clear`, `serial test`, `kexec`, `dbg`, `service [list|status <name>|start|stop|restart|kill <name>|logs <name>|logtail <name>|--gui]` (init's client; `websrv` is the first service and holds the raw NIC receiver while running), `view <file>` (image viewer; PNG, baseline/progressive JPEG, animated GIF, BMP, TGA, PNM, ICO, PAM), `browser [url|file]` (disk app launcher; waits for the app so a terminal launch is foreground), and `chat [config-path]` (Cloudron Chat client).
|
|
|
|
|
|
Network: `netinfo`, `netrecv`, `netsend`, `netip [a.b.c.d]`, `dhcp` (re-run the
|
|
|
DHCP client), `netdev [name]` (kernel command: show the active NIC driver or
|
|
|
@@ -2445,8 +2538,9 @@ The commands live in `cmds.pack` (`bin/<name>` entries, built by `mkpack`),
|
|
|
compressed with `libdeflate-gzip -12` when it is installed (falling back to
|
|
|
`gzip -9`) to `cmds_pack_gz.bin` and wrapped by `mkrootfs` with a
|
|
|
one-sector `NBROOT1` header (magic, version, exact `pack_bytes`, checksum,
|
|
|
-gzip flag). The build rejects a pack above the `PACK_MAX` cap (2 MB,
|
|
|
-`CMDS_GZ_MAX` in the Makefile, `PACK_MAX` in `vesa_stage.S`);
|
|
|
+gzip flag). The build rejects a pack above the `PACK_MAX` cap (4 MB,
|
|
|
+`CMDS_GZ_MAX` in the Makefile, `PACK_MAX` in `vesa_stage.S`, the embedded
|
|
|
+cap in `boot/efi/main.c`; all three must match);
|
|
|
`libdeflate` buys several KB over `gzip -9` and is still preferred. The boot
|
|
|
path loads the gz pack into RAM — the legacy stage copies it directly to
|
|
|
`0x900000` with its protected-mode `rep movsb`, the UEFI loader into a
|
|
|
@@ -2454,7 +2548,10 @@ loader-data buffer below 512 MB, kexec via its staging buffer — and
|
|
|
`ramfs_init()`
|
|
|
inflates it into page-allocated memory and mounts it read-only at `/ramfs`.
|
|
|
The kernel image no longer contains it, so the pack no longer moves `_end`;
|
|
|
-the high-memory legacy path supports up to 2 MB (known issue 8). The UI
|
|
|
+the high-memory legacy path supports up to 4 MB (known issue 8). Hot
|
|
|
+reloads stage kernel + gzip pack, or a raw runtime pack (`cmds-dev`/
|
|
|
+`net-cmds`, up to the 8 MB ramfs cap), in one buffer of at most `KEXEC_MAX`
|
|
|
+(8 MB, `kexec.h`; `PAYLOAD_MAX` in `payload.c` and `netkexec_send.c` match). The UI
|
|
|
font subsets live in the pack under `fonts/`, the WiFi firmware under
|
|
|
`firmware/`, the mouse cursors at `cursors/adwaita24.cur` (full pack only),
|
|
|
the UI icons at `icons/adwaita16.icn` (both packs) and the flat kernel at `install/kernel.bin` (full pack only;
|
|
|
@@ -2919,6 +3016,15 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
grown (new cluster allocation for directories is not implemented).
|
|
|
- **Keep the memory map in sync** — hardcoded addresses appear in `.S`, `.c`, and
|
|
|
linker scripts; changing one without the others breaks boot/loading.
|
|
|
+- **Parent death is the default** — `parent_pid` is part of every PCB; exit,
|
|
|
+ kill and the reaper kill descendants. Spawn sites that must outlive their
|
|
|
+ launcher use `SYS_SPAWN_DETACH` (attach to the caller's parent/session).
|
|
|
+ Do not make a daemon a root process just because it is long-lived: put it
|
|
|
+ under init or detach it to the session. Kernel threads are roots.
|
|
|
+- **No syscall ABI compatibility for now** — `struct sys_spawn` grew a flags
|
|
|
+ word and `TTY_MAX`/the tty API changed. Rebuild the kernel, command pack,
|
|
|
+ `root.img`, UEFI payload and host harness together; an old rootfs or an
|
|
|
+ old command on `/share`/FAT is not expected to work.
|
|
|
- **Ring-3 data segments** — when an IRET returns to ring 3, the CPU nulls
|
|
|
DS/ES/FS/GS whose DPL is below CPL 3. Every stub that loads 0x10 to run
|
|
|
kernel code must therefore restore the user data selector (0x23) before
|
|
|
@@ -2962,19 +3068,21 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
load (the USB rootfs partition is 8 MB, so this only bites if the cap is
|
|
|
raised without a bigger partition). The legacy stage copies the
|
|
|
compressed pack directly to `0x900000` with a protected-mode
|
|
|
- `rep movsb`, so the cap is `PACK_MAX` 2 MB (raised from 1 MB for the WiFi
|
|
|
- firmware). The browser and
|
|
|
+ `rep movsb`, so the cap is `PACK_MAX` 4 MB (raised from 1 MB for the WiFi
|
|
|
+ firmware, then from 2 MB when the browser grew; it ends at `0xD00000`,
|
|
|
+ inside the 16 MB no-E820 fallback). A 4.15 MB pack was boot-tested on
|
|
|
+ the legacy and UEFI paths and over `net-dev`. The browser and
|
|
|
its ring-3 dependencies are compiled with function sections and linked
|
|
|
with `--gc-sections`; the current full pack with the UI fonts, both
|
|
|
WiFi firmwares (7265D 1,036,312 bytes, ~442 KiB gzip; 6000 454,608 bytes,
|
|
|
~204 KiB gzip), the RTL8821A firmware and tables (31,898 + 11,668
|
|
|
- bytes) and `install/kernel.bin` is ~2.00 MiB gzip (~4 KB under the
|
|
|
- cap), inflating to ~4.13 MB, which adds about
|
|
|
- half a second to the boot; the floppy lite pack is ~641 KiB gzip and
|
|
|
+ bytes) and `install/kernel.bin` is ~2.13 MiB gzip (~2 MB under the
|
|
|
+ cap), inflating to ~4.4 MB, which adds about
|
|
|
+ half a second to the boot; the floppy lite pack is ~682 KiB gzip and
|
|
|
deliberately omits the firmware, `install/kernel.bin` and the browser
|
|
|
(`BROWSER` on `root.img` is the floppy copy). `libdeflate-gzip -12` is still preferred. Over
|
|
|
- 115200 serial a raw `cmds-dev` pack (4.1 MiB) now takes about four
|
|
|
- minutes; use `net-cmds`.
|
|
|
+ 115200 serial a raw `cmds-dev` pack (4.3 MiB) now takes about four
|
|
|
+ minutes; use `net-cmds` (~45 s in QEMU).
|
|
|
9. SMP is **ACPI/MADT only**: no Intel MP-table fallback, so a Pentium II SMP
|
|
|
board that exposes only MP tables stays UP (deliberate; there is no test
|
|
|
hardware).
|
|
|
@@ -3044,8 +3152,9 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
8×16 boot-console font, the IOAPIC/AMD-thermal additions and the safe
|
|
|
AMD MTRR path, the 32x32 cursor save buffer and the mount-policy table)
|
|
|
~0x8bf20 once the frame bitmap moved out of BSS; with the ioremap
|
|
|
- window, the EHCI handoff fix and the boot-scan log ring it is ~0x8df80,
|
|
|
- ~8 KB below the `0x90000` wall, and the
|
|
|
+ window, the EHCI handoff fix, the boot-scan log ring, the init bootstrap,
|
|
|
+ parent-pid tree kill, the tty control syscalls and `TTY_MAX` 16 it is
|
|
|
+ ~0x8f260, ~3.4 KB below the `0x90000` wall, and the
|
|
|
remaining limit
|
|
|
is kernel code/buffers only.
|
|
|
|
|
|
@@ -3103,8 +3212,15 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
background layers, `background-attachment`, 3D/perspective transforms
|
|
|
and transformed text/descendants (`scale`/`rotate` paint the element box
|
|
|
and inline images; layout geometry is unchanged), border-radius clipping
|
|
|
- of descendant content, gradients/box-shadow/transitions (a gradient
|
|
|
+ of descendant content, gradients/box-shadow (a gradient
|
|
|
background falls back to its last solid colour), or CSS `color-mix`.
|
|
|
+ Transitions animate only `opacity` (painted only on absolute/fixed
|
|
|
+ boxes; in-flow translucency paints opaque) and `translate()`; colours,
|
|
|
+ sizes, `scale`/`rotate`, `@keyframes` animations, per-property
|
|
|
+ durations/delays in one `transition` list and `transitioncancel`/
|
|
|
+ `transitionstart` are not supported, and every animation frame is a
|
|
|
+ full page re-render (~25 ms on the host, several times that on the
|
|
|
+ ION, so slides are choppy there).
|
|
|
A non-uniform `background-size` uses the width scale for both axes.
|
|
|
CSS custom properties (`var()`: one document-wide table, expanded when
|
|
|
a sheet is parsed; definitions on `:root`/`html`/`body`/`*`/`:host`
|
|
|
@@ -3226,11 +3342,13 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
OVMF delivers the ISA IRQs through the 8259 path; the kernel nevertheless
|
|
|
masks the IOAPIC's normal redirection entries after ACPI init, so
|
|
|
firmware-left vectors cannot collide with the PIC or LAPIC timer.
|
|
|
- UEFI runtime services are not used: `reboot` still pulses the keyboard
|
|
|
- controller and `poweroff` uses ACPI S5 (the FADT PM1a/PM1b control blocks
|
|
|
- and the DSDT `\_S5` sleep type, enabling ACPI through the SMI command
|
|
|
- when `SCI_EN` is clear) on both BIOS and UEFI boots, with the
|
|
|
- Bochs/QEMU ports as an emulator fallback. The image is 17 MB: the
|
|
|
+ UEFI runtime services are not used: `reboot` writes the ACPI 2.0
|
|
|
+ `RESET_REG`/`RESET_VALUE` when `RESET_REG_SUP` is set, then falls back
|
|
|
+ to the Intel PCH 0xCF9, the keyboard controller and a triple fault;
|
|
|
+ `poweroff` uses ACPI S5 (the FADT PM1a/PM1b control blocks and the DSDT
|
|
|
+ `\_S5` sleep type, enabling ACPI through the SMI command when `SCI_EN`
|
|
|
+ is clear) on both BIOS and UEFI boots, with the Bochs/QEMU ports as an
|
|
|
+ emulator fallback. The image is 17 MB: the
|
|
|
9 MB kernel + rootfs disk and the 8 MB ESP. Maxwell GPUs such as the
|
|
|
GTX 960 use the firmware VBE/GOP framebuffer only; there is no native
|
|
|
NVIDIA driver, and `nv50_probe()` is gated to the ION/nv50 chipsets.
|
|
|
@@ -3484,8 +3602,8 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
for every spinner frame; both paths were written from the Linux
|
|
|
drivers and only Cirrus and the software cursor are tested in QEMU.
|
|
|
The cursor shape follows the WM poll, so it can lag the pointer by
|
|
|
- one WM loop. The 4 KB save buffer and the cursor code (~8 KB in all) are included in
|
|
|
- `_end` ~0x8df80, ~8 KB below the `0x90000` wall.
|
|
|
+ one WM loop. The 4 KB save buffer and the cursor code are included in
|
|
|
+ `_end` (see item 21).
|
|
|
|
|
|
40. Wallpaper limits: one screen-aspect image pre-scaled to at most
|
|
|
1440x810 (cropped to cover, no crop/position choice), no slideshow and
|
|
|
@@ -3496,3 +3614,29 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
`/share/wallpaper` otherwise. The WM keeps a 2.4 MB static copy plus a
|
|
|
256 KB RGB565->BGRA table (16/24 bpp convert per pixel), all inside the
|
|
|
4 MB user image window, and has no image decoder of its own.
|
|
|
+
|
|
|
+41. Init/service limits: the service table is static (`service_defs.c`), with
|
|
|
+ no enable/disable persistence, dependencies, targets, one-shot services,
|
|
|
+ timers or failed-service auto-restart (the WM is the only always-restart
|
|
|
+ unit). `stop` and `kill` both terminate the process: there are no
|
|
|
+ signals or graceful shutdown hooks; `kill` is the forced variant and
|
|
|
+ init drains/closes the log tty when it observes the exit.
|
|
|
+ Logs and state are RAM-only `/share` files (32 KB per service), so they
|
|
|
+ vanish across reboot/kexec. An init crash intentionally resets the
|
|
|
+ whole ring-3 tree (WM, terminals, apps and detached helpers); kernel
|
|
|
+ threads survive. Detached spawns outlive their launcher but not init.
|
|
|
+ The control protocol is a trusted single-user tty channel with no
|
|
|
+ authentication. `TTY_MAX` is 16, so a browser with four helpers plus
|
|
|
+ several services can exhaust tty slots. `websrv` holds the raw NIC
|
|
|
+ receiver while running: stop it before browser `curl`/`net-dev`, and a
|
|
|
+ second network owner fails with "network busy". `disks` format/install
|
|
|
+ kernel commands are parented: closing the Disks window aborts them, and
|
|
|
+ a mid-write install can leave P1/P2 intermediate (the MBR is written
|
|
|
+ last). There is no old `SYS_SPAWN` ABI compatibility: kernel, pack,
|
|
|
+ `root.img`, UEFI payload and host harness must be rebuilt together, and
|
|
|
+ `make kernel-dev` with an old rootfs is unsupported (the new kernel also
|
|
|
+ needs `/ramfs/bin/init` for a WM). `bootscan` is not a service; it is a
|
|
|
+ kernel thread plus the log viewer. The display server remains in the
|
|
|
+ kernel (window/canvas bookkeeping, input routing and shadow); a full
|
|
|
+ userland display service would need a generic framebuffer/shared-memory
|
|
|
+ and input API and is not part of this change.
|