Commit Graph

88 Commits

Author SHA1 Message Date
Pooya Parsa
3b6a91ea67 guest: add a docker shim to the Debian image that installs Docker on first use, configures it for the kernel (no netfilter, bridge, BPF or cgroup namespaces; data root off the overlay; crun without a device cgroup) and starts the service 2026-11-19 22:13:48 +00:00
Pooya Parsa
85f53a1835 guest: run Debian's init scripts under sysv-rc from kw-init, so that a package's service starts on install and at boot 2026-11-19 21:24:23 +00:00
Pooya Parsa
1c1725a182 guest: install uv and uvx on first use, as the kw layer's shim does for node and bun 2026-11-19 20:55:22 +00:00
Pooya Parsa
17cbb535ba web: add an Open Graph image and link preview tags 2026-11-19 20:23:23 +00:00
Pooya Parsa
1fcc7e6447 Run the distro images as a default user (user, 1000:1000) with passwordless sudo, load the kw profile in every interactive shell, and move ~/README from the page into the images
Sessions and the console run as user in /home/user on Debian and Alpine (doas with a sudo shim there); the host asks for another user with SpawnOptions.user, the CLI's --user or kw.user=. The shims, the command-not-found installers, poweroff and the page's launcher and demos reach root through sudo, and apt, apt-get and apk typed by the user are aliases to it. /usr/lib/kw/shrc gives nested shells, sudo -s and sudo -i the prompt, the command-not-found handler and PATH that only login shells had. The framebuffer, input and sound devices are group-accessible, and host mounts show as the user's.
v0.2.0-261119-1fcc7e6
2026-11-19 20:11:42 +00:00
Pooya Parsa
abdb84df66 web: fit the iOS home screen app to the screen: black status bar style (iOS 26+ leaves the bottom unshown with black-translucent), the layout viewport's height, room above the home indicator and below the top fade, and no status line while the keyboard is up 2026-11-19 19:14:00 +00:00
Pooya Parsa
97d7945565 web: inline Doom's script and patches in doom.ts, and fix its keyboard on Debian, where tcc 0.9.27 linked fbDOOM's weak I_GetEvent stub v0.2.0-261119-97d7945 2026-11-19 18:33:17 +00:00
Pooya Parsa
d91e188b06 web: add open and xdg-open in the guest, which open a URL in the preview or a new tab after a confirm 2026-11-19 18:30:20 +00:00
Pooya Parsa
7889637620 Add host commands: functions of the host that the guest runs as programs (kwcmd) 2026-11-19 18:30:20 +00:00
Pooya Parsa
76191cee95 ci: write the GitHub release notes as a compare link from the previous tag 2026-11-19 18:08:34 +00:00
Pooya Parsa
d282b8604a web: add Claude Code, fx, Bun, Go and Rust demos, and turn the Python and Node.js demos into REPLs 2026-11-19 17:58:30 +00:00
Pooya Parsa
7de755a631 web: keep the options in localStorage instead of the URL, and drop ?demo= 2026-11-19 17:42:00 +00:00
Pooya Parsa
77c27eca47 agents: record the region-member and compile-cost measurements on Claude Code 2026-11-19 17:34:36 +00:00
Pooya Parsa
f13df7328d a64: count where compiled passes go next (Jx.next_by) in stats builds 2026-11-19 17:34:36 +00:00
Pooya Parsa
3699f3aee4 web: move the saved session to kwsnap:session-v2 and delete older versions 2026-11-19 17:31:41 +00:00
Pooya Parsa
943efbe2e0 agents: record the Claude Code slow-path profile and the tuning that did not pay 2026-11-19 17:24:31 +00:00
Pooya Parsa
2ce4c972ef guest: build the Alpine image from stock packages, without the kwemu rebuild v0.2.0-261119-2ce4c97 2026-11-19 17:07:49 +00:00
Pooya Parsa
c3d250f696 guest: fall back to Alpine's mirror when an alpine-opt source has the wrong sha512 2026-11-19 16:54:30 +00:00
Pooya Parsa
c78d4b3493 test: profile CPUs and worker mode on Node, and document both profilers
test/profile.ts is /profile.html's twin on Node: the same workloads and scores per configuration, with the event loop's lag instead of frame gaps. testing.md describes both and keeps the 2026-11-19 results (Chrome, Safari, Node); js.md and the README recommend worker mode and 4 CPUs for hosts; status.md lists the near-4x scaling limit and the Safari slowdown.
2026-11-19 16:45:47 +00:00
Pooya Parsa
a6ccdd28fd web: update the dialog's shortcuts and move font size to the Guest tab 2026-11-19 16:39:08 +00:00
Pooya Parsa
97ec5e55c5 web: boot in a worker on the suggested CPUs by default, and add /profile.html
Worker mode is the default where the page is cross-origin isolated; a default worker that does not start reloads once on the page's thread. The CPUs default to the suggested count: half the threads, at most 4 on desktops and 2 in Firefox, one on phones and in WebKit (Safari ran parallel work slower with every CPU). The CPUs slider goes up to the device's threads and turns red past the suggestion. /profile.html boots each configuration, times everyday guest work and frame gaps, and checks the browser's own threads.
2026-11-19 16:36:29 +00:00
Pooya Parsa
6065c4397c kernel: allow 16 CPUs on the SMP kernel
kw_smp.config sets NR_CPUS to 16 (the wasm SMP patch). A boot on fewer CPUs costs only a few KiB of static per-CPU arrays: the possible CPUs are the ones the host offers. kwtest's spread check starts two threads per CPU up to 32, so it covers more than 8 CPUs.
2026-11-19 16:36:29 +00:00
Pooya Parsa
9f6353b7b6 web: drop the fx stand-ins and the libfx demo, rename ?smp= to ?cpus=, and refresh the demos 2026-11-19 16:04:23 +00:00
Pooya Parsa
b7d1c6d8bf cli: rename --smp to --cpus 2026-11-19 16:04:15 +00:00
Pooya Parsa
3baa7d7e9d guest: install fx, claude, opencode, node and bun on first use from the kw layer's shims 2026-11-19 16:04:15 +00:00
Pooya Parsa
0e0dbfa312 docs, ci: the distroless bundle, distro images and their release assets 2026-11-19 14:46:14 +00:00
Pooya Parsa
a06ccb6a49 web: fetch the kernel and distro images at build time, default to Debian
?distro= picks an image (or none, the base shell); images are served with
Range and content-addressed names. The Doom demo's fbdoom build and patches
move under web/. Reset of the data disk survives a reload.
2026-11-19 14:46:14 +00:00
Pooya Parsa
be940d2c91 sdk: boot distro images from a file or over HTTP
createKernel({ distro }), fetchDistro() and the CLI's --distro; the npm
package ships the distroless bundle only. HttpBase streams the image's
prefetch and reuses cached chunks after one validation.
2026-11-19 14:46:13 +00:00
Pooya Parsa
97f8d9e5f1 guest: distroless base initramfs and separate Alpine and Debian erofs images
The bundle (unkernel.wasm) carries a small busybox initramfs that mounts a
distro image labelled kwroot under an overlay root, or starts the base shell
without one. guest/ replaces kernel/guest/: base/, distro/NAME/, shared lib/
and tools/. Images are laid out for their boot by a patched mkfs.erofs and a
recorded boot file list, with a prefetch hint in the image header. Debian
bakes its apt lists and cache, a set of everyday packages and a
command-not-found installer.
2026-11-19 14:46:13 +00:00
Pooya Parsa
21ef47685a kernel: enable erofs with zstd for the distro images 2026-11-19 14:46:13 +00:00
Pooya Parsa
9cff903e32 docs: drop finished SMP history and stale issues from status.md 2026-11-19 08:09:06 +00:00
Pooya Parsa
07024216b7 chore: update docs 2026-11-19 07:58:25 +00:00
Pooya Parsa
c087d31856 Move the kwemu test guests from guest/ to test/guest/ 2026-11-19 07:37:16 +00:00
Pooya Parsa
bb8756ec67 update docs 2026-11-19 07:30:14 +00:00
Pooya Parsa
b5b75b53de Run WASI programs from the guest on the host's wasm engine (prototype)
binfmt_misc hands a wasm module to kwwasi (kernel/guest/kwwasi.c), which
connects to the host over AF_VSOCK port 1021 and serves the program's
file I/O with its own descriptors, cwd and credentials. The host
(js/core/wasi-exec.ts, serveWasiPrograms(), the CLI's --wasi) compiles
the module once and runs each program in a worker of its own
(js/core/wasi-program.ts) with WASI preview 1, or preview 0 adapted.
Requests cross through a SharedArrayBuffer where one can be used, else
with JSPI and messages. kwwasi sends a module only when the host has not
compiled it for that file, resolves paths against the cwd or / by what
exists, and maps open flags from their asm-generic values to the
guest's.

alpine.sh builds kwwasi and kw-binfmt.sh registers it; no image with
them has been built yet, so test/wasi-binfmt.ts brings kwwasi in through
a mount.
2026-11-19 07:08:32 +00:00
Pooya Parsa
0deeb1b541 Bump the package to 0.2.0, the first release of the aarch64 guest 2026-11-19 00:12:56 +00:00
Pooya Parsa
ff43220c6b docs: describe the aarch64 system and its full test matrix 2026-11-19 00:12:52 +00:00
Pooya Parsa
5190bf4a86 kwtest: pin the threads of lse smp and excl smp to their own CPUs
Both checks last tens of milliseconds. When fork placement put both
threads on one CPU (the other one busy for a moment), they could end
before the balancer's first pull, one or two ticks at HZ=100, and the
check failed on its CPU mask: 3 of 35 runs with --smp 2. Each thread
now pins itself to CPU id % online (the main thread restores its mask
afterwards); move: still checks the spreading. 40 runs on 2 and 4 CPUs
pass.
2026-11-19 00:12:48 +00:00
Pooya Parsa
82e3098460 web: refuse a release bundle built for another kwemu ABI
A page build takes the newest release's bundle. Until a release is cut
from this tree that is a riscv64 bundle (kwemu ABI 8), which does not fit
the aarch64 page. fetchKernel() now reads the kernel's kw_abi_version()
(kernelInfo() in bundle.mjs) and fails on a release whose number is not
include/kw_emu.h's; a local bundle only gets a warning.
2026-11-19 00:12:48 +00:00
Pooya Parsa
20f9de7add kernel: build abitest into the test archive, and complete the build path's checks
alpine.sh builds kernel/guest/abitest.c (freestanding) beside kwtest and
kwbench, and the release workflow runs it on the UP kernel and on 2 CPUs.
Its SA_RESTART check waits for the parent's alarm with a sleep instead of
a busy loop, which the JIT finished before the alarm.

setup.sh checks xz and sha512sum (the package rebuild's toolchain and
source sums) and reports qemu-aarch64 (optional, zig build test's
comparison). build.sh's disk check also covers alpine-opt.sh, kw-path.sh
and the bwrap shim, which alpine-disk.sh now installs like the initramfs.
2026-11-19 00:12:48 +00:00
Pooya Parsa
3599bf48d6 web: make the launcher demos right for the aarch64 guest
The demos' texts called the guest riscv64 (and its CPU a RISC-V
emulator); they now say aarch64. The SQLite demo read the riscv ISA
string from /proc/cpuinfo; it now loads the Features line and groups it
(FP and SIMD, crypto, CRC, LSE atomics). Doom's first run builds in
under a minute, which its README and tile say.

Every visible demo's run.sh was run on the aarch64 guest through the SDK
(2026-11-18): .agents/web.md lists the first-run times. The stand-ins
and qemu-user (x86_64, riscv64, i386, arm) were rechecked too.
2026-11-19 00:12:48 +00:00
Pooya Parsa
f6cf124877 kernel: build Ubuntu Base 26.10 arm64, and run it in the Ubuntu demo
Ubuntu 25.10 and later were out of reach on riscv64 (RVA23 with V); the
arm64 baseline is ARMv8.0, so the newest release runs. Pin
ubuntu-base-26.10-base-arm64.tar.gz from its versioned release directory
for kernel/build.sh ubuntu and the page's Ubuntu demo, which was still
fetching the riscv64 24.04.5 tarball. The demo re-extracts a tree whose
bash is not an aarch64 program, and skips the page's download only for
an aarch64 tree.

Checked 2026-11-18: the disk boots to kw-init's shell (glibc 2.44, apt
3.3.3), apt-get update and installs work, systemd 261 boots to running
with no failed units, and the demo's chroot runs apt from the pushed and
from a self-fetched tarball.
2026-11-19 00:12:48 +00:00
Pooya Parsa
497d7b7fe8 kernel: remove the DOSBox packaging and the hidden Windows 3.1 demo
kernel/guest/dosbox and dosbox-build/ waited for prebuilt guest packages
that are not coming; the launcher's Windows 3.1 demo (web/src/demos/windows.ts)
existed only for them. fbDOOM and the hidden FreeDOS demo stay; status.md
says where they stand on the aarch64 guest.
2026-11-19 00:12:48 +00:00
Pooya Parsa
6d1ade15bb data disk: reset a disk written by another guest architecture, keeping /root
A data disk records the architecture of the image that uses it. One
written by another architecture (a riscv64 disk on the aarch64 guest)
loses its installed packages and system changes once, with a notice on
the console and the page; root's home is kept.
2026-11-19 00:12:42 +00:00
Pooya Parsa
a1acf312e0 Remove the riscv64 CPU, reset the kwemu ABI to 2
The riscv64 interpreter, its JIT emitter, test guests and drivers are
gone; kwemu keeps the ISA-neutral core (MMU, TLBs, code marking, block
cache, JIT core) and the A64 CPU. The arm64 user ABI is one kernel
patch, the last of the series, and the contract between the kernel and
kwemu starts again at KW_ABI_VERSION 2.
2026-11-19 00:12:39 +00:00
Pooya Parsa
81ecb6f56d a64: translate atomics inline, make cold code cheaper
Exclusives, LDAR/STLR and the LSE atomics run inline (wasm atomics on
SMP), as do DC ZVA, barriers, loads into XZR and USHL/SSHL. The
code-page filter scans the write TLB only when a mark slot changes
state, and runOps has one copy of the path that leaves a block.
2026-11-19 00:12:38 +00:00
Pooya Parsa
3414200e47 a64: translate AdvSIMD, AES, PMULL and SHA with wasm SIMD
With a host that compiles wasm SIMD (a JIT host capability; the scalar
form remains as the fallback), V registers live in v128 locals and the
integer AdvSIMD ops, AES rounds, PMULL and the SHA families are
translated inline. The image's libcrypto picks its code paths from
HWCAP again, and SHA512 is advertised by default.
2026-11-19 00:12:38 +00:00
Pooya Parsa
1f9f0c5e5f a64: keep compiled code across op-arena resets, translate scalar FP inline
The op arena is a nursery plus a tenured ring that holds the ops of
compiled blocks, so a reset keeps compiled modules and every block's
compile countdown; the block table replaces the entry with less
progress. Scalar FP arithmetic and conversions run inline where the
result is exact. Marking more chunks of a code page that is already
marked no longer scans the write TLB.
2026-11-19 00:12:38 +00:00
Pooya Parsa
0169bdbb57 a64: call the interpreter from compiled code, translate the frequent generic ops
Ops the JIT does not translate no longer end a compiled block: compiled
code calls the reference interpreter for them through the kernel's
function table (a JIT host capability). FMOV, UMOV/INS/DUP, MOVI, vector
logic, MRS of FPCR/FPSR/NZCV/DCZID and FCMP are translated inline.
2026-11-19 00:12:38 +00:00
Pooya Parsa
5f3a2b3688 Rebuild the guest packages for aarch64, add ~/.local/bin and the stand-ins
busybox, zlib, openssl and apk-tools are rebuilt from pinned aports
commits for kwemu and installed by default. ~/.local/bin is first on
PATH for login shells and kwtty's programs, and the page writes fx,
claude and opencode stand-ins there that install the real program on
first use.
2026-11-19 00:12:38 +00:00