100 Commits

Author SHA1 Message Date
Pooya Parsa
307de13f37 kernel: loadable modules (CONFIG_MODULES, off in the default kernel): a module is a wasm side module in an ELF .ko that the generic loader and the kmod tools read, built by Kbuild (kernel/build.sh modules, kw_modules.config with iso9660 and Bluetooth as modules), instantiated by the host against the kernel's memory and table on every CPU and again after a restored snapshot, and refused when its kernel build or configuration differs; the SMP kernel with modules reports 7.3.4-smp+ so one root holds both module sets 2026-11-30 08:51:33 +00:00
Pooya Parsa
e8f60af86a web: redesign the top bar's right side as applets, each a status item with its own panel that opens on hover or click: CPU, Memory, Disk, Network (with Tailscale, a mode row and a sketch of the traffic's path), Ports, Display (the theme and the GPU), Sound and media (with a live microphone and camera indicator), Bluetooth, Serial, USB and Transfers (with the clipboard); bigger spacing, icons on a plate over the wallpaper, glassy popovers, and a Kernel log that opens at its bottom 2026-11-29 19:27:49 +00:00
Pooya Parsa
3729b2e6e7 Measure the OPFS data disk's extent files while it opens, so the page's attach line shows the bytes they hold instead of 0 KiB 2026-11-29 17:45:38 +00:00
Pooya Parsa
d8e442a641 Keep the page's data disk in OPFS in worker mode: OpfsDisk (8 MiB extent files), the SDK's backend option for the data disk, a one-way migration from IndexedDB, a storage quota block and a free Disk size in Settings, and a question in a second tab instead of an in-memory copy 2026-11-29 17:37:06 +00:00
Pooya Parsa
495fe30a91 Add guest USB on WebUSB: kwusb (a USB host controller whose transfers the host serves, with usbfs and the FTDI, CP210x, CH341 and PL2303 serial drivers), the SDK's usb option and vm.usb with a fake test device, and a USB devices section in the page's Settings 2026-11-29 15:43:56 +00:00
Pooya Parsa
42b91da2a8 Add guest Bluetooth on Web Bluetooth: kwbt (an HCI transport, hci0 while a controller is attached), the SDK's bluetooth option and vm.bluetooth with an emulated LE controller, Bluetooth and Serial ports sections in the page's Settings with Terminal buttons, and the Bluetooth and Serial Monitor launcher apps 2026-11-29 15:22:20 +00:00
Pooya Parsa
ab334389af Add guest serial ports on Web Serial: kwserial (/dev/ttyACM0..3), the SDK's serial option and vm.serial, Connect in the page's Settings and from a toast, and the Thonny and GTKTerm launcher apps 2026-11-29 13:31:16 +00:00
Pooya Parsa
ed872875f2 Fetch a distro image's warm set only once the guest reads in it, and leave apt's srcpkgcache.bin out of Debian's 2026-11-29 12:29:20 +00:00
Pooya Parsa
68f0b98048 js: run the Tailscale guest address scripts as root, so tailscale0 is set up on the distro images 2026-11-29 12:09:15 +00:00
Pooya Parsa
a9c8aef517 js: add Tailscale exit nodes, and rework the page's Tailscale settings
With net.tailscale.exitNode (--tailscale-exit-node, setExitNode() at run
time) a tailnet device that offers 0.0.0.0/0 takes all the guest's other
IPv4 traffic and its DNS in place of the backend; while it is not usable
that traffic is refused. WireGuard's source check is now the longest
prefix across peers. The page lists the tailnet's devices, picks the
exit node from a select box in Settings and the top bar panel, and shows
a set-up node's status and live controls apart from the setup form. The
README gains a section on joining a tailnet.
2026-11-29 11:16:22 +00:00
Pooya Parsa
4b713a5aed Merge branch 'main' into tailscale 2026-11-29 10:24:54 +00:00
Pooya Parsa
1b229902b2 Add a guest microphone and camera: kwsnd capture, kwcam (V4L2, raw and host-encoded H.264), and camera frames named to the kwva encoder
Microphone: kwsnd gains a capture substream fed by the host (SDK option
soundIn, the page's Microphone setting and ?mic=0, the CLI's
--sound-in-wav and --sound-in).

Camera: kwcam is a V4L2 capture device (/dev/video0) fed by the host: I420,
NV12 and YUYV at 320x240 to 1280x720, and H.264 encoded by the host's
WebCodecs encoder where it has one, with bitrate, GOP and key frame
controls (SDK option camera, the page's Camera setting and ?cam=0, the
CLI's --camera). The base's rc writes the udev database entry of
/dev/video*, so programs that list cameras through libudev find it.

kwva (protocol 5): an encode whose input surface is a camera buffer's
dma-buf names the frame to the host instead of sending its pixels, and
pixels an app writes into an exported surface reach the host (put).
2026-11-29 10:23:01 +00:00
Pooya Parsa
d382f7fa9b js: add a pure-JS Tailscale network device (work in progress)
The guest joins a tailnet from Node or the page: ts2021 control over
WebSocket, DERP relays, WireGuard and the packet filter in JS, loaded as
a separate chunk only when the option is used. SDK net option, CLI
--tailscale* flags and a page panel. Relay only; exit nodes, IPv6 and
real peer traffic are not covered yet.
2026-11-28 22:06:18 +00:00
pi0x
0e4708d23c js: give a Windows host's mounted files and directories the execute bits (#70)
Node on Windows reports no execute bits (0o666, or 0o444 for a read-only
file, directories included), so the guest could not enter a directory of
a nodeFs mount (EACCES) nor run a script or binary in it, and its chmod
cannot add the bit. On win32, nodeFs now adds x where r is, as WSL's
drvfs shows them (hostMode); other hosts' bits are unchanged.

Co-authored-by: Pooya Parsa <pooya@pi0.io>
Co-authored-by: ARNO <arnochen101@gmail.com>
2026-11-28 21:34:51 +01:00
pi0x
add6ae2d77 js: warn when --cpus asks for more CPUs than the host has threads (#71)
The CLI boots any count from 1 to 32, given by --cpus or taken from a
snapshot. Above os.availableParallelism() the CPU threads take turns,
and a CPU that waits for another (an IPI, a TLB shootdown) waits until
the host schedules that one. It still boots, now with a warning on
stderr. The --help text and js.md say so.

Co-authored-by: Pooya Parsa <pooya@pi0.io>
Co-authored-by: xfy <i@rua.plus>
2026-11-28 21:33:39 +01:00
pi0x
277618959a js: keep host file systems in worker-mode snapshots taken with commit (#62)
* js: keep host file systems in worker-mode snapshots taken with commit: the owner saves its 9p servers' state while the worker holds the kernel at its consistent point, and fails the commit (the kernel goes on) while a request is unanswered or packets it sent have not reached the kernel (the worker counts those it delivered, snapshot-held's vsockIn); a restore in worker mode serves the mounts on the owner before the boot and passes the connections to keep to the worker's device (vsock.raw.keep)

Co-authored-by: Michael Lohr <michael@lohr.dev>
Co-authored-by: Claude <noreply@anthropic.com>

* js: describe host file systems in worker-mode snapshots where the docs still said inline only: VsockSnapshot.mounts, createKernel's restore, MountTable.snapshotBlocker() and the WASI binfmt test's unmount; rewrap the docs

---------

Co-authored-by: vibepodml[bot] <319756436+vibepodml[bot]@users.noreply.github.com>
Co-authored-by: Michael Lohr <michael@lohr.dev>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Pooya Parsa <pooya@pi0.io>
2026-11-28 21:22:33 +01:00
pi0x
bdebd1d538 vk: free the readback staging buffer when mapAsync fails (#65)
readTexture destroyed its MAP_READ staging buffer only after a
successful map, so a rejected mapAsync (a lost device, a validation
error) leaked it. Destroy it in a finally block, and check both the
failing and the succeeding path in test/vk.test.ts.

Co-authored-by: Pooya Parsa <pooya@pi0.io>
Co-authored-by: Niklas Olsson <niklas.olsson@hotmail.co.uk>
2026-11-28 21:13:42 +01:00
pi0x
2262e13e61 js: connect routed names on other ports through the inner backend (#66) 2026-11-28 21:12:59 +01:00
pi0x
66be47dd47 js: recognise the distros' ⇒ prompt in the console router (#68)
ConsoleRouter marks user space on a shell prompt that ends in #, $, %
or >, but the Alpine and Debian images' prompt (kw-prompt.sh) ends in
"⇒ ", so a prompt that is user space's first output went unnoticed and
the page fell back to its 300 ms timer. Match ⇒ as well, as
guest/tools/vm-run.ts already does, and test the router on both
prompts without a boot.

Co-authored-by: Pooya Parsa <pooya@pi0.io>
Co-authored-by: João Lucas de Oliveira Lopes <jlucaso@hotmail.com>
2026-11-28 21:11:52 +01:00
pi0x
fc88dc0493 js: fall back to __heap_base when the kernel has no _end (#67)
The initrd size check reads the export _end, which Linux's linker script
defines. A kernel linked without a script exports only wasm-ld's
__heap_base, and booting it with an initrd failed with "missing export
_end". Upstream's kernels export _end and keep using it.

Co-authored-by: Pooya Parsa <pooya@pi0.io>
Co-authored-by: Tsiry Sandratraina <tsiry.sndr@rocksky.app>
2026-11-28 21:10:59 +01:00
Pooya Parsa
c7ad16303d vk: fill the gaps games, mpv and Vulkan 1.2 callers hit (#32, #33) and add texel buffers: timeline semaphores are offered (values reached at the submit as fences are, a queue wait for a value nothing has signalled holds that submit and the later ones in the ICD until it is given), with imageless framebuffers, separate depth/stencil layouts, multiDrawIndirect, HOST_CACHED on the host-visible memory type, image_format_list and swapchain_mutable_format, and one more inter-stage location for wgpu-hal; the translator marks storage buffers a module never writes read-only, reflects only the resources an entry point reaches, drops OpLine, folds OpSpecConstantOp on integers, booleans and composites, lowers isinf/isnan and int[1] sample masks; the host sizes uniform bindings in 16-byte steps, copies block-compressed images in whole blocks and between size-compatible formats, binds placeholders for unwritten textures and samplers, takes storage bindings at unaligned offsets in dispatches through a scratch copy, rewrites indexed triangle fans as lists and no longer truncates sizes of 2 GiB and more; texel buffers (VkBufferView, both descriptor types) run as a storage buffer of words plus a per-view parameter block, decoded by the view's format in WGSL; the base profile exports LIBGL_KOPPER_DISABLE=1 so Mesa's zink stays off kwvk; mpv's gpu-next (yuv420p and rgb24), DDNet with its own SPIR-V and vkd3d's texel-buffer pipelines run; checks in test/vk (vk-timeline, vk-texel, host cases, translator shaders) and a games stage for the test disk 2026-11-28 13:05:33 +00:00
Pooya Parsa
bc6e5ba6a0 net: forward the guest's pings to an optional backend ping hook 2026-11-27 23:44:46 +00:00
Néstor
34761073e0 js: carry the guest's UDP through the direct and Wisp backends (#47) 2026-11-28 00:12:57 +01:00
Pooya Parsa
30aa355637 js: keep 9p fids consistent across removes and renames 2026-11-27 23:11:06 +00:00
Pablo
30d35d0a80 js: hard links on host file systems (Fs.link, 9p Tlink) (#46)
* js: hard links on host file systems: Fs gets an optional link(target, path), which the 9p server calls for Tlink of a regular file (it answered EPERM always); nodeFs makes them with fs.link, refusing a source that is not a regular file and undoing a link whose new name is not the file it lstat'ed (Darwin's link(2) follows a symlink, which would name a file outside the directory); MemoryFs still answers EPERM, as do a directory, a symlink and a read-only mount, and a fid restored without its file answers ESTALE; package managers that put a file in place with a link (uv's lock and cache, cargo, pnpm's store) work on a nodeFs mount and on tabc's volumes; tests in 9p.test.ts and api.test.ts (ln in the guest, one inode on the host)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* js: nodeFs runs a hard link alone, so the guest cannot rename, remove or symlink a source or a name into place during it (on Darwin, link(2) follows a symlink); link uses the bigint lstat; a restore leaves a file stale that was open under a removed name even when a hard link still names it (documented); the api hard-link test uses its own directory (below scratch it broke the vm.mount() test's listing) and no longer checks a directory link, which the guest's VFS refuses before 9p; the 9p test removes its directories and checks that a link and a rename do not overlap

* js: nodeFs's hard link checks that every directory on both its paths is a directory, not a symlink (ESTALE), and its lock is per host directory with waits and holds bounded to 10 s (EAGAIN), so a hung rename no longer stalls links and renames of every mount; tests for both, the Tlink test's title says EROFS, the api test unmounts in t.after; Fs.link says the target's type may have changed since the walk

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Pooya Parsa <pooya@pi0.io>
2026-11-27 23:25:41 +01:00
Pooya Parsa
d80c033106 net: drop the default Wisp server from the SDK
The SDK named the project's Wisp server (DEFAULT_WISP_SERVERS), and the
Node entry sent Origin: http://localhost to pass that server's allow
list (NODE_WISP_HEADERS). The server accepts only the page's origins,
so both are gone: wispBackend() takes the caller's server, and Node
sends handshake headers only when `headers` asks for them. The page
keeps wss://wisp.unkernel.dev:6680/ as its own default (web/src/net.ts).

The live Wisp test takes its server from UNKERNEL_TEST_WISP.
2026-11-27 22:24:02 +00:00
Pooya Parsa
287e41464f net: document Wisp's limits, add a lookup option, move to wisp.unkernel.dev
The README and the SDK docs now say what a guest sees over Wisp: no
half-close (a client that waits for the server to see end of file
hangs), placeholder addresses for every name, no connect
acknowledgement. wispBackend() takes a `lookup` resolver for real
addresses, and its fake address table now evicts the least recently
used name instead of wrapping. The default server is
wss://wisp.unkernel.dev:6680/.

The live Wisp test waited for its marker anywhere in the screen, so the
shell's echo of the command satisfied it; it now waits for the marker at
the start of a line.

Refs #44
2026-11-27 22:15:52 +00:00
Pooya Parsa
08af7d9fe2 web: load the kernels, renderers and distro images from the release mirror
A page build with a release that carries page.json downloads only that
and points the page at mirror.unkernel.dev's copy of the release assets
(CORS, Range, immutable); nothing is copied into the output. The release
workflow now also publishes a gzipped copy of every .wasm, which the SDK
gunzips when a body starts with gzip's magic (the mirror sends files as
they are).
2026-11-27 16:10:47 +00:00
Pooya Parsa
87fcbbf991 wasi: close preview 1 gaps: sockets, wasi-threads, guest clocks and CPU time, fd_allocate
Sockets: sock_accept, sock_recv, sock_send and sock_shutdown on sockets the program inherited, with socket file types, poll and non-blocking; KWWASI_TCPLISTEN=ADDR:PORT[,...] opens listening TCP sockets at descriptors 4, 5, ... (exit 126 when one is already open); a write to a socket whose peer went away is EPIPE, not SIGPIPE.

Threads: modules that import wasi.thread-spawn and a shared env.memory run on the shared path, each wasm thread with a worker, a channel and a kwwasi connection of its own (a kwwasi pthread sharing the process's descriptors), so a thread blocked on stdin holds up no other; proc_exit or a trap in any thread ends the program; the message path refuses such a module with exit 126.

Clocks: realtime and monotonic follow the guest's (kwwasi sends both readings at START, no request per call); the CPU clocks are the worker's CPU time on Node, the process clock covering every thread through worker.cpuUsage(); unknown clock ids are EINVAL and the resolution is the timer's measured step.

Files: fd_allocate; fd_fdstat_set_flags refuses a sync flag change with ENOTSUP; more Linux errnos mapped; KWWASI_CWD=cwd resolves every path without a leading "/" from the cwd, with no guessing.

A wasm64 module is refused with exit 126, and a sleep on the message path no longer ends a fraction of a millisecond early. The kwwasi protocol is version 3. test/wasi-binfmt.ts runs its guest commands as root and covers the above.
2026-11-27 12:53:50 +00:00
Pooya Parsa
cec0a49f5d vk: make a wgpu app's graphics pipelines for the negative viewport height it draws with: the ICD sends the app's engine name in the hello, and for wgpu-hal the host translates vertex stages without the y flip and builds that variant in vkCreateGraphicsPipelines (it was built in the first submit, after an unused flipped one); the other orientation is a variant at draw time, logged once per connection with the engine's name; the host check draws both ways after destroying the shader modules and runs its SPIR-V suite with the toolchain's glslc 2026-11-25 14:31:55 +00:00
Pooya Parsa
e16c37ad6f vk: let wgpu apps (Zed) create a device and draw: the ICD reports maxFragmentCombinedOutputResources as the sum of storage buffers, storage images and color attachments (8 made wgpu derive 3 color attachments) and every bind group as a descriptor set (a layout with all of them and push constants fails in vkCreatePipelineLayout), and a pipeline's stages keep their shader module, so a variant made at draw time translates it after the app destroyed it 2026-11-25 14:02:24 +00:00
Pooya Parsa
1f0648d812 va: guest VA-API on the browser's WebCodecs (kwva): a libva driver in the base's kw layer sends each picture over vsock to a VideoDecoder or VideoEncoder on the page (createKernel({ va }), on by default on Debian, ?va=0); it decodes VP9, H.264, AV1 and HEVC (HEVC not yet run in a browser), encodes VP9, reads pictures back as exact NV12, exports surfaces as dmabufs of virtio-gpu resources and draws a decoded VideoFrame into a BGRX surface on the GPU (mpv --hwdec=vaapi --vo=dmabuf-wayland: 1080p H.264 at 30 fps on an M4 Pro) 2026-11-25 13:09:05 +00:00
Pooya Parsa
d21b013897 js: in worker mode on the shared transport, send vsock packets for the guest as one transferred message while the kernel waits idle, instead of copying them twice through the ring (a cold 26 MB read from a host mount: 125 to 102 ms); the worker counts delivered messages in VS_ACK so the stream keeps its order (#16) 2026-11-24 21:40:00 +00:00
Pooya Parsa
7d74d40f94 vk: run llama.cpp's quantized models: the translator keeps barriers in uniform control flow past invocation-dependent continues, reads num_workgroups and workgroup_id without naga's private copy, runs workgroups wider than the device's limit as virtual invocations and lowers subgroup builtins of shaders without subgroup operations; a compute pipeline WebGPU refuses as read_write is made with its read-only buffers kept; the subgroup size is agreed in the hello (32, KWVK_SUBGROUP_SIZE: Qwen2.5 0.5B Q4_K_M 75 to 22 ms a token on an M4 Pro); timestamp queries resolve once at the read and never go backwards 2026-11-24 21:21:48 +00:00
Pooya Parsa
5a4ba76d79 js: export the page's Web Audio sink as createAudioOut() from unkernel/web (#17)
web/src/audio.ts becomes js/web/audio.ts. It creates no AudioContext
before the page has had a gesture, holds the latest 10 s of what plays
until then (a clip that has ended plays whole, a stream joins live), and
has state, onChange, muted, resume() and close() for a page's control.
test/audio.test.ts runs the worklet and the sink without a browser.

Closes #17
2026-11-24 20:41:32 +00:00
Pooya Parsa
0da40f0a35 gl: let a WebGL error drop one call instead of putting the guest's context in error (#27)
virglrenderer builds with -Dcheck-gl-errors=false and patch 0019: a host GL error is logged and counted (stats.glErrors) and the context goes on; GL_OUT_OF_MEMORY stays fatal.
2026-11-24 18:12:50 +00:00
João Lucas
6901f8a225 js: allocate an SMP kernel's memory once, shared, at a boot and a restore, so that memoryFallbackMiB applies to it (#10)
An SMP kernel imports a shared memory, which the JS API does not show.
boot() assumed an unshared one, allocated it, got a LinkError and
allocated again, shared. It now guesses the sharing from the atomics
feature in the module's target_features section, as moduleIsMemory64()
does for the memory type; the retry stays for a wrong guess (a module
with atomics on an unshared memory).

memoryFallbackMiB only applied to the unshared allocation: where the
shared one then failed, boot was rejected with the LinkError and no
fallback was tried. It now applies to the shared allocation.

Co-authored-by: Pooya Parsa <pooya@pi0.io>
2026-11-25 01:30:03 +09:00
Pooya Parsa
951bb8e5dd kernel: let kwsnd periods go down to 2 ms, in a buffer of 10 ms or more (#22)
The shortest period and tick drop from 5 ms to 2 ms for programs that
ask for low latency. A buffer is 10 ms or more as before (two 5 ms
periods), and a late tick still hands over up to 15 ms' worth when ticks
are shorter than 5 ms, so a short period tolerates the same host stall.
Programs that leave the period to alsa-lib, plain aplay, OSS without
SETFRAGMENT and requests of 256 frames or more negotiate what they did;
snd_pcm_set_params() with a latency under 20 ms now gets four periods of
2.5 to 3.75 ms (measured on Node, 2026-11-24).

Co-authored-by: Adam Meghji <566793+adammeghji@users.noreply.github.com>
2026-11-24 16:25:03 +00:00
Pooya Parsa
bc8ac778da js: send worker-mode sound through a shared PCM ring and reuse one MessageChannel for yields (#18, #19)
With shared memory, the worker's PCM goes to the owner through a
single-producer, single-consumer SharedArrayBuffer ring (sound-ring.ts)
instead of a message per chunk: the owner drains it into the sink's
onChunk on coalesced "sound-wake" messages, or hands it to the new
SoundSink.onRing for a reader of the sink's own (an AudioWorklet).
State changes are records in the ring as well as messages, numbered
alike, so a sink sees states and PCM in the kernel's order however late
the messages are. The delay the kernel reports is the sink's answer plus
the frames still in the ring, reset with each stream. A full ring drops
the newest PCM, which the owner logs. shared: false keeps the
"sound-chunk" and "sound-queued" messages.

yieldToEventLoop() without setImmediate (browsers) reuses one
MessageChannel, with one message, so one task, per waiting yield.

Idle waits of 1 to 4 ms also wait on a timed Atomics.waitAsync where a
SharedArrayBuffer exists: browsers raise a nested setTimeout below 4 ms
to 4 ms (about 5 ms between wakes in Chrome and Safari workers, against
2.5 ms, measured 2026-11-24).

Co-authored-by: Adam Meghji <566793+adammeghji@users.noreply.github.com>
2026-11-24 15:41:39 +00:00
Pooya Parsa
e615c1a0bf vk: flush only the mapped ranges a submit can touch and signal fences at submit when nothing is read back (Qwen2.5 0.5B decode overhead 1588 to 41 ms per token without GPU work), a 4 GiB device-only heap apart from the host-visible one (KWVK_HEAP_MB) and maxMemoryAllocationSize from WebGPU's limits, uniform and push-constant blocks WGSL cannot lay out repacked as vec4<u32> words so Firefox and Safari take ggml's rope shaders, division by a constant zero rewritten, validation with WebGPU's capabilities only, the adapter in the device name with the words Ollama reads as Metal, CUDA or ROCm spelled apart (KWVK_DEVICE_NAME); web: Ollama and fx (local model) ask which model (SmolLM2 with a tool template, Qwen2.5 1.5B, Llama 3.2 1B, Qwen3.5 0.8B added), TEMP and THINK options (fx at temperature 0, thinking off), a free-space check before a model download, the server restarted when GPU discovery times out 2026-11-24 14:09:09 +00:00
Pooya Parsa
17781fa30a vk: present Wayland windows without copying (wland 0.1.0-261124-3c987e5 external buffers: the ICD names each swapchain image to the compositor and the page resolves it from the WebGPU texture; readback stays the fallback and for X11), track descriptor writes that spill over bindings and read back only the ranges the GPU wrote (device-local and host-visible memory types only), take a read-only marking from a buffer's members in the translator; web: Vulkan in the resource monitor, no guest Vulkan where WebGPU has no adapter, llama.cpp and D3D12 (vkd3d) gears and triangle apps, the Agents folder renamed AI 2026-11-24 10:45:38 +00:00
Pooya Parsa
85fb2c4e1c vk: fail loudly instead of giving wrong results: pipeline creation waits for the host and returns a Vulkan error when the shader or pipeline is refused, a failed submit, write or unencodable command loses the device, the ICD prints each error on stderr, and capabilities the host cannot honour are refused or no longer advertised; check it in test/vk (vk-loud, host cases) 2026-11-24 08:38:43 +00:00
Pooya Parsa
3538073b0f Add guest Vulkan on the page's WebGPU (kwvk): a Vulkan 1.2 ICD in the base (vk/icd, libvulkan_kw.so under the stock loader) sends commands over vsock port 1018 to a renderer in the SDK (createKernel({ vk }), js/core/vk*.ts) that implements them on a GPUDevice, with SPIR-V translated to WGSL by naga as wasm (vk/naga); Wayland, X11 and headless presentation by readback; the page's Guest Vulkan option, Environment row and vkcube, vkmark and GTK tiles; checks in test/vk 2026-11-24 07:23:03 +00:00
Pooya Parsa
893434222c kwemu: give the JIT a 32 KiB emit buffer, grow regions towards their own page and self-loops, and test the closed bit inline: 7-Zip's LZMA benchmark 677 to 780 MIPS
Exits from closed regions dominated 7-Zip's match finder: regions closed when
the 16 KiB buffer filled, so a hot page's blocks spread over many modules and
compiled code returned to run once every 34 guest instructions. A self-loop now
joins a region as a guest (its back edge branches to the member's own loop),
with eager NZCV like every member; the A64 block fuzz found a stale NZCV with
lazy flags there. The stats build's generic-op table shrinks to 256 entries so
it still fits KW_CPU_SIZE; no ABI change.
2026-11-23 18:12:15 +00:00
Pooya Parsa
4e5855569f js: share snapshot memories of 2 GiB or more instead of transferring them, so a 2 GiB machine can suspend and resume in Chrome, which neither allocates nor posts a plain ArrayBuffer that large 2026-11-22 23:28:58 +00:00
Pooya Parsa
6b74afbf34 js, guest: let the data disk grow past its 4 GiB template: openDataDisk({ size }) (and the data disk spec's size) makes a new disk that large or relabels a smaller saved one to it, never shrinking, and the base's /init grows /data's ext4 to its device with kwbox growfs (EXT4_IOC_RESIZE_FS) 2026-11-22 22:56:21 +00:00
Pooya Parsa
47a0202a64 guest, js: one program for the guest tools, and a Debian boot read from the image's front: kwbox (/usr/bin/kwbox, guest/src/kwbox.c) links kwtty, kw9p, kwvsock, kwshm, kwwasi, kwcmd and vtest-bridge into one static binary, called as kwbox tty|9p|vsock|shm|wasi|cmd|vtest (the per-tool paths are gone but binfmt's interpreter /usr/lib/kw/kwwasi; any other name it is called by is a host command, and kwbox is a reserved command name); /init sends an image or upper whose init still runs /usr/bin/kwtty to the base shell or safe mode; the traced boot that lays out an image is the page's (kwshm, kw.gl=1 kw.wayland=1), so wlandr is in Debian's boot set; HttpBase's background tier waits for the first read of the image before its quiet second (an image opened while its kernel loads fetched it during the boot) 2026-11-22 16:11:20 +00:00
Pooya Parsa
827dfa04d8 web: WebSockets in the guest preview: the service worker puts the shim /vm-ws.js into the HTML documents it relays, whose WebSocket reaches the guest (ws://localhost:<port>, /vm/<id>/<port>/, root-relative paths) through the page over a BroadcastChannel, where websocketOver() (js/core/ws.ts, RFC 6455 over vm.connect()) runs it, with credits, a socket cap and Web Locks for teardown; a preview document's root-relative requests are relayed to its port, so a Vite dev server's client and HMR work 2026-11-22 15:22:51 +00:00
Pooya Parsa
2abdc598e2 guest, kernel: boot faster and carry less in the base: /init looks for the data disk and the distro image on kwblk's disks only (wd*) and the kernel has no RAM disks (CONFIG_BLK_DEV_RAM off: probing brd's 16 took about 130 ms a boot); /init and rc read files with the shell instead of head; DHCP runs in the background (net background, net wait: the console's shell starts before the lease, kwtty serve and Debian's services with start links wait for it); the bundle stores the initrd uncompressed; wlandr moves from the base to the Debian image (wland says so where there is none); the checkout's CLI turns on Node's compile cache before it loads the SDK 2026-11-22 14:46:21 +00:00
Pooya Parsa
a0506f405b js: unwind the JSPI stack of an exited task and of one started afresh (a move to another CPU, a park cycle) instead of parking it for good: the suspended import throws STACK_DROPPED, so the engine frees the stack at once rather than at a garbage collection, which Firefox's limit of about 2000 stacks per thread did not wait for ("too many continuation stacks" after a while of kmscube on 2 CPUs) 2026-11-22 12:48:12 +00:00