Parcourir la source

Split the tree into boot/, kernel/ and user/ directories

Move the flat repository root into:

  boot/            boot sector, MBR, VESA stage, boot/efi/ UEFI loader
  kernel/          the kernel, drivers, services and kernel.ld
  common/          inflate and the 8x16 font, linked into kernel and userland
  include/         ABI headers shared by boot, kernel, userland and tools
  user/apps/<n>/   one directory per ring-3 program (ucmd_<n>.c + modules)
  user/lib/<l>/    libc, ngui, ufont, img, tls, uhttp, ujson, uwm, wifi
  tools/           host tools (mkpack, mkrootfs, kexec_send, flash.sh, ...)

The top-level Makefile still builds everything with the same targets.
Objects go to build/ with compiler-generated header dependencies; the
images and workflow artifacts (kernel.elf, kernel.bin, floppy.img, usb.img,
usb-efi.img, BOOTX64.EFI, cmds.pack, browser.elf, ...) stay at the top.
Per-object flags are target-specific variables, and the kernel link order
is kept explicit in KERNEL_LINK_ORDER.

A clean build is byte-identical to the previous tree for kernel.bin,
boot.bin, mbr.bin, the floppy/USB images, both packs, the rootfs images,
browser.elf, gallery.elf and BOOTX64.EFI.  AGENTS.md gains a source-tree
section and the docs' source maps use the new paths.
Johannes Zellner il y a 5 jours
Parent
commit
346fd927bf
100 fichiers modifiés avec 561 ajouts et 861 suppressions
  1. 5 7
      .gitignore
  2. 46 15
      AGENTS.md
  3. 297 683
      Makefile
  4. 0 0
      boot/boot.S
  5. 0 0
      boot/efi/efi.h
  6. 0 0
      boot/efi/main.c
  7. 1 1
      boot/efi/payload.S
  8. 0 0
      boot/efi/tramp.S
  9. 0 0
      boot/efi/tramp.ld
  10. 0 0
      boot/linker.ld
  11. 0 0
      boot/mbr.S
  12. 0 0
      boot/mbr.ld
  13. 0 0
      boot/vesa_stage.S
  14. 0 0
      common/font_8x16.c
  15. 0 0
      common/font_8x16.h
  16. 0 0
      common/inflate.c
  17. 0 0
      common/inflate.h
  18. 15 15
      docs/boot.html
  19. 9 9
      docs/cpu.html
  20. 64 18
      docs/development.html
  21. 28 28
      docs/drivers.html
  22. 14 13
      docs/filesystems.html
  23. 18 18
      docs/graphics.html
  24. 18 9
      docs/index.html
  25. 11 11
      docs/memory.html
  26. 15 15
      docs/network.html
  27. 20 19
      docs/userland.html
  28. 0 0
      include/bootinfo.h
  29. 0 0
      include/phys.h
  30. 0 0
      include/rootfs.h
  31. 0 0
      include/rtl8821a_tbl.h
  32. 0 0
      include/syscall.h
  33. 0 0
      include/version.h
  34. 0 0
      include/wifi_cfg.h
  35. 0 0
      include/wm_abi.h
  36. 0 0
      kernel/acpi.c
  37. 0 0
      kernel/acpi.h
  38. 0 0
      kernel/ahci.c
  39. 0 0
      kernel/ahci.h
  40. 0 0
      kernel/ap_tramp.S
  41. 0 0
      kernel/ap_tramp.ld
  42. 0 0
      kernel/asix.c
  43. 0 0
      kernel/asix.h
  44. 0 0
      kernel/ata.c
  45. 0 0
      kernel/ata.h
  46. 0 0
      kernel/ati.c
  47. 0 0
      kernel/ati.h
  48. 0 0
      kernel/backlight.c
  49. 0 0
      kernel/backlight.h
  50. 0 0
      kernel/blit.c
  51. 0 0
      kernel/blit.h
  52. 0 0
      kernel/blkdev.c
  53. 0 0
      kernel/blkdev.h
  54. 0 0
      kernel/bootcon.c
  55. 0 0
      kernel/bootcon.h
  56. 0 0
      kernel/ccmp.c
  57. 0 0
      kernel/ccmp.h
  58. 0 0
      kernel/ccmp_test.c
  59. 0 0
      kernel/cirrus.c
  60. 0 0
      kernel/cirrus.h
  61. 0 0
      kernel/cpu.c
  62. 0 0
      kernel/cpu.h
  63. 0 0
      kernel/cros_ec.c
  64. 0 0
      kernel/cros_ec.h
  65. 0 0
      kernel/cursor_shape.h
  66. 0 0
      kernel/dbg.c
  67. 0 0
      kernel/dbg.h
  68. 0 0
      kernel/dhcp.c
  69. 0 0
      kernel/dhcp.h
  70. 0 0
      kernel/disk.c
  71. 0 0
      kernel/disk.h
  72. 0 0
      kernel/display.c
  73. 0 0
      kernel/dns.c
  74. 0 0
      kernel/dns.h
  75. 0 0
      kernel/e1000e.c
  76. 0 0
      kernel/e1000e.h
  77. 0 0
      kernel/ec.c
  78. 0 0
      kernel/ec.h
  79. 0 0
      kernel/ehci.c
  80. 0 0
      kernel/ehci.h
  81. 0 0
      kernel/elf.c
  82. 0 0
      kernel/elf.h
  83. 0 0
      kernel/entry.S
  84. 0 0
      kernel/fat.c
  85. 0 0
      kernel/fat.h
  86. 0 0
      kernel/fatdetect.c
  87. 0 0
      kernel/fatdetect.h
  88. 0 0
      kernel/fatformat.c
  89. 0 0
      kernel/fatformat.h
  90. 0 0
      kernel/fbtext.c
  91. 0 0
      kernel/fbtext.h
  92. 0 0
      kernel/font_8x8.c
  93. 0 0
      kernel/font_8x8.h
  94. 0 0
      kernel/format.c
  95. 0 0
      kernel/gfx.c
  96. 0 0
      kernel/gfx.h
  97. 0 0
      kernel/gfxbench.c
  98. 0 0
      kernel/gpu.c
  99. 0 0
      kernel/gpu.h
  100. 0 0
      kernel/i2c.c

+ 5 - 7
.gitignore

@@ -1,39 +1,37 @@
+build/
 *.o
 *.o
+*.d
 *.bin
 *.bin
 *.elf
 *.elf
 *.img
 *.img
 *.pack
 *.pack
 BOOTX64.EFI
 BOOTX64.EFI
-efi/efi_entry.h
 kexec_send
 kexec_send
 netkexec_send
 netkexec_send
 netmonitor
 netmonitor
 mkpack
 mkpack
+mkrootfs
+mkrtwtbl
 tls_test
 tls_test
 img_test
 img_test
 img_test_asan
 img_test_asan
-text_canvas_test
 ufont_test
 ufont_test
 ufont_test_asan
 ufont_test_asan
 touchpad_gesture_test
 touchpad_gesture_test
 svg_test
 svg_test
-libc.a
 malloc_test
 malloc_test
 format_test
 format_test
 math_test
 math_test
 div64_test
 div64_test
 setjmp_test
 setjmp_test
 js_test
 js_test
-third_party/quickjs/*.o
-js_mu.o
-mkrootfs
-mkrtwtbl
 ujson_test
 ujson_test
 uhttp_cookie_test
 uhttp_cookie_test
 chat_login_test
 chat_login_test
 chat-test-out/
 chat-test-out/
 wpa_test
 wpa_test
 wifi_store_test
 wifi_store_test
+ccmp_test
 host/build/
 host/build/
 browser-host
 browser-host
 host-curl
 host-curl

+ 46 - 15
AGENTS.md

@@ -5,6 +5,36 @@ x86 assembly. Single-author project (~7,000 SLOC, no external runtime; the
 kernel has no libc, while ring-3 commands may link the in-tree `libc.a`).
 kernel has no libc, while ring-3 commands may link the in-tree `libc.a`).
 Targets i586 (first-gen Pentium); runs under QEMU or on real hardware.
 Targets i586 (first-gen Pentium); runs under QEMU or on real hardware.
 
 
+## Source tree
+
+| Directory | Contents |
+|-----------|----------|
+| `boot/` | `boot.S` (boot sector, `linker.ld`), `mbr.S`/`mbr.ld`, `vesa_stage.S` (linked first into `kernel.elf`), `boot/efi/` (UEFI loader) |
+| `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/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`, `kexec_send.c`, `netkexec_send.c`, `netmonitor.c`, `flash.sh`) and the QMP test scripts |
+| `host/` | Linux SDL3 browser harness |
+
+The top-level `Makefile` builds everything.  Objects go to `build/`
+(mirroring the source paths, with `-MMD` header dependencies); the images and
+the files the workflows use (`kernel.elf`, `kernel.bin`, `boot.bin`,
+`mbr.bin`, `floppy.img`, `usb.img`, `usb-efi.img`, `BOOTX64.EFI`, `cmds.pack`,
+`cmds_pack_gz.bin`, `rootfs*.bin`, `cmds.img`, `root.img`, `browser.elf`,
+`gallery.elf`, the host tools and test binaries) stay at the top level.
+Include paths: the kernel sees `include/`, `common/`, `kernel/`; ring-3 code
+sees `include/`, `common/`, `user/` and every `user/lib/*` (plus the libc
+headers unless an object clears `XFLAGS`).  The kernel never includes a
+userland header; `user/apps/term/ucmd_term.c` is the one ring-3 file that
+uses kernel headers (`IO_KEY_*`, `VFS_PATH_MAX`) and gets `-Ikernel`.
+Per-object flags (`OPT`, `XFLAGS`) are target-specific variables on the
+`.o`; make does not track flag changes, so delete the object (or
+`make clean`) after editing one.  The kernel link order is
+`KERNEL_LINK_ORDER` and is part of the image layout.
+
 ## Documentation site (`docs/`)
 ## Documentation site (`docs/`)
 
 
 `docs/` is the static architecture site: hand-written HTML5, one shared
 `docs/` is the static architecture site: hand-written HTML5, one shared
@@ -211,7 +241,7 @@ and `make net-dev`/`kernel-net-dev` reload over the network.  `bootlog save
    (~0.35-0.4 s after the kernel starts on QEMU's USB image).
    (~0.35-0.4 s after the kernel starts on QEMU's USB image).
 4. `mbr.S` — MBR (USB/HDD boot); loads the active partition's boot sector
 4. `mbr.S` — MBR (USB/HDD boot); loads the active partition's boot sector
    (partition 1 at LBA 63).
    (partition 1 at LBA 63).
-5. **UEFI (`efi/`)** — an x86-64 PE32+ `BOOTX64.EFI` loads from the ESP. It
+5. **UEFI (`boot/efi/`)** — an x86-64 PE32+ `BOOTX64.EFI` loads from the ESP. It
    picks a GOP mode, converts `GetMemoryMap` into the E820 map at `0x1000`,
    picks a GOP mode, converts `GetMemoryMap` into the E820 map at `0x1000`,
    stages `kernel.bin` below 4 GB, allocates a loader-data buffer below the
    stages `kernel.bin` below 4 GB, allocates a loader-data buffer below the
    512 MB identity window (above the low 1 MB) for the embedded gz rootfs
    512 MB identity window (above the low 1 MB) for the embedded gz rootfs
@@ -324,7 +354,7 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
   Process stacks (≥ `0x900000`) come from the frame allocator, with an 8-stack
   Process stacks (≥ `0x900000`) come from the frame allocator, with an 8-stack
   fallback pool (a static BSS array; no fixed address).
   fallback pool (a static BSS array; no fixed address).
 - **UEFI boot**: `bootinfo.h` (the `0x500` block and its checksum/accessors),
 - **UEFI boot**: `bootinfo.h` (the `0x500` block and its checksum/accessors),
-  `efi/efi.h` (minimal UEFI types and table/protocol layouts), `efi/main.c`
+  `boot/efi/efi.h` (minimal UEFI types and table/protocol layouts), `boot/efi/main.c`
   (GOP mode choice, `GetMemoryMap` → E820, kernel staging below 4 GB and
   (GOP mode choice, `GetMemoryMap` → E820, kernel staging below 4 GB and
   rootfs pack in loader-data pages below 512 MB, boot-info/framebuffer
   rootfs pack in loader-data pages below 512 MB, boot-info/framebuffer
   blocks, `ExitBootServices`).  The loader prefers the raw installed image:
   blocks, `ExitBootServices`).  The loader prefers the raw installed image:
@@ -333,9 +363,9 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
   the kernel from P1 and the NBROOT1 gzip pack from P2.  The kernel and pack
   the kernel from P1 and the NBROOT1 gzip pack from P2.  The kernel and pack
   embedded in `BOOTX64.EFI` are only a fallback when the disk image is
   embedded in `BOOTX64.EFI` are only a fallback when the disk image is
   missing or invalid, so `install`/`net-install` update both boot paths
   missing or invalid, so `install`/`net-install` update both boot paths
-  without rewriting the ESP.  `efi/tramp.S` +
-  `efi/tramp.ld` (the `0x800` long-mode exit, kernel copy and jump) and
-  `efi/payload.S` (embeds `kernel.bin`, `cmds_pack_gz.bin` and the trampoline
+  without rewriting the ESP.  `boot/efi/tramp.S` +
+  `boot/efi/tramp.ld` (the `0x800` long-mode exit, kernel copy and jump) and
+  `boot/efi/payload.S` (embeds `kernel.bin`, `cmds_pack_gz.bin` and the trampoline
   in `BOOTX64.EFI`).  The legacy `vesa_stage.S` writes the same v2 boot info
   in `BOOTX64.EFI`).  The legacy `vesa_stage.S` writes the same v2 boot info
   (with `pack_addr`/`pack_size`); `vga.c`/`panic.c` honour the RGBX flag and
   (with `pack_addr`/`pack_size`); `vga.c`/`panic.c` honour the RGBX flag and
   skip the VBE-only ATI CRTC reset / NVIDIA stolen-VRAM alias under EFI;
   skip the VBE-only ATI CRTC reset / NVIDIA stolen-VRAM alias under EFI;
@@ -1176,16 +1206,16 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
   zeroed but pages appended by `SYS_MEM_GROW` are not (decoders initialize
   zeroed but pages appended by `SYS_MEM_GROW` are not (decoders initialize
   what they use), which keeps large image arenas fast to map.  The reaper
   what they use), which keeps large image arenas fast to map.  The reaper
   frees it with the rest of the process and `top` counts its pages.  Ring-3
   frees it with the rest of the process and `top` counts its pages.  Ring-3
-  commands use `libc/malloc.c` (malloc/free/heap_reset), which owns this
-  arena; the `SYS_MEM_*` calls are the libc backend (`libc/ucmd_mem.c`) and
+  commands use `user/lib/libc/malloc.c` (malloc/free/heap_reset), which owns this
+  arena; the `SYS_MEM_*` calls are the libc backend (`user/lib/libc/ucmd_mem.c`) and
   are not called by application code.  The canvas mapping at
   are not called by application code.  The canvas mapping at
   `USER_GFX_BASE` (`0x50000000`) and the WM mappings are separate.
   `USER_GFX_BASE` (`0x50000000`) and the WM mappings are separate.
-- **Ring-3 libc**: `libc/include/` (stddef/stdint/stdarg/stdlib/string/ctype/
+- **Ring-3 libc**: `user/lib/libc/include/` (stddef/stdint/stdarg/stdlib/string/ctype/
   assert/ucmd_heap, setjmp/errno/stdio/math/time/sys/time/sys/types, float/
   assert/ucmd_heap, setjmp/errno/stdio/math/time/sys/time/sys/types, float/
-  limits/inttypes/alloca), `libc/malloc.c`, `libc/string.c`, `libc/strdup.c`,
-  `libc/stdlib.c`, `libc/ucmd_mem.c`, `libc/setjmp.S`, `libc/errno.c`,
-  `libc/div64.c`, `libc/dtoa.c`, `libc/stdio.c`, `libc/stdio_file.c`,
-  `libc/math.c`, `libc/time.c`, linked as `libc.a` only into commands that
+  limits/inttypes/alloca), `user/lib/libc/malloc.c`, `user/lib/libc/string.c`, `user/lib/libc/strdup.c`,
+  `user/lib/libc/stdlib.c`, `user/lib/libc/ucmd_mem.c`, `user/lib/libc/setjmp.S`, `user/lib/libc/errno.c`,
+  `user/lib/libc/div64.c`, `user/lib/libc/dtoa.c`, `user/lib/libc/stdio.c`, `user/lib/libc/stdio_file.c`,
+  `user/lib/libc/math.c`, `user/lib/libc/time.c`, linked as `libc.a` only into commands that
   reference it.  `malloc` is a boundary-tag first-fit allocator with
   reference it.  `malloc` is a boundary-tag first-fit allocator with
   immediate coalescing: 16-byte aligned, `calloc` zeroes, `realloc` grows in
   immediate coalescing: 16-byte aligned, `calloc` zeroes, `realloc` grows in
   place when the next block is free, and the heap maps 64 KB lazily then
   place when the next block is free, and the heap maps 64 KB lazily then
@@ -1215,8 +1245,9 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
   `/ramfs`.  The
   `/ramfs`.  The
   shell finds them through PATH (`/ramfs/bin` by default), loads the whole
   shell finds them through PATH (`/ramfs/bin` by default), loads the whole
   ELF through the VFS and spawns it as a ring-3 process; `hello` is just
   ELF through the VFS and spawns it as a ring-3 process; `hello` is just
-  `bin/hello`.  New command: add `ucmd_<name>.c` to UCMDS — the pack, the
-  mount and the PATH listing pick it up automatically.  `SYS_SPAWN` still
+  `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
   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
   FAT disk (`path /share/bin`, or an absolute path).  They talk to the kernel through
   `int 0x80` (`syscall.h`: putstr/ticks/sleep/exit, the whole-file service in
   `int 0x80` (`syscall.h`: putstr/ticks/sleep/exit, the whole-file service in
@@ -2578,7 +2609,7 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
 
 
 27. Ring-3 stdio/time/math limits: `FILE` is read-only and whole-file
 27. Ring-3 stdio/time/math limits: `FILE` is read-only and whole-file
     (4 MB cap); there is no `open/read/write/lseek`/fd layer yet, and
     (4 MB cap); there is no `open/read/write/lseek`/fd layer yet, and
-    `stdin` is EOF.  The TODO is in `libc/stdio_file.c`; writable files and
+    `stdin` is EOF.  The TODO is in `user/lib/libc/stdio_file.c`; writable files and
     streaming need kernel `SYS_OPEN/READ/WRITE/LSEEK/CLOSE` plus offset
     streaming need kernel `SYS_OPEN/READ/WRITE/LSEEK/CLOSE` plus offset
     `fs_ops`.  `time` is UTC-only, `time_t` is 64-bit, and the RTC range is
     `fs_ops`.  `time` is UTC-only, `time_t` is 64-bit, and the RTC range is
     1970-2069; there is no timezone database.  `math` is an x87
     1970-2069; there is no timezone database.  `math` is an x87

Fichier diff supprimé car celui-ci est trop grand
+ 297 - 683
Makefile


+ 0 - 0
boot.S → boot/boot.S


+ 0 - 0
efi/efi.h → boot/efi/efi.h


+ 0 - 0
efi/main.c → boot/efi/main.c


+ 1 - 1
efi/payload.S → boot/efi/payload.S

@@ -20,5 +20,5 @@ pack_image_end:
 .globl tramp_blob_start
 .globl tramp_blob_start
 .globl tramp_blob_end
 .globl tramp_blob_end
 tramp_blob_start:
 tramp_blob_start:
-.incbin "efi/tramp.bin"
+.incbin "tramp.bin"
 tramp_blob_end:
 tramp_blob_end:

+ 0 - 0
efi/tramp.S → boot/efi/tramp.S


+ 0 - 0
efi/tramp.ld → boot/efi/tramp.ld


+ 0 - 0
linker.ld → boot/linker.ld


+ 0 - 0
mbr.S → boot/mbr.S


+ 0 - 0
mbr.ld → boot/mbr.ld


+ 0 - 0
vesa_stage.S → boot/vesa_stage.S


+ 0 - 0
font_8x16.c → common/font_8x16.c


+ 0 - 0
font_8x16.h → common/font_8x16.h


+ 0 - 0
inflate.c → common/inflate.c


+ 0 - 0
inflate.h → common/inflate.h


+ 15 - 15
docs/boot.html

@@ -452,21 +452,21 @@
 	<section id="sources">
 	<section id="sources">
 		<h2>Source map</h2>
 		<h2>Source map</h2>
 		<ul class="filelist">
 		<ul class="filelist">
-			<li><code>boot.S</code> — boot sector</li>
-			<li><code>mbr.S</code> — USB/HDD MBR</li>
-			<li><code>vesa_stage.S</code> — real-mode VESA stage</li>
-			<li><code>entry.S</code> — canonical kernel entry</li>
-			<li><code>bootinfo.h</code> — 0x500 block</li>
-			<li><code>vga.h</code> — 0x600 framebuffer block</li>
-			<li><code>efi/main.c</code> — UEFI loader</li>
-			<li><code>efi/tramp.S</code> — long-mode exit</li>
-			<li><code>kexec.c</code>, <code>kexec_tramp.S</code> — serial reload</li>
-			<li><code>netkexec.c</code> — network reload</li>
-			<li><code>kernel.c</code> — init order</li>
-			<li><code>bootcon.c</code>, <code>font_8x16.c</code> — direct-to-LFB boot console</li>
-			<li><code>install.c</code>, <code>install.h</code> — clone, self-update and net-install writer</li>
-			<li><code>rootfs.h</code> — installed image geometry</li>
-			<li><code>kernel.ld</code> — image limits</li>
+			<li><code>boot/boot.S</code> — boot sector</li>
+			<li><code>boot/mbr.S</code> — USB/HDD MBR</li>
+			<li><code>boot/vesa_stage.S</code> — real-mode VESA stage</li>
+			<li><code>kernel/entry.S</code> — canonical kernel entry</li>
+			<li><code>include/bootinfo.h</code> — 0x500 block</li>
+			<li><code>kernel/vga.h</code> — 0x600 framebuffer block</li>
+			<li><code>boot/efi/main.c</code> — UEFI loader</li>
+			<li><code>boot/efi/tramp.S</code> — long-mode exit</li>
+			<li><code>kernel/kexec.c</code>, <code>kernel/kexec_tramp.S</code> — serial reload</li>
+			<li><code>kernel/netkexec.c</code> — network reload</li>
+			<li><code>kernel/kernel.c</code> — init order</li>
+			<li><code>kernel/bootcon.c</code>, <code>common/font_8x16.c</code> — direct-to-LFB boot console</li>
+			<li><code>kernel/install.c</code>, <code>kernel/install.h</code> — clone, self-update and net-install writer</li>
+			<li><code>include/rootfs.h</code> — installed image geometry</li>
+			<li><code>kernel/kernel.ld</code> — image limits</li>
 			<li><code>Makefile</code> — image sizes and layout rules</li>
 			<li><code>Makefile</code> — image sizes and layout rules</li>
 		</ul>
 		</ul>
 	</section>
 	</section>

+ 9 - 9
docs/cpu.html

@@ -364,15 +364,15 @@
 	<section id="sources">
 	<section id="sources">
 		<h2>Source map</h2>
 		<h2>Source map</h2>
 		<ul class="filelist">
 		<ul class="filelist">
-			<li><code>sched.c</code>, <code>sched.h</code> — scheduler core and BKL</li>
-			<li><code>process.c</code>, <code>process.h</code> — PCBs and lifecycle</li>
-			<li><code>switch.S</code> — context switch</li>
-			<li><code>tss.c</code>, <code>tss.h</code> — per-CPU TSS</li>
-			<li><code>acpi.c</code>, <code>ioapic.c</code>, <code>lapic.c</code>, <code>smp.c</code> — SMP and IOAPIC masking</li>
-			<li><code>ap_tramp.S</code> — AP startup blob</li>
-			<li><code>timer.S</code>, <code>idle.c</code>, <code>power.c</code></li>
-			<li><code>thermal.c</code> — Intel DTS and AMD D18F3xA4 sampling</li>
-			<li><code>spinlock.h</code> — IRQ-safe spinlocks</li>
+			<li><code>kernel/sched.c</code>, <code>kernel/sched.h</code> — scheduler core and BKL</li>
+			<li><code>kernel/process.c</code>, <code>kernel/process.h</code> — PCBs and lifecycle</li>
+			<li><code>kernel/switch.S</code> — context switch</li>
+			<li><code>kernel/tss.c</code>, <code>kernel/tss.h</code> — per-CPU TSS</li>
+			<li><code>kernel/acpi.c</code>, <code>kernel/ioapic.c</code>, <code>kernel/lapic.c</code>, <code>kernel/smp.c</code> — SMP and IOAPIC masking</li>
+			<li><code>kernel/ap_tramp.S</code> — AP startup blob</li>
+			<li><code>kernel/timer.S</code>, <code>kernel/idle.c</code>, <code>kernel/power.c</code></li>
+			<li><code>kernel/thermal.c</code> — Intel DTS and AMD D18F3xA4 sampling</li>
+			<li><code>kernel/spinlock.h</code> — IRQ-safe spinlocks</li>
 		</ul>
 		</ul>
 	</section>
 	</section>
 </main>
 </main>

+ 64 - 18
docs/development.html

@@ -52,6 +52,7 @@
 		<h2>On this page</h2>
 		<h2>On this page</h2>
 		<ul>
 		<ul>
 			<li><a href="#toolchain">Toolchain</a></li>
 			<li><a href="#toolchain">Toolchain</a></li>
+			<li><a href="#tree">Source tree</a></li>
 			<li><a href="#pipeline">Build pipeline</a></li>
 			<li><a href="#pipeline">Build pipeline</a></li>
 			<li><a href="#targets">Make targets</a></li>
 			<li><a href="#targets">Make targets</a></li>
 			<li><a href="#serial">Serial reload</a></li>
 			<li><a href="#serial">Serial reload</a></li>
@@ -77,13 +78,58 @@
 			<li><strong>Compiler.</strong> <code>gcc</code> with 32-bit multilib, <code>as</code>, <code>ld</code>, <code>objcopy</code>.</li>
 			<li><strong>Compiler.</strong> <code>gcc</code> with 32-bit multilib, <code>as</code>, <code>ld</code>, <code>objcopy</code>.</li>
 			<li><strong>Kernel flags.</strong> <code>-m32 -march=i586 -ffreestanding -fno-pie -nostdlib -fno-stack-protector -mno-sse -mno-sse2 -mno-mmx -O2</code>.</li>
 			<li><strong>Kernel flags.</strong> <code>-m32 -march=i586 -ffreestanding -fno-pie -nostdlib -fno-stack-protector -mno-sse -mno-sse2 -mno-mmx -O2</code>.</li>
 			<li><strong>Warnings.</strong> The build uses <code>-Wall -Wextra</code>; a new warning is a bug, not noise.</li>
 			<li><strong>Warnings.</strong> The build uses <code>-Wall -Wextra</code>; a new warning is a bug, not noise.</li>
-			<li><strong>User commands.</strong> Linked at <code>0x40000000</code> with <code>ucmd.ld</code>, stripped, and packed as <code>bin/&lt;name&gt;</code>.</li>
+			<li><strong>User commands.</strong> Linked at <code>0x40000000</code> with <code>user/ucmd.ld</code>, stripped, and packed as <code>bin/&lt;name&gt;</code>.</li>
 			<li><strong>UEFI.</strong> <code>x86_64-w64-mingw32-gcc</code> builds <code>BOOTX64.EFI</code>; <code>make all</code> does not require it.</li>
 			<li><strong>UEFI.</strong> <code>x86_64-w64-mingw32-gcc</code> builds <code>BOOTX64.EFI</code>; <code>make all</code> does not require it.</li>
 			<li><strong>Images.</strong> <code>mtools</code> builds <code>root.img</code> and the ESP.</li>
 			<li><strong>Images.</strong> <code>mtools</code> builds <code>root.img</code> and the ESP.</li>
 			<li><strong>WiFi firmware.</strong> The pack includes <code>firmware/iwlwifi-7265D-29.ucode</code> (Chromebook) and <code>firmware/iwlwifi-6000-4.ucode</code> (X201), decompressed with <code>zstd</code> from the host's linux-firmware (<code>WIFI_FW_7265D=</code> / <code>WIFI_FW_6000=/path/to/file[.zst]</code> override the search). A missing file only prints a note and leaves that card without firmware; the floppy images always use the firmware-less <code>cmds-lite.pack</code>.</li>
 			<li><strong>WiFi firmware.</strong> The pack includes <code>firmware/iwlwifi-7265D-29.ucode</code> (Chromebook) and <code>firmware/iwlwifi-6000-4.ucode</code> (X201), decompressed with <code>zstd</code> from the host's linux-firmware (<code>WIFI_FW_7265D=</code> / <code>WIFI_FW_6000=/path/to/file[.zst]</code> override the search). A missing file only prints a note and leaves that card without firmware; the floppy images always use the firmware-less <code>cmds-lite.pack</code>.</li>
 		</ul>
 		</ul>
 	</section>
 	</section>
 
 
+	<section id="tree">
+		<h2>Source tree</h2>
+		<p>
+			One top-level Makefile builds every directory.  Intermediate objects
+			go to <code>build/</code>, mirroring the source paths, with
+			compiler-generated header dependencies (<code>-MMD</code>); the images
+			and the files the dev workflow sends or inspects
+			(<code>kernel.elf</code>, <code>kernel.bin</code>, <code>floppy.img</code>,
+			<code>usb.img</code>, <code>usb-efi.img</code>, <code>BOOTX64.EFI</code>,
+			<code>cmds.pack</code>, <code>cmds_pack_gz.bin</code>,
+			<code>browser.elf</code>, <code>gallery.elf</code>) stay at the top level.
+		</p>
+		<div class="table-wrap">
+			<table>
+				<thead>
+					<tr><th>Directory</th><th>Contents</th><th>Include path</th></tr>
+				</thead>
+				<tbody>
+					<tr><td><code>boot/</code></td><td>Boot sector, MBR, VESA stage; <code>boot/efi/</code> UEFI loader</td><td><code>include/</code>, <code>kernel/</code> (EFI: <code>vga.h</code>)</td></tr>
+					<tr><td><code>kernel/</code></td><td>Kernel, drivers, services, <code>kernel.ld</code>; host tests for <code>ccmp</code> and the touchpad gestures</td><td><code>include/</code>, <code>common/</code>, <code>kernel/</code></td></tr>
+					<tr><td><code>common/</code></td><td>Freestanding code linked into both kernel and userland: <code>inflate.c</code>, <code>font_8x16.c</code></td><td>itself</td></tr>
+					<tr><td><code>include/</code></td><td>Shared ABI headers: <code>syscall.h</code>, <code>wm_abi.h</code>, <code>bootinfo.h</code>, <code>phys.h</code>, <code>rootfs.h</code>, <code>version.h</code>, <code>wifi_cfg.h</code>, <code>rtl8821a_tbl.h</code></td><td>—</td></tr>
+					<tr><td><code>user/</code></td><td><code>ucmd_lib.h</code>, <code>ucmd.ld</code></td><td><code>include/</code>, <code>common/</code>, <code>user/</code>, every <code>user/lib/*</code>; libc headers by default</td></tr>
+					<tr><td><code>user/apps/&lt;name&gt;/</code></td><td>One ring-3 program each, entry file <code>ucmd_&lt;name&gt;.c</code> plus its private modules (the browser, chat, gallery)</td><td>as <code>user/</code></td></tr>
+					<tr><td><code>user/lib/&lt;lib&gt;/</code></td><td><code>libc</code>, <code>ngui</code>, <code>ufont</code>, <code>img</code>, <code>tls</code> (crypto + TLS), <code>uhttp</code>, <code>ujson</code>, <code>uwm</code>, <code>wifi</code> (saved networks, WPA2), each with its host tests</td><td>as <code>user/</code></td></tr>
+					<tr><td><code>tools/</code></td><td>Host tools (<code>mkpack</code>, <code>mkrootfs</code>, <code>mkrtwtbl</code>, <code>kexec_send</code>, <code>netkexec_send</code>, <code>netmonitor</code>, <code>flash.sh</code>) and the QMP test scripts</td><td><code>include/</code></td></tr>
+					<tr><td><code>host/</code></td><td>Linux SDL3 browser harness</td><td>as <code>user/</code></td></tr>
+				</tbody>
+			</table>
+		</div>
+		<p>
+			The kernel never includes a userland header.  The one userland file
+			that reaches into the kernel is <code>user/apps/term/ucmd_term.c</code>
+			(<code>IO_KEY_*</code> and <code>VFS_PATH_MAX</code>), which gets
+			<code>-Ikernel</code> explicitly.  A new command is a directory
+			<code>user/apps/&lt;name&gt;/</code> with <code>ucmd_&lt;name&gt;.c</code>
+			and an entry in <code>UCMDS</code>; one that links libraries gets an
+			explicit <code>.elf</code> rule in the Makefile.  Per-object flags
+			(<code>-Os</code>, function sections, no libc headers) are
+			target-specific variables on the <code>.o</code>, and make does not
+			track them: after changing one, delete the object or run
+			<code>make clean</code>.
+		</p>
+	</section>
+
 	<section id="pipeline">
 	<section id="pipeline">
 		<h2>Build pipeline</h2>
 		<h2>Build pipeline</h2>
 		<figure class="figure">
 		<figure class="figure">
@@ -93,15 +139,15 @@
 
 
 				<rect class="svg-box blue" x="20" y="20" width="250" height="64" rx="9"/>
 				<rect class="svg-box blue" x="20" y="20" width="250" height="64" rx="9"/>
 				<text class="svg-text" x="40" y="46">kernel sources</text>
 				<text class="svg-text" x="40" y="46">kernel sources</text>
-				<text class="svg-sub" x="40" y="66">*.c · *.S · linker scripts</text>
+				<text class="svg-sub" x="40" y="66">boot/ · kernel/ · common/</text>
 
 
 				<rect class="svg-box blue" x="20" y="116" width="250" height="64" rx="9"/>
 				<rect class="svg-box blue" x="20" y="116" width="250" height="64" rx="9"/>
 				<text class="svg-text" x="40" y="142">ring-3 sources</text>
 				<text class="svg-text" x="40" y="142">ring-3 sources</text>
-				<text class="svg-sub" x="40" y="162">ucmd_*.c · ngui · browser</text>
+				<text class="svg-sub" x="40" y="162">user/apps/* · user/lib/*</text>
 
 
 				<rect class="svg-box blue" x="20" y="212" width="250" height="64" rx="9"/>
 				<rect class="svg-box blue" x="20" y="212" width="250" height="64" rx="9"/>
 				<text class="svg-text" x="40" y="238">UEFI loader</text>
 				<text class="svg-text" x="40" y="238">UEFI loader</text>
-				<text class="svg-sub" x="40" y="258">efi/*.c · tramp.S</text>
+				<text class="svg-sub" x="40" y="258">boot/efi/*.c · tramp.S</text>
 
 
 				<path class="svg-line blue" d="M270 52h62"/>
 				<path class="svg-line blue" d="M270 52h62"/>
 				<path class="svg-line blue" d="M326 46l7 6-7 6"/>
 				<path class="svg-line blue" d="M326 46l7 6-7 6"/>
@@ -323,7 +369,7 @@ make net-cmds                   # replace /ramfs only</code></pre>
 	<section id="conventions">
 	<section id="conventions">
 		<h2>Conventions &amp; gotchas</h2>
 		<h2>Conventions &amp; gotchas</h2>
 		<ul>
 		<ul>
-			<li><strong>Freestanding C.</strong> The kernel has no libc, <code>malloc</code> or <code>printf</code>; use <code>io_putstr</code>, <code>io_putchar</code> and <code>io_puthex</code>. Ring-3 commands may link <code>libc.a</code> from <span class="file">libc/</span>; link it explicitly and compile the app with <code>-Ilibc/include</code>.</li>
+			<li><strong>Freestanding C.</strong> The kernel has no libc, <code>malloc</code> or <code>printf</code>; use <code>io_putstr</code>, <code>io_putchar</code> and <code>io_puthex</code>. Ring-3 commands may link <code>libc.a</code> from <span class="file">user/lib/libc/</span>; ring-3 objects see its headers (<code>-Iuser/lib/libc/include</code>) by default.</li>
 			<li><strong>Fresh memory is not zeroed.</strong> Clear structures whose fields are read before being written. QEMU starts RAM clear and hides the bug.</li>
 			<li><strong>Fresh memory is not zeroed.</strong> Clear structures whose fields are read before being written. QEMU starts RAM clear and hides the bug.</li>
 			<li><strong>Keep the memory map in sync.</strong> Hardcoded addresses appear in assembly, C headers and linker scripts; changing one without the others breaks boot or loading.</li>
 			<li><strong>Keep the memory map in sync.</strong> Hardcoded addresses appear in assembly, C headers and linker scripts; changing one without the others breaks boot or loading.</li>
 			<li><strong>Ring-3 data segments.</strong> An IRET to ring 3 nulls DS/ES/FS/GS whose DPL is below CPL 3. Kernel stubs must restore selector <code>0x23</code> with <code>IRQ_RETURN_DS</code>. QEMU does not model this; only real hardware fails.</li>
 			<li><strong>Ring-3 data segments.</strong> An IRET to ring 3 nulls DS/ES/FS/GS whose DPL is below CPL 3. Kernel stubs must restore selector <code>0x23</code> with <code>IRQ_RETURN_DS</code>. QEMU does not model this; only real hardware fails.</li>
@@ -371,20 +417,20 @@ make net-cmds                   # replace /ramfs only</code></pre>
 		<h2>Source map</h2>
 		<h2>Source map</h2>
 		<ul class="filelist">
 		<ul class="filelist">
 			<li><code>Makefile</code> — targets and image rules</li>
 			<li><code>Makefile</code> — targets and image rules</li>
-			<li><code>libc/</code>, <code>libc.a</code> — optional ring-3 libc and its host test</li>
-			<li><code>third_party/quickjs/</code> (see its <code>VENDOR</code>), <code>js_mu.c/h</code>, <code>js_browser.c/h</code> — vendored JavaScript engine, its MuJS-style stack API and the browser bindings; <code>js_test.c</code> host tests</li>
-			<li><code>host/</code> — Linux SDL3 browser harness: <code>syscall.c</code> implements the <code>SYS_*</code> ABI, <code>window_sdl3.c</code> the Wayland window/input, <code>fs.c</code>/<code>net.c</code>/<code>proc.c</code> the host file, socket and <code>curl __serve</code> services, and <code>window_headless.c</code> the screenshot mode; <span class="file">ucmd_lib.h</span> selects the host prototypes with <code>UCMD_HOST</code></li>
-			<li><code>ufont.c</code>, <code>ufont_ttf.c</code>, <code>fonts/</code> — UI font engine and subsets; <code>ufont_test.c</code> host test</li>
-			<li><code>kexec.c</code>, <code>kexec_send.c</code> — serial reload</li>
-			<li><code>netkexec.c</code>, <code>netkexec_send.c</code> — network reload</li>
-			<li><code>netlog.c</code>, <code>netmonitor.c</code> — UDP console</li>
-			<li><code>dbg.c</code> — serial debug monitor</li>
-			<li><code>io.c</code>, <code>terminal.c</code> — scancode decoder/tap and the kernel command registry</li>
-			<li><code>panic.c</code> — fatal exception dump</li>
-			<li><code>kernel.ld</code>, <code>ucmd.ld</code> — link limits</li>
+			<li><code>user/lib/libc/</code>, <code>libc.a</code> — optional ring-3 libc and its host test</li>
+			<li><code>third_party/quickjs/</code> (see its <code>VENDOR</code>), <code>user/apps/browser/js_mu.c/h</code>, <code>user/apps/browser/js_browser.c/h</code> — vendored JavaScript engine, its MuJS-style stack API and the browser bindings; <code>user/apps/browser/js_test.c</code> host tests</li>
+			<li><code>host/</code> — Linux SDL3 browser harness: <code>host/syscall.c</code> implements the <code>SYS_*</code> ABI, <code>host/window_sdl3.c</code> the Wayland window/input, <code>host/fs.c</code>/<code>host/net.c</code>/<code>host/proc.c</code> the host file, socket and <code>curl __serve</code> services, and <code>host/window_headless.c</code> the screenshot mode; <span class="file">ucmd_lib.h</span> selects the host prototypes with <code>UCMD_HOST</code></li>
+			<li><code>user/lib/ufont/ufont.c</code>, <code>user/lib/ufont/ufont_ttf.c</code>, <code>fonts/</code> — UI font engine and subsets; <code>user/lib/ufont/ufont_test.c</code> host test</li>
+			<li><code>kernel/kexec.c</code>, <code>tools/kexec_send.c</code> — serial reload</li>
+			<li><code>kernel/netkexec.c</code>, <code>tools/netkexec_send.c</code> — network reload</li>
+			<li><code>kernel/netlog.c</code>, <code>tools/netmonitor.c</code> — UDP console</li>
+			<li><code>kernel/dbg.c</code> — serial debug monitor</li>
+			<li><code>kernel/io.c</code>, <code>kernel/terminal.c</code> — scancode decoder/tap and the kernel command registry</li>
+			<li><code>kernel/panic.c</code> — fatal exception dump</li>
+			<li><code>kernel/kernel.ld</code>, <code>user/ucmd.ld</code> — link limits</li>
 			<li><code>tools/</code> — QMP USB and installer tests</li>
 			<li><code>tools/</code> — QMP USB and installer tests</li>
-			<li><code>wpa_test.c</code> — WPA2 supplicant host test (<code>make test-wpa</code>)</li>
-			<li><code>wifi_store_test.c</code> — saved WiFi list host test (<code>make test-wifi-store</code>)</li>
+			<li><code>user/lib/wifi/wpa_test.c</code> — WPA2 supplicant host test (<code>make test-wpa</code>)</li>
+			<li><code>user/lib/wifi/wifi_store_test.c</code> — saved WiFi list host test (<code>make test-wifi-store</code>)</li>
 			<li><code>AGENTS.md</code> — developer notes and maintenance rule</li>
 			<li><code>AGENTS.md</code> — developer notes and maintenance rule</li>
 		</ul>
 		</ul>
 	</section>
 	</section>

+ 28 - 28
docs/drivers.html

@@ -712,34 +712,34 @@
 	<section id="sources">
 	<section id="sources">
 		<h2>Source map</h2>
 		<h2>Source map</h2>
 		<ul class="filelist">
 		<ul class="filelist">
-			<li><code>pci.c</code>, <code>pci.h</code> — enumeration</li>
-			<li><code>blkdev.c</code> — block registry</li>
-			<li><code>sdhci.c</code>, <code>sdhci.h</code> — Intel Braswell eMMC</li>
-			<li><code>disk.c</code> — floppy / DMA</li>
-			<li><code>ata.c</code>, <code>ahci.c</code> — PATA/SATA</li>
-			<li><code>usb.c</code>, <code>usb_hcd.h</code> — USB core</li>
-			<li><code>uhci.c</code>, <code>ohci.c</code>, <code>ehci.c</code>, <code>xhci.c</code></li>
-			<li><code>usbmsc.c</code>, <code>usbmsc.h</code> — USB BOT/SCSI mass storage</li>
-			<li><code>rndis.c</code>, <code>rndis.h</code> — USB RNDIS tethering</li>
-			<li><code>iwl_trans.c</code>, <code>iwl_trans.h</code> — Intel WiFi PCIe transport (7000 and 6000 families)</li>
-			<li><code>iwl_mvm.c</code>, <code>iwl_mvm.h</code> — 7265D/3165 firmware commands (MVM)</li>
-			<li><code>iwl_dvm.c</code>, <code>iwl_dvm.h</code> — 6200/6300 firmware commands (DVM)</li>
-			<li><code>wifi_fw.c</code>, <code>wifi_fw.h</code> — WiFi backend dispatch (Intel MVM/DVM, RTL8821AU)</li>
-			<li><code>rtl8821au.c</code>, <code>rtl8821au.h</code> — Realtek RTL8821AU USB WiFi</li>
-			<li><code>mkrtwtbl.c</code>, <code>rtl8821a_tbl.h</code>, <code>third_party/rtw88/</code> — RTL8821A register tables → <code>firmware/rtl8821a.tbl</code></li>
-			<li><code>wifi.c</code>, <code>wifi.h</code> — 802.11 station, <code>wifi</code> netdev, <code>SYS_WIFI</code></li>
-			<li><code>ccmp.c</code>, <code>ccmp.h</code> — software CCMP (AES-CCM): RX fallback, RTL8821AU TX</li>
-			<li><code>install.c</code> — live-image clone installer</li>
-			<li><code>backlight.c</code>, <code>backlight.h</code> — Cherryview/Braswell panel PWM</li>
-			<li><code>usbhid.c</code>, <code>mouse.c</code>, <code>io.c</code> — input</li>
-			<li><code>i2c.c</code>, <code>i2c.h</code> — DesignWare/LPSS I2C master</li>
-			<li><code>touchpad.c</code>, <code>touchpad.h</code> — Elan HID-over-I2C touchpad</li>
-			<li><code>touchpad_gesture.c</code>, <code>touchpad_gesture.h</code> — device-independent contact gestures (tap, right-click zones, scroll)</li>
-			<li><code>touchpad_gesture_test.c</code> — host test (<code>make test-touchpad</code>)</li>
-			<li><code>serial.c</code>, <code>serial_ring_buf.c</code></li>
-			<li><code>thermal.c</code>, <code>it87.c</code>, <code>tpec.c</code>, <code>ec.c</code>, <code>cros_ec.c</code>, <code>power_src.c</code>, <code>mtrr.c</code></li>
-			<li><code>rtc.c</code> — CMOS wall clock read/write</li>
-			<li><code>panic.c</code>, <code>timer.S</code> — fatal exceptions</li>
+			<li><code>kernel/pci.h</code> — enumeration</li>
+			<li><code>kernel/blkdev.c</code> — block registry</li>
+			<li><code>kernel/sdhci.c</code>, <code>kernel/sdhci.h</code> — Intel Braswell eMMC</li>
+			<li><code>kernel/disk.c</code> — floppy / DMA</li>
+			<li><code>kernel/ata.c</code>, <code>kernel/ahci.c</code> — PATA/SATA</li>
+			<li><code>kernel/usb.c</code>, <code>kernel/usb_hcd.h</code> — USB core</li>
+			<li><code>kernel/uhci.c</code>, <code>kernel/ohci.c</code>, <code>kernel/ehci.c</code>, <code>kernel/xhci.c</code></li>
+			<li><code>kernel/usbmsc.c</code>, <code>kernel/usbmsc.h</code> — USB BOT/SCSI mass storage</li>
+			<li><code>kernel/rndis.c</code>, <code>kernel/rndis.h</code> — USB RNDIS tethering</li>
+			<li><code>kernel/iwl_trans.c</code>, <code>kernel/iwl_trans.h</code> — Intel WiFi PCIe transport (7000 and 6000 families)</li>
+			<li><code>kernel/iwl_mvm.c</code>, <code>kernel/iwl_mvm.h</code> — 7265D/3165 firmware commands (MVM)</li>
+			<li><code>kernel/iwl_dvm.c</code>, <code>kernel/iwl_dvm.h</code> — 6200/6300 firmware commands (DVM)</li>
+			<li><code>kernel/wifi_fw.c</code>, <code>kernel/wifi_fw.h</code> — WiFi backend dispatch (Intel MVM/DVM, RTL8821AU)</li>
+			<li><code>kernel/rtl8821au.c</code>, <code>kernel/rtl8821au.h</code> — Realtek RTL8821AU USB WiFi</li>
+			<li><code>tools/mkrtwtbl.c</code>, <code>include/rtl8821a_tbl.h</code>, <code>third_party/rtw88/</code> — RTL8821A register tables → <code>firmware/rtl8821a.tbl</code></li>
+			<li><code>kernel/wifi.c</code>, <code>kernel/wifi.h</code> — 802.11 station, <code>wifi</code> netdev, <code>SYS_WIFI</code></li>
+			<li><code>kernel/ccmp.c</code>, <code>kernel/ccmp.h</code> — software CCMP (AES-CCM): RX fallback, RTL8821AU TX</li>
+			<li><code>kernel/install.c</code> — live-image clone installer</li>
+			<li><code>kernel/backlight.c</code>, <code>kernel/backlight.h</code> — Cherryview/Braswell panel PWM</li>
+			<li><code>kernel/usbhid.c</code>, <code>kernel/mouse.c</code>, <code>kernel/io.c</code> — input</li>
+			<li><code>kernel/i2c.c</code>, <code>kernel/i2c.h</code> — DesignWare/LPSS I2C master</li>
+			<li><code>kernel/touchpad.c</code>, <code>kernel/touchpad.h</code> — Elan HID-over-I2C touchpad</li>
+			<li><code>kernel/touchpad_gesture.c</code>, <code>kernel/touchpad_gesture.h</code> — device-independent contact gestures (tap, right-click zones, scroll)</li>
+			<li><code>kernel/touchpad_gesture_test.c</code> — host test (<code>make test-touchpad</code>)</li>
+			<li><code>kernel/serial.c</code>, <code>kernel/serial_ring_buf.c</code></li>
+			<li><code>kernel/thermal.c</code>, <code>kernel/it87.c</code>, <code>kernel/tpec.c</code>, <code>kernel/ec.c</code>, <code>kernel/cros_ec.c</code>, <code>kernel/power_src.c</code>, <code>kernel/mtrr.c</code></li>
+			<li><code>kernel/rtc.c</code> — CMOS wall clock read/write</li>
+			<li><code>kernel/panic.c</code>, <code>kernel/timer.S</code> — fatal exceptions</li>
 		</ul>
 		</ul>
 	</section>
 	</section>
 </main>
 </main>

+ 14 - 13
docs/filesystems.html

@@ -273,7 +273,8 @@
 
 
 		<p>
 		<p>
 			The pack build is part of the normal Makefile. Add a
 			The pack build is part of the normal Makefile. Add a
-			<code>ucmd_&lt;name&gt;.c</code> to <code>UCMDS</code> and the pack,
+			<code>user/apps/&lt;name&gt;/ucmd_&lt;name&gt;.c</code> and its name to
+			<code>UCMDS</code> and the pack,
 			the mount and the PATH listing pick it up automatically. Runtime
 			the mount and the PATH listing pick it up automatically. Runtime
 			replacement uses <code>make cmds-dev</code> or
 			replacement uses <code>make cmds-dev</code> or
 			<code>make net-cmds</code> and validates the pack before swapping it.
 			<code>make net-cmds</code> and validates the pack before swapping it.
@@ -415,18 +416,18 @@
 	<section id="sources">
 	<section id="sources">
 		<h2>Source map</h2>
 		<h2>Source map</h2>
 		<ul class="filelist">
 		<ul class="filelist">
-			<li><code>vfs.c</code>, <code>vfs.h</code> — mounts and dispatch</li>
-			<li><code>fat.c</code>, <code>fat.h</code> — FAT12/16/32</li>
-			<li><code>ramfs.c</code>, <code>ramfs.h</code> — pack inflate</li>
-			<li><code>share.c</code>, <code>share.h</code> — /share</li>
-			<li><code>sys_fs.c</code> — ring-3 file service</li>
-			<li><code>mkpack.c</code>, <code>mkrootfs.c</code>, <code>rootfs.h</code></li>
-			<li><code>inflate.c</code> — DEFLATE/gzip</li>
-			<li><code>ucmd_websrv.c</code> — HTTP/WebDAV</li>
-			<li><code>fatdetect.c</code>, <code>fatformat.c</code> — format</li>
-			<li><code>usbmsc.c</code>, <code>usbmsc.h</code> — USB mass-storage block devices</li>
-			<li><code>install.c</code>, <code>install.h</code> — clone, self-update and net-install writer</li>
-			<li><code>rootfs.h</code> — installed image geometry and NBROOT1 header</li>
+			<li><code>kernel/vfs.c</code>, <code>kernel/vfs.h</code> — mounts and dispatch</li>
+			<li><code>kernel/fat.c</code>, <code>kernel/fat.h</code> — FAT12/16/32</li>
+			<li><code>kernel/ramfs.c</code>, <code>kernel/ramfs.h</code> — pack inflate</li>
+			<li><code>kernel/share.c</code>, <code>kernel/share.h</code> — /share</li>
+			<li><code>kernel/sys_fs.c</code> — ring-3 file service</li>
+			<li><code>tools/mkpack.c</code>, <code>tools/mkrootfs.c</code>, <code>include/rootfs.h</code></li>
+			<li><code>common/inflate.c</code> — DEFLATE/gzip</li>
+			<li><code>user/apps/websrv/ucmd_websrv.c</code> — HTTP/WebDAV</li>
+			<li><code>kernel/fatdetect.c</code>, <code>kernel/fatformat.c</code> — format</li>
+			<li><code>kernel/usbmsc.c</code>, <code>kernel/usbmsc.h</code> — USB mass-storage block devices</li>
+			<li><code>kernel/install.c</code>, <code>kernel/install.h</code> — clone, self-update and net-install writer</li>
+			<li><code>include/rootfs.h</code> — installed image geometry and NBROOT1 header</li>
 		</ul>
 		</ul>
 	</section>
 	</section>
 </main>
 </main>

+ 18 - 18
docs/graphics.html

@@ -473,25 +473,25 @@
 	<section id="sources">
 	<section id="sources">
 		<h2>Source map</h2>
 		<h2>Source map</h2>
 		<ul class="filelist">
 		<ul class="filelist">
-			<li><code>vga.c</code>, <code>vga.h</code> — framebuffer and damage</li>
-			<li><code>bootcon.c</code> — direct-to-LFB boot console</li>
-			<li><code>vga_copy.S</code> — copy primitives</li>
-			<li><code>blit.c</code>, <code>blit.h</code> — pixel vtable</li>
-			<li><code>cpu.c</code> — SSE2 probing</li>
-			<li><code>wm.c</code>, <code>wm.h</code>, <code>wm_abi.h</code> — kernel window server and shared ABI</li>
-			<li><code>ucmd_wm.c</code>, <code>uwm_lib.c</code> — ring-3 WM</li>
-			<li><code>ucmd_netmenu.c</code> — top-bar control panel (network/WiFi, brightness, power mode, Date &amp; Time)</li>
-			<li><code>ucmd_settime.c</code>, <code>rtc.c</code>, <code>ntp.c</code> — Date &amp; Time editor, RTC access and SNTP sync</li>
-			<li><code>gfx.c</code>, <code>gfx.h</code> — RGB565 window canvases</li>
-			<li><code>sys_wm.c</code>, <code>sys_wm.h</code> — WM/window ABI</li>
-			<li><code>browser.c</code>, <code>browser_html.c</code> — HTML/CSS renderer and inline SVG</li>
-			<li><code>ngui.c</code>, <code>ngui.h</code> — toolkit</li>
-			<li><code>ufont.c</code>, <code>ufont_ttf.c</code>, <code>ufont_draw.c</code> — fixed-point TrueType text</li>
+			<li><code>kernel/vga.c</code>, <code>kernel/vga.h</code> — framebuffer and damage</li>
+			<li><code>kernel/bootcon.c</code> — direct-to-LFB boot console</li>
+			<li><code>kernel/vga_copy.S</code> — copy primitives</li>
+			<li><code>kernel/blit.c</code>, <code>kernel/blit.h</code> — pixel vtable</li>
+			<li><code>kernel/cpu.c</code> — SSE2 probing</li>
+			<li><code>kernel/wm.c</code>, <code>kernel/wm.h</code>, <code>include/wm_abi.h</code> — kernel window server and shared ABI</li>
+			<li><code>user/apps/wm/ucmd_wm.c</code>, <code>user/lib/uwm/uwm_lib.c</code> — ring-3 WM</li>
+			<li><code>user/apps/netmenu/ucmd_netmenu.c</code> — top-bar control panel (network/WiFi, brightness, power mode, Date &amp; Time)</li>
+			<li><code>user/apps/settime/ucmd_settime.c</code>, <code>kernel/rtc.c</code>, <code>kernel/ntp.c</code> — Date &amp; Time editor, RTC access and SNTP sync</li>
+			<li><code>kernel/gfx.c</code>, <code>kernel/gfx.h</code> — RGB565 window canvases</li>
+			<li><code>kernel/sys_wm.c</code>, <code>kernel/sys_wm.h</code> — WM/window ABI</li>
+			<li><code>user/apps/browser/browser.c</code>, <code>user/apps/browser/browser_html.c</code> — HTML/CSS renderer and inline SVG</li>
+			<li><code>user/lib/ngui/ngui.c</code>, <code>user/lib/ngui/ngui.h</code> — toolkit</li>
+			<li><code>user/lib/ufont/ufont.c</code>, <code>user/lib/ufont/ufont_ttf.c</code>, <code>user/lib/ufont/ufont_draw.c</code> — fixed-point TrueType text</li>
 			<li><code>fonts/*.ttf</code> — Arimo / Liberation Mono / Noto Emoji subsets in the pack</li>
 			<li><code>fonts/*.ttf</code> — Arimo / Liberation Mono / Noto Emoji subsets in the pack</li>
-			<li><code>ucmd_files.c</code>, <code>gallery.c</code>, <code>ucmd_solitaire.c</code>, <code>ucmd_chat.c</code></li>
-			<li><code>img*.c</code> — image codecs</li>
-			<li><code>ati.c</code>, <code>nvidia.c</code>, <code>intel.c</code>, <code>nv50.c</code></li>
-			<li><code>backlight.c</code>, <code>backlight.h</code> — Cherryview/VLV panel PWM</li>
+			<li><code>user/apps/files/ucmd_files.c</code>, <code>user/apps/gallery/gallery.c</code>, <code>user/apps/solitaire/ucmd_solitaire.c</code>, <code>user/apps/chat/ucmd_chat.c</code></li>
+			<li><code>user/lib/img/img*.c</code> — image codecs</li>
+			<li><code>kernel/ati.c</code>, <code>kernel/nvidia.c</code>, <code>kernel/intel.c</code>, <code>kernel/nv50.c</code></li>
+			<li><code>kernel/backlight.c</code>, <code>kernel/backlight.h</code> — Cherryview/VLV panel PWM</li>
 		</ul>
 		</ul>
 	</section>
 	</section>
 </main>
 </main>

+ 18 - 9
docs/index.html

@@ -251,9 +251,18 @@
 	<section id="tour">
 	<section id="tour">
 		<h2>Repository tour</h2>
 		<h2>Repository tour</h2>
 		<p>
 		<p>
-			NebOS is deliberately flat: the kernel, the freestanding libraries
-			and the ring-3 commands live side by side at the repository root.
-			The linker scripts and the Makefile are the map.
+			The tree is split by privilege and lifetime: <span class="file">boot/</span>
+			holds the boot stages (boot sector, MBR, VESA stage, UEFI loader),
+			<span class="file">kernel/</span> the ring-0 kernel, and
+			<span class="file">user/</span> the ring-3 world, with one directory per
+			program under <span class="file">user/apps/</span> and one per library
+			under <span class="file">user/lib/</span>.  <span class="file">include/</span>
+			holds the ABI headers every side shares (syscall numbers, the WM ABI,
+			boot info, the rootfs header), <span class="file">common/</span> the
+			few freestanding sources linked into both kernel and userland, and
+			<span class="file">tools/</span> the host-side tools.  The top-level
+			Makefile builds everything; objects go to <span class="file">build/</span>
+			and the images stay at the top.
 		</p>
 		</p>
 		<div class="table-wrap">
 		<div class="table-wrap">
 			<table>
 			<table>
@@ -263,27 +272,27 @@
 				<tbody>
 				<tbody>
 					<tr>
 					<tr>
 						<td>Boot chain</td>
 						<td>Boot chain</td>
-						<td><span class="file">boot.S</span> <span class="file">mbr.S</span> <span class="file">vesa_stage.S</span> <span class="file">entry.S</span> <span class="file">efi/</span></td>
+						<td><span class="file">boot/boot.S</span> <span class="file">boot/mbr.S</span> <span class="file">boot/vesa_stage.S</span> <span class="file">boot/efi/</span> <span class="file">kernel/entry.S</span></td>
 					</tr>
 					</tr>
 					<tr>
 					<tr>
 						<td>Kernel core</td>
 						<td>Kernel core</td>
-						<td><span class="file">kernel.c</span> <span class="file">sched.c</span> <span class="file">process.c</span> <span class="file">mm.c</span> <span class="file">paging.c</span> <span class="file">syscall.c</span></td>
+						<td><span class="file">kernel/kernel.c</span> <span class="file">kernel/sched.c</span> <span class="file">kernel/process.c</span> <span class="file">kernel/mm.c</span> <span class="file">kernel/paging.c</span> <span class="file">kernel/syscall.c</span> <span class="file">include/syscall.h</span></td>
 					</tr>
 					</tr>
 					<tr>
 					<tr>
 						<td>Devices</td>
 						<td>Devices</td>
-						<td><span class="file">usb.c</span> <span class="file">uhci.c</span> <span class="file">ohci.c</span> <span class="file">ehci.c</span> <span class="file">xhci.c</span> <span class="file">usbmsc.c</span> <span class="file">ata.c</span> <span class="file">ahci.c</span></td>
+						<td><span class="file">kernel/</span>: <span class="file">usb.c</span> <span class="file">uhci.c</span> <span class="file">ohci.c</span> <span class="file">ehci.c</span> <span class="file">xhci.c</span> <span class="file">usbmsc.c</span> <span class="file">ata.c</span> <span class="file">ahci.c</span></td>
 					</tr>
 					</tr>
 					<tr>
 					<tr>
 						<td>Services</td>
 						<td>Services</td>
-						<td><span class="file">sys_fs.c</span> <span class="file">sys_net.c</span> <span class="file">gfx.c</span> <span class="file">sys_wm.c</span> <span class="file">sys_info.c</span> <span class="file">install.c</span></td>
+						<td><span class="file">kernel/</span>: <span class="file">sys_fs.c</span> <span class="file">sys_net.c</span> <span class="file">gfx.c</span> <span class="file">sys_wm.c</span> <span class="file">sys_info.c</span> <span class="file">install.c</span></td>
 					</tr>
 					</tr>
 					<tr>
 					<tr>
 						<td>Userland</td>
 						<td>Userland</td>
-						<td><span class="file">ucmd_*.c</span> <span class="file">ucmd_lib.h</span> <span class="file">libc/</span> <span class="file">third_party/quickjs/</span> <span class="file">js_mu.c</span> <span class="file">ngui.c</span> <span class="file">ufont.c</span> <span class="file">ufont_ttf.c</span> <span class="file">fonts/</span> <span class="file">browser.c</span> <span class="file">js_browser.c</span> <span class="file">gallery.c</span> <span class="file">ucmd_chat.c</span> <span class="file">chat_login.c</span> <span class="file">ujson.c</span> <span class="file">uhttp_cookie.c</span></td>
+						<td><span class="file">user/apps/&lt;name&gt;/ucmd_&lt;name&gt;.c</span> <span class="file">user/ucmd_lib.h</span> <span class="file">user/lib/libc/</span> <span class="file">user/lib/ngui/</span> <span class="file">user/lib/ufont/</span> <span class="file">user/lib/img/</span> <span class="file">user/lib/tls/</span> <span class="file">user/lib/uhttp/</span> <span class="file">user/lib/ujson/</span> <span class="file">user/apps/browser/</span> <span class="file">user/apps/chat/</span> <span class="file">third_party/quickjs/</span> <span class="file">fonts/</span></td>
 					</tr>
 					</tr>
 					<tr>
 					<tr>
 						<td>Build &amp; pack</td>
 						<td>Build &amp; pack</td>
-						<td><span class="file">Makefile</span> <span class="file">mkpack.c</span> <span class="file">mkrootfs.c</span> <span class="file">kernel.ld</span> <span class="file">ucmd.ld</span></td>
+						<td><span class="file">Makefile</span> <span class="file">tools/mkpack.c</span> <span class="file">tools/mkrootfs.c</span> <span class="file">kernel/kernel.ld</span> <span class="file">user/ucmd.ld</span></td>
 					</tr>
 					</tr>
 					<tr>
 					<tr>
 						<td>Documentation</td>
 						<td>Documentation</td>

+ 11 - 11
docs/memory.html

@@ -321,17 +321,17 @@
 	<section id="sources">
 	<section id="sources">
 		<h2>Source map</h2>
 		<h2>Source map</h2>
 		<ul class="filelist">
 		<ul class="filelist">
-			<li><code>mm.c</code>, <code>mm.h</code> — E820 + bitmap allocator</li>
-			<li><code>phys.h</code> — shared 512 MB physical ceiling</li>
-			<li><code>kmalloc.c</code>, <code>kmalloc.h</code> — kernel heap</li>
-			<li><code>libc/malloc.c</code>, <code>libc/ucmd_mem.c</code> — ring-3 heap and <code>SYS_MEM_*</code> backend</li>
-			<li><code>libc/string.c</code>, <code>libc/stdlib.c</code> — ring-3 libc support</li>
-			<li><code>paging.c</code>, <code>paging.h</code> — identity map</li>
-			<li><code>mtrr.c</code> — write-combining MTRRs</li>
-			<li><code>process.c</code>, <code>process.h</code> — stacks and user layout</li>
-			<li><code>ramfs.c</code> — pack copy / inflate</li>
-			<li><code>efi/main.c</code> — firmware map conversion</li>
-			<li><code>kernel.ld</code> — low-memory image limits</li>
+			<li><code>kernel/mm.c</code>, <code>kernel/mm.h</code> — E820 + bitmap allocator</li>
+			<li><code>include/phys.h</code> — shared 512 MB physical ceiling</li>
+			<li><code>kernel/kmalloc.c</code>, <code>kernel/kmalloc.h</code> — kernel heap</li>
+			<li><code>user/lib/libc/malloc.c</code>, <code>user/lib/libc/ucmd_mem.c</code> — ring-3 heap and <code>SYS_MEM_*</code> backend</li>
+			<li><code>user/lib/libc/string.c</code>, <code>user/lib/libc/stdlib.c</code> — ring-3 libc support</li>
+			<li><code>kernel/paging.c</code>, <code>kernel/paging.h</code> — identity map</li>
+			<li><code>kernel/mtrr.c</code> — write-combining MTRRs</li>
+			<li><code>kernel/process.c</code>, <code>kernel/process.h</code> — stacks and user layout</li>
+			<li><code>kernel/ramfs.c</code> — pack copy / inflate</li>
+			<li><code>boot/efi/main.c</code> — firmware map conversion</li>
+			<li><code>kernel/kernel.ld</code> — low-memory image limits</li>
 		</ul>
 		</ul>
 	</section>
 	</section>
 </main>
 </main>

+ 15 - 15
docs/network.html

@@ -513,21 +513,21 @@
 	<section id="sources">
 	<section id="sources">
 		<h2>Source map</h2>
 		<h2>Source map</h2>
 		<ul class="filelist">
 		<ul class="filelist">
-			<li><code>netdev.c</code>, <code>netdev.h</code> — registry</li>
-			<li><code>e1000e.c</code>, <code>r8168.c</code>, <code>ne2000.c</code>, <code>asix.c</code>, <code>rndis.c</code></li>
-			<li><code>wifi.c</code>, <code>wifi_fw.c</code>, <code>iwl_mvm.c</code>, <code>iwl_dvm.c</code>, <code>iwl_trans.c</code>, <code>rtl8821au.c</code> — Intel 7265D/3165 and 6200/6300 WiFi, Realtek RTL8821AU USB WiFi</li>
-			<li><code>wpa.c</code>, <code>wpa_crypto.c</code>, <code>ucmd_wifi.c</code> — WPA2-PSK supplicant and the <code>wifi</code> command (<code>make test-wpa</code>)</li>
-			<li><code>ucmd_netmenu.c</code>, <code>wifi_cfg.h</code>, <code>wifi_store.c/h</code> — top-bar control panel, staged WiFi connect request and the saved-network list</li>
-			<li><code>net.c</code>, <code>net.h</code> — ARP cache/ICMP/UDP/IP</li>
-			<li><code>netcore.c</code>, <code>netcore.h</code> — shared receive pump and IRQ helpers</li>
-			<li><code>dhcp.c</code>, <code>dns.c</code>, <code>ntp.c</code></li>
-			<li><code>tcp.c</code>, <code>tcp.h</code> — client table + listener</li>
-			<li><code>tls.c</code>, <code>tls_*.c</code> — TLS 1.3/1.2 (<code>tls_gcm.c</code> AES-128-GCM, <code>tls_p256.c</code> P-256 ECDH)</li>
-			<li><code>sys_net.c</code> — ring-3 service</li>
-			<li><code>netlog.c</code>, <code>netkexec.c</code></li>
-			<li><code>uhttp.c</code>, <code>ucmd_curl.c</code>, <code>ucmd_websrv.c</code></li>
-			<li><code>uhttp_cookie.c</code>, <code>ujson.c</code> — cookie jar, JSON parser</li>
-			<li><code>chat_login.c</code>, <code>ucmd_chat.c</code> — OIDC login driver, chat client</li>
+			<li><code>kernel/netdev.c</code>, <code>kernel/netdev.h</code> — registry</li>
+			<li><code>kernel/e1000e.c</code>, <code>kernel/r8168.c</code>, <code>kernel/ne2000.c</code>, <code>kernel/asix.c</code>, <code>kernel/rndis.c</code></li>
+			<li><code>kernel/wifi.c</code>, <code>kernel/wifi_fw.c</code>, <code>kernel/iwl_mvm.c</code>, <code>kernel/iwl_dvm.c</code>, <code>kernel/iwl_trans.c</code>, <code>kernel/rtl8821au.c</code> — Intel 7265D/3165 and 6200/6300 WiFi, Realtek RTL8821AU USB WiFi</li>
+			<li><code>user/lib/wifi/wpa.c</code>, <code>user/lib/tls/wpa_crypto.c</code>, <code>user/apps/wifi/ucmd_wifi.c</code> — WPA2-PSK supplicant and the <code>wifi</code> command (<code>make test-wpa</code>)</li>
+			<li><code>user/apps/netmenu/ucmd_netmenu.c</code>, <code>include/wifi_cfg.h</code>, <code>user/lib/wifi/wifi_store.c/h</code> — top-bar control panel, staged WiFi connect request and the saved-network list</li>
+			<li><code>kernel/net.c</code>, <code>kernel/net.h</code> — ARP cache/ICMP/UDP/IP</li>
+			<li><code>kernel/netcore.c</code>, <code>kernel/netcore.h</code> — shared receive pump and IRQ helpers</li>
+			<li><code>kernel/dhcp.c</code>, <code>kernel/dns.c</code>, <code>kernel/ntp.c</code></li>
+			<li><code>kernel/tcp.c</code>, <code>kernel/tcp.h</code> — client table + listener</li>
+			<li><code>user/lib/tls/tls.c</code>, <code>user/lib/tls/tls_*.c</code> — TLS 1.3/1.2 (<code>user/lib/tls/tls_gcm.c</code> AES-128-GCM, <code>user/lib/tls/tls_p256.c</code> P-256 ECDH)</li>
+			<li><code>kernel/sys_net.c</code> — ring-3 service</li>
+			<li><code>kernel/netlog.c</code>, <code>kernel/netkexec.c</code></li>
+			<li><code>user/lib/uhttp/uhttp.c</code>, <code>user/apps/curl/ucmd_curl.c</code>, <code>user/apps/websrv/ucmd_websrv.c</code></li>
+			<li><code>user/lib/uhttp/uhttp_cookie.c</code>, <code>user/lib/ujson/ujson.c</code> — cookie jar, JSON parser</li>
+			<li><code>user/apps/chat/chat_login.c</code>, <code>user/apps/chat/ucmd_chat.c</code> — OIDC login driver, chat client</li>
 			<li><code>tools/mock_chat.py</code>, <code>tools/qmp_chat_test.py</code> — mock server, QEMU end-to-end test</li>
 			<li><code>tools/mock_chat.py</code>, <code>tools/qmp_chat_test.py</code> — mock server, QEMU end-to-end test</li>
 		</ul>
 		</ul>
 	</section>
 	</section>

+ 20 - 19
docs/userland.html

@@ -303,7 +303,8 @@
 	<section id="pack">
 	<section id="pack">
 		<h2>Command pack</h2>
 		<h2>Command pack</h2>
 		<p>
 		<p>
-			The pack is built from the <code>UCMDS</code> list in the Makefile as
+			The pack is built from the <code>UCMDS</code> list in the Makefile
+			(one <code>user/apps/&lt;name&gt;/</code> directory each) as
 			<code>bin/&lt;name&gt;</code>, plus <code>hello</code> and the real
 			<code>bin/&lt;name&gt;</code>, plus <code>hello</code> and the real
 			<code>browser.app</code> and <code>gallery.app</code>. It is mounted
 			<code>browser.app</code> and <code>gallery.app</code>. It is mounted
 			read-only at <code>/ramfs</code>; the shell's default PATH points at
 			read-only at <code>/ramfs</code>; the shell's default PATH points at
@@ -418,26 +419,26 @@
 	<section id="sources">
 	<section id="sources">
 		<h2>Source map</h2>
 		<h2>Source map</h2>
 		<ul class="filelist">
 		<ul class="filelist">
-			<li><code>syscall.c</code>, <code>syscall_stub.S</code>, <code>syscall.h</code></li>
-			<li><code>sys_info.c</code> — kernel-state snapshots (memory, sensors, power)</li>
-			<li><code>rtc.c</code> — CMOS RTC read/write, format decoding and the 1970–2069 year window</li>
-			<li><code>process.c</code> — ELF load and spawn</li>
-			<li><code>elf.c</code> — ELF parser</li>
-			<li><code>ucmd_term.c</code> — windowed shell, scrollback, PATH</li>
-			<li><code>terminal.c</code> — privileged kernel command registry</li>
-			<li><code>install.c</code> — privileged live-image clone installer</li>
-			<li><code>ucmd_lib.h</code> — user shim</li>
-			<li><code>libc/</code> — headers, malloc, string/stdlib, setjmp/errno, stdio/dtoa, math, time and the <code>SYS_MEM_*</code> backend</li>
+			<li><code>kernel/syscall.c</code>, <code>kernel/syscall_stub.S</code>, <code>include/syscall.h</code></li>
+			<li><code>kernel/sys_info.c</code> — kernel-state snapshots (memory, sensors, power)</li>
+			<li><code>kernel/rtc.c</code> — CMOS RTC read/write, format decoding and the 1970–2069 year window</li>
+			<li><code>kernel/process.c</code> — ELF load and spawn</li>
+			<li><code>kernel/elf.c</code> — ELF parser</li>
+			<li><code>user/apps/term/ucmd_term.c</code> — windowed shell, scrollback, PATH</li>
+			<li><code>kernel/terminal.c</code> — privileged kernel command registry</li>
+			<li><code>kernel/install.c</code> — privileged live-image clone installer</li>
+			<li><code>user/ucmd_lib.h</code> — user shim</li>
+			<li><code>user/lib/libc/</code> — headers, malloc, string/stdlib, setjmp/errno, stdio/dtoa, math, time and the <code>SYS_MEM_*</code> backend</li>
 			<li><code>libc.a</code> — optional static ring-3 libc</li>
 			<li><code>libc.a</code> — optional static ring-3 libc</li>
-			<li><code>ucmd.ld</code> — ring-3 link address</li>
+			<li><code>user/ucmd.ld</code> — ring-3 link address</li>
 			<li><code>Makefile</code> — <code>UCMDS</code> and pack rules</li>
 			<li><code>Makefile</code> — <code>UCMDS</code> and pack rules</li>
-			<li><code>ucmd_*.c</code> — commands</li>
-			<li><code>ufont.c</code>, <code>ufont_ttf.c</code> — fixed-point TrueType text</li>
-			<li><code>ngui.c</code> — GUI toolkit; <code>fonts/*.ttf</code> — UI and emoji subsets</li>
-			<li><code>browser.c</code>, <code>browser_html.c</code>, <code>svg_raster.c/h</code> (+ <code>svg_test.c</code>), <code>js_browser.c/h</code>, <code>js_prelude.js</code> + <code>js_prelude.S</code>, <code>js_mu.c/h</code>, <code>third_party/quickjs/</code>, <code>gallery.c</code></li>
-			<li><code>ucmd_chat.c</code>, <code>chat_login.c</code>, <code>ujson.c</code>, <code>uhttp_cookie.c</code> — chat client</li>
-			<li><code>ucmd_wifi.c</code>, <code>wpa.c</code>, <code>wpa_crypto.c</code> — <code>wifi</code> command and the WPA2-PSK supplicant</li>
-			<li><code>ucmd_netmenu.c</code>, <code>wifi_cfg.h</code>, <code>wifi_store.c/h</code> — top-bar control panel, staged WiFi connect record and saved-network list</li>
+			<li><code>user/apps/&lt;name&gt;/ucmd_&lt;name&gt;.c</code> — commands, one directory each</li>
+			<li><code>user/lib/ufont/ufont.c</code>, <code>user/lib/ufont/ufont_ttf.c</code> — fixed-point TrueType text</li>
+			<li><code>user/lib/ngui/ngui.c</code> — GUI toolkit; <code>fonts/*.ttf</code> — UI and emoji subsets</li>
+			<li><code>user/apps/browser/browser.c</code>, <code>user/apps/browser/browser_html.c</code>, <code>user/apps/browser/svg_raster.c/h</code> (+ <code>user/apps/browser/svg_test.c</code>), <code>user/apps/browser/js_browser.c/h</code>, <code>user/apps/browser/js_prelude.js</code> + <code>user/apps/browser/js_prelude.S</code>, <code>user/apps/browser/js_mu.c/h</code>, <code>third_party/quickjs/</code>, <code>user/apps/gallery/gallery.c</code></li>
+			<li><code>user/apps/chat/ucmd_chat.c</code>, <code>user/apps/chat/chat_login.c</code>, <code>user/lib/ujson/ujson.c</code>, <code>user/lib/uhttp/uhttp_cookie.c</code> — chat client</li>
+			<li><code>user/apps/wifi/ucmd_wifi.c</code>, <code>user/lib/wifi/wpa.c</code>, <code>user/lib/tls/wpa_crypto.c</code> — <code>wifi</code> command and the WPA2-PSK supplicant</li>
+			<li><code>user/apps/netmenu/ucmd_netmenu.c</code>, <code>include/wifi_cfg.h</code>, <code>user/lib/wifi/wifi_store.c/h</code> — top-bar control panel, staged WiFi connect record and saved-network list</li>
 		</ul>
 		</ul>
 	</section>
 	</section>
 </main>
 </main>

+ 0 - 0
bootinfo.h → include/bootinfo.h


+ 0 - 0
phys.h → include/phys.h


+ 0 - 0
rootfs.h → include/rootfs.h


+ 0 - 0
rtl8821a_tbl.h → include/rtl8821a_tbl.h


+ 0 - 0
syscall.h → include/syscall.h


+ 0 - 0
version.h → include/version.h


+ 0 - 0
wifi_cfg.h → include/wifi_cfg.h


+ 0 - 0
wm_abi.h → include/wm_abi.h


+ 0 - 0
acpi.c → kernel/acpi.c


+ 0 - 0
acpi.h → kernel/acpi.h


+ 0 - 0
ahci.c → kernel/ahci.c


+ 0 - 0
ahci.h → kernel/ahci.h


+ 0 - 0
ap_tramp.S → kernel/ap_tramp.S


+ 0 - 0
ap_tramp.ld → kernel/ap_tramp.ld


+ 0 - 0
asix.c → kernel/asix.c


+ 0 - 0
asix.h → kernel/asix.h


+ 0 - 0
ata.c → kernel/ata.c


+ 0 - 0
ata.h → kernel/ata.h


+ 0 - 0
ati.c → kernel/ati.c


+ 0 - 0
ati.h → kernel/ati.h


+ 0 - 0
backlight.c → kernel/backlight.c


+ 0 - 0
backlight.h → kernel/backlight.h


+ 0 - 0
blit.c → kernel/blit.c


+ 0 - 0
blit.h → kernel/blit.h


+ 0 - 0
blkdev.c → kernel/blkdev.c


+ 0 - 0
blkdev.h → kernel/blkdev.h


+ 0 - 0
bootcon.c → kernel/bootcon.c


+ 0 - 0
bootcon.h → kernel/bootcon.h


+ 0 - 0
ccmp.c → kernel/ccmp.c


+ 0 - 0
ccmp.h → kernel/ccmp.h


+ 0 - 0
ccmp_test.c → kernel/ccmp_test.c


+ 0 - 0
cirrus.c → kernel/cirrus.c


+ 0 - 0
cirrus.h → kernel/cirrus.h


+ 0 - 0
cpu.c → kernel/cpu.c


+ 0 - 0
cpu.h → kernel/cpu.h


+ 0 - 0
cros_ec.c → kernel/cros_ec.c


+ 0 - 0
cros_ec.h → kernel/cros_ec.h


+ 0 - 0
cursor_shape.h → kernel/cursor_shape.h


+ 0 - 0
dbg.c → kernel/dbg.c


+ 0 - 0
dbg.h → kernel/dbg.h


+ 0 - 0
dhcp.c → kernel/dhcp.c


+ 0 - 0
dhcp.h → kernel/dhcp.h


+ 0 - 0
disk.c → kernel/disk.c


+ 0 - 0
disk.h → kernel/disk.h


+ 0 - 0
display.c → kernel/display.c


+ 0 - 0
dns.c → kernel/dns.c


+ 0 - 0
dns.h → kernel/dns.h


+ 0 - 0
e1000e.c → kernel/e1000e.c


+ 0 - 0
e1000e.h → kernel/e1000e.h


+ 0 - 0
ec.c → kernel/ec.c


+ 0 - 0
ec.h → kernel/ec.h


+ 0 - 0
ehci.c → kernel/ehci.c


+ 0 - 0
ehci.h → kernel/ehci.h


+ 0 - 0
elf.c → kernel/elf.c


+ 0 - 0
elf.h → kernel/elf.h


+ 0 - 0
entry.S → kernel/entry.S


+ 0 - 0
fat.c → kernel/fat.c


+ 0 - 0
fat.h → kernel/fat.h


+ 0 - 0
fatdetect.c → kernel/fatdetect.c


+ 0 - 0
fatdetect.h → kernel/fatdetect.h


+ 0 - 0
fatformat.c → kernel/fatformat.c


+ 0 - 0
fatformat.h → kernel/fatformat.h


+ 0 - 0
fbtext.c → kernel/fbtext.c


+ 0 - 0
fbtext.h → kernel/fbtext.h


+ 0 - 0
font_8x8.c → kernel/font_8x8.c


+ 0 - 0
font_8x8.h → kernel/font_8x8.h


+ 0 - 0
format.c → kernel/format.c


+ 0 - 0
gfx.c → kernel/gfx.c


+ 0 - 0
gfx.h → kernel/gfx.h


+ 0 - 0
gfxbench.c → kernel/gfxbench.c


+ 0 - 0
gpu.c → kernel/gpu.c


+ 0 - 0
gpu.h → kernel/gpu.h


+ 0 - 0
i2c.c → kernel/i2c.c


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff