PISCO Imitates Systems, Compiles Originals. It runs x86 titles in WebAssembly, in a browser tab or in Node, by
recompiling their code ahead of time and supplying the system they were written for: one recompiler, one package
format (pisco build makes a title image from a recipe and your own copy of the title), and several
compatibility runtimes. Nothing of a title is in the repository. Windows titles are checked against
Wine, screen by screen and call by call.
Source: github.com/Yhozen/pisco · Progress map: what each runtime implements against what titles use · Videos: releases
An experimental release of pisco runs apps on a machine with no Node: its kit has bin/pisco-host, the Node host
(web/run-node.mjs) compiled by Bun 1.4.5 into one program, and pisco run uses it.
v<version>-bun.<n>, published as prereleases. The default install.sh still installs the stable release; install.sh 0.2.0-bun.1 installs this one, and the stable install.sh goes back.level1-portals session (the same sound samples). pisco run --chrome works through it too. It starts in about 0.1 s, Node in about 0.23 s.linux, alpine: base/microvm-x64): Bun 1.4.5 cannot switch its tasks. pisco run says so, and PISCO_HOST=node runs it with Node.Three things the first release of pisco 0.2.0 showed, the day it was cut.
pisco open <app> shows an app in your browser: its picture (WebGPU), its sound, the keyboard and the mouse. pisco run is the Node host, which has no screen: Doom ran there unseen, and now says so and names pisco open.GetStdHandle), because the job that built it had no llvm-mingw, and without its import libraries a 32-bit app was built without knowing what each import removes from the stack. Such a build now stops and says why, and hello32's image is published again.packaging/registry.toml says why).pisco 0.2.0 installs and runs apps on a machine that has no checkout of this repository. Everything it needs comes
from GitHub and from each file's publisher. There is no server of ours.
curl -fsSL https://github.com/Yhozen/pisco/releases/latest/download/install.sh | sh. That is one archive for Linux or macOS, x86-64 or arm64, checked by its sha256: pisco, the lifter and the kit (the bases, the runtimes' sources, the hosts). A build from a kit makes the same image, to the byte, as a checkout.pisco install hello32 pulls the official image (an app made only from this repository's sources). pisco install narbacular-drop asks, then fetches the game from DigiPen's own download, checks its sha256 and builds it on your machine. pisco install mohaa --input installer=<your copy> checks and builds from your own file. No input, and nothing made from one, is ever kept or published by us.packaging/toolchain.lock); a download with a wrong byte is refused.sources.toml names third parties' recipe repositories by @ns, added by pull request. Listed is not reviewed.tools/catalogue.mjs, on GitHub Pages; pisco search reads it).What the review of the Atari 2600 and 800XL runtimes left open, and what the 800XL was missing to be built and checked like the 2600.
CRITIC is set or the interrupted code had I set, as the OS does; the cartridge starts with interrupts on, as the OS leaves them.recipes/montezumas-revenge-800xl, locked) built by pisco build, and a session played to its end by pisco run.tests/run.sh atari2600 atari800xl, by default).The same game's 800XL cartridge (16 KB) runs lifted on a ninth runtime, with the 2600's 6502 front end. A census of
the cartridge (tools/census-atari8.py) showed it calls nothing in the OS's ROM and needs only what the OS's vertical
blank does for it, so the runtime does that in C, as the DOS runtime is DOS: no OS ROM is lifted, downloaded or needed.
It starts and draws its first room in Node and in Chrome, with POKEY's sound, in the colours of the screenshots people
know. The cartridge stays outside the repository; docs/montezumas-revenge.md has the
details.
--platform atari-800xl): the 16 KB at 0x8000, an NMI looked for before each instruction.base/atari-800xl): ANTIC's display list a line at a time (text and graphics modes, DLIs, the VBI), GTIA's players, missiles, priorities and collisions, POKEY's four voices, the PIA's joystick, and the OS's reset, NMI handler and vertical blank (os.c).Still missing: an oracle (atari800 7.2 will not start without Atari's OS ROMs, which it downloads), DMA's stolen cycles and fine scrolling, and a recipe.
Parker Brothers' Montezuma's Revenge (1984), the Atari 2600's cartridge, runs lifted: its 6507 code (a 6502) becomes WebAssembly, once per build, and a new runtime is the console, with no emulator. Stella, through Farama's ALE, is the oracle: started the same way, all 128 bytes of the RAM and every pixel are Stella's at every frame, idle, through games played from seeds to their game over, and through the recipe's session. Played by hand in Chrome on a MacBook, with sound. The ROM stays outside the repository; docs/montezumas-revenge.md has the details.
--platform atari-2600): the cartridge lifted at every byte, once for each 1 KB window it can be seen in (2 KB, 4 KB, F8 and Parker Brothers' E0 bank switching), with the cycles counted as the TIA needs.base/atari-2600): the cartridge's banks, the RIOT's RAM, timer and joystick, the TIA's picture drawn as the beam goes (Stella's NTSC palette) and its two voices.tests/run.sh montezuma2600 against Stella (tools/oracle-stella): the RAM and the picture, and sessions/first-room.json built by pisco build and played by pisco run, its config the spec's (the schema's atari-2600, 6502, atari2600).Still missing: the sound set against Stella's, and the 800XL's version (next).
The Elder Scrolls II: Daggerfall (1996, free on Steam) runs lifted: FALL.EXE is a 32-bit DOS program under the
CauseWay extender, and pisco lifts it to WebAssembly and runs it on a new DOS runtime, with no emulator. In Node and
in the page (headless Chrome) it goes through character creation into Privateer's Hold, where the player walks
and turns in the textured, lit dungeon, as on DOSBox. The game's files stay outside the repository
(tools/daggerfall-dir.sh). docs/daggerfall.md has the details.
base/dos): DPMI, the BIOS, int 21h, int 33h, the timer and keyboard interrupts, VGA mode 13h.ret are checked; - code copied to the heap and run there uses the copy's fields. - placeholders many instructions share (100000) are fields too: the texture-mapping spans.Still missing: saving and loading a game in the page.
The lifted Linux reaches the network in Node (SW_NET=1): the microvm-x64 machine has virtio's network device, and
unkernel's user-mode network stack (MIT) terminates its frames on the host. A shell gets a DHCP lease, looks a name up
and fetches a page from a web server on the host, as with QEMU's user networking.
web/third_party/unkernel/).Still missing: the network in the page.
A program's own shared libraries now run on the lifted Linux: one it is linked against, and one it opens itself with dlopen and calls by name. Each is lifted into a module of its own when its code is first met, and prints what it prints on QEMU (fixtures/linux-dyn, on Alpine's musl).
microvm-x64 machine takes the nearest ELF header below the code whose executable segments hold it, and the image as its loader has relocated it.Still missing: a network, snapshots.
The lifted Linux runs Alpine 3.24.4's busybox as Alpine ships it: position-independent and dynamically linked, on musl's loader. Both the loader and the program are lifted when they first run, each into a module of its own, and they print what they print on QEMU.
AT_BASE), and the program after it, at its entry point. The microvm-x64 machine rebuilds each as a program at the addresses it was loaded at, applying the loader's relocations to the copy, as the loader would.norandmaps), so the images, and the lift cache, are the same from one run to the next.Still missing: shared libraries the loader opens beside musl's.
A program met for the first time is now lifted from its image in memory, not from a file the host has to find. At a program's entry point, its stack's auxiliary vector says where its headers are, and its segments are as the kernel loaded them. The microvm-x64 machine rebuilds the ELF from that and hands it to the host, which lifts it, caches it and loads it. A static program can therefore run from the initramfs, the disk or anywhere: /init copies a program to the disk and runs it from there.
mov $f, %eax, as musl's start does).tests/run.sh kernel checks a program run from the disk.Still missing: position-independent and dynamically linked programs, which are somewhere else each time.
A program that no build lifted can now run on the lifted Linux kernel, in Node. When the microvm-x64 machine meets user code it has no lifted program for, it hands the page to the host. The host finds the initramfs program whose code page there is the same, lifts it into a module of its own, caches it by its sha256, loads it, and the machine goes on. /init runs fixtures/linux-proc that way: lifted in 2.7 s the first time, from the cache after, printing what it prints on QEMU.
web/lift.mjs (Node) reads the initramfs, compares code pages, and runs tools/build-side.sh (the lifter, wasi-sdk, wasm-ld -shared).rt/microvm-x64/side-exports.txt), not only what its build's programs import.Still missing: the page cannot lift (no lifter there), and programs on the disk or written while the machine runs are not found yet.
A program can now be a wasm module of its own, loaded by the host beside the kernel's. bash, whose GPL-3.0 licence keeps it out of a module linked with the GPL-2.0-only kernel, runs that way on the lifted Linux: /init prints what it prints on QEMU, in Node and in headless Chrome.
wasm-ld -shared. It imports the title's memory, table, C stack pointer and the machine's functions.web/side.mjs loads it as a dynamic linker loads a library: its memory taken from the machine, its functions added to the table, its relocations applied, then it is registered with the machine, which finds it by its code pages like any program.pisco build: [lifter] modules makes each one a layer of the image; the title's module exports what they import.LICENSING.md says how a machine's programs are licensed, and what this does and does not settle.Real programs run on the lifted Linux kernel. fastfetch 2.71.0 and cowsay 3.8.4 on perl 5.44.0 are in its initramfs beside busybox, all static at the same addresses, each lifted on its own into the kernel's module. /init prints fastfetch's lines and cowsay's cow exactly as on QEMU.
/proc and /sys: the machine's CPU (pisco microvm-x64 (lifted) @ 1.00 GHz), its 244 MiB of memory, the root file system's use.tools/build-linux.sh builds both programs and copies only the perl modules cowsay loads, as perl itself names them.Still missing: bash (its GPL-3.0 keeps it out of a module linked with the kernel), a network.
Two gaps in the microvm-x64 machine are closed. A program can now take a signal at any point, not only in a system call. And processes that end give back their stacks, so a shell running 500 programs one after another is part of the tests; 4,000 took 5.2 s.
sigreturn comes back to it. A copy-on-write fault that returned with SIGCHLD pending used to stop the machine there.do_task_dead) give back their C stack, their slot and their wasm stack. A new task whose kernel stack had a dead task's stack pointer used to resume the dead one./init catches a signal sent into a busy shell loop, as on QEMU.The lifted Linux kernel can now run several programs linked at the same addresses. busybox and our own fixtures/linux-hello, both static at 0x400000, run interleaved in /init and print the same 22 lines as on QEMU.
lifter --user <name> lifts a program on its own, its functions and tables under its name, with the hash of each page of its code. tools/build-title.sh (PROGRAMS) and pisco build ([lifter] programs) lift each and link them with their list.printf of a double prints what it prints on a CPU.pisco build compiles a cached lift again when the compiler's flags change.Still missing: bash, whose licence (GPL-3.0) keeps it out of a module linked with the GPL-2.0-only kernel; that needs a module per program.
The microvm-x64 machine has a disk: virtio's block device on its MMIO transport. With SW_DISK=16M (zeros) or SW_DISK=<file>, the lifted Linux finds /dev/vda. /init formats it as ext2 with busybox, writes 1,000 lines, mounts it again and reads them back. It worked on its first run.
rt/microvm-x64/virtio.c: virtio 1.2's MMIO registers, one queue, reads, writes, flush and the disk's id, interrupts through the IOAPIC's pin 5. The runtime announces the device on the kernel's command line./init still prints what it prints on QEMU.tests/run.sh kernel checks the disk too.Still missing: the disk's writes are kept in memory, not in its file; there is no network.
The lifted Linux kernel's console now takes input, so its busybox shell can be typed into: in a terminal (pisco run), in the page (keys as a terminal sends them), or through a pipe. And pisco build recipes/linux makes it an image like any other title's. Two builds with empty caches give the same manifest, and pisco run boots it in Node and in headless Chrome.
hlt waits for a key or the next timer on the host's clock; from a pipe the virtual clock stays.fxsave into a copy-on-write page reported its fault at address 0, because rt/cpu.h's helpers that reach memory saw a fallback instruction address. They now take the caller's, for every title.pisco build for a machine: [lifter] programs are lifted with the kernel; [run] initrd and cmdline reach the runtime through the image's config.tools/run-chrome.mjs can type (TYPE=<text>). tests/run.sh kernel checks the image, its programs against QEMU, and a typed shell session.Still missing: disks and a network (virtio), programs at the same addresses as one another, and more than one CPU.
The lifted Linux kernel now runs programs: busybox, lifted into the same module, runs the initramfs's /init to its end on the microvm-x64 machine in Node. That covers pipes, a shell in a shell, awk, a 4 MiB file written and hashed, a child killed, a signal handled, ten programs executed. It prints the same 15 lines it prints on QEMU, the same on every run, in 2.5 s from Node's start to the exit port. fork, exec, signals, pipes and files are the kernel's own work, not an imitation of it.
lifter --program <elf> (PROGRAMS for tools/build-title.sh) lifts static programs with a kernel, at the addresses the kernel loads them at.longjmp is its own: an indirect jump to a return address enters the code there./init where the lifted kernel takes 0.83 s; awk 0.78 s against 0.86 s; ten execs 16 ms against 18 ms.tests/run.sh kernel checks the programs' output against QEMU's.Still missing: typing into the console, pisco build of the Linux title, and programs at the same addresses as one another (bash and busybox).
Linux 6.18 runs on PISCO: the whole kernel, lifted ahead of time into one 42 MB module, boots on the microvm-x64 machine in Node to Run /init as init process in 0.9 s, printing the same boot log on every run. No program runs yet: /init is busybox, which is not lifted with the kernel yet; that is next.
USER_PTR_MAX, listed in runtime_ptr_* and runtime_shift_*) are read from memory, where the kernel wrote them. Its static-call trampolines are decoded as it has rewritten them. Its alternatives stay as the file has them, which is correct on any CPU.int3 and five bytes on (its self-test emulates a call there). A call may come back on a stack the callee moved on purpose (error_entry), as long as it returns through its own address.fxsave, fxrstor and cmpxchg16b in the lifter.tests/run.sh kernel builds the lifted kernel and checks its boot against recipes/linux/traces/boot.txt, twice.The machine Linux will run on, rt/microvm-x64 (base/microvm-x64): one x86-64 CPU in long mode, a software MMU over the kernel's own page tables, a local APIC and its timer, a serial port and an exit port. It is checked on a test kernel of our own, fixtures/microvm-hello. That kernel pages, takes a page fault and returns, has a fault fixed up, handles int3 and ud2, waits for the timer, switches between two tasks, and drops to a ring-3 task that makes system calls until the timer preempts it. Lifted, it prints on its serial port the 20 lines QEMU prints, in Node and in headless Chrome. Linux itself does not run yet; that is next (docs/linux.md).
--machine, or any image in the upper half of the address space), the system's instructions are calls of the machine. Every load and store goes through its TLB with the instruction's address, interrupts are taken at each function's start and each jump back, and a call checks that it comes back with the stack it was made with. With it, 56 of Linux's 602,001 instructions are not lifted yet.__switch_to_asm suspends one wasm stack and resumes or starts another (JSPI), in web/run-node.mjs and the page's worker.tests/run.sh microvm is a default step and runs in CI; it checks QEMU's output too when QEMU is there, and tests/run.sh chrome runs the kernel in the page.Still missing: Linux's alternatives and static calls, fxsave and xsave, the IOAPIC, the serial port's interrupt and input.
The plan to run a real Linux kernel on PISCO: lifted ahead of time like any other title, on a runtime that imitates a small x86-64 machine. Nothing of the kernel runs under PISCO yet. This first step builds the kernel, makes the lifter read it, sets up QEMU as the reference, and measures the three things the design stands on. The reasoning and the numbers are in docs/research/kernel-as-a-title.md; the title's page is docs/linux.md.
tools/build-linux.sh fetches Linux 6.18.65 from kernel.org (checked by SHA-256) and builds it with recipes/linux/kernel.config on top of the kernel's tinyconfig: one CPU, no jump labels, no mitigations, no modules, no ACPI, no PCI. It stops at a line the kernel did not take. With busybox (tools/build-busybox.sh, shared with neofetch's build) and recipes/linux/init it packs an initramfs. Two builds give the same files.--machine, or any image in the upper half of the address space): 10,853 functions and 583,233 instructions. It does not lift 3,958 of them yet (0.68 %), all instructions of the system: sti, cli, pushfq, wrmsr and about fifty rarer kinds. A kernel's code is taken from its sections, since its executable segment holds its strings too.mov cr3, rax wrote RBX). A segment register now reads as its selector in a program; the others are counted as not lifted.tools/oracle-qemu): it boots the same kernel and initramfs, and what /init's programs print is recorded in recipes/linux/traces/programs.txt (pipes, fork, exec, a file written and hashed, a child killed, a signal handled). tests/run.sh kernel checks it, also on a machine without HPET, PIT and 8259.Still missing: the machine itself (rt/microvm-x64), and so everything that runs. Next is a small test kernel of our own on it, then this one.
The single-player demo of Medal of Honor: Allied Assault (2001), on Ritual's version of the Quake III engine, on the Windows x86 runtime: the logos, the menu, the difficulty, the briefing and its level, with Miles' sound. In headless Chrome the menus are within 0.4 of 255 of Wine's screenshots on average and the level's first view within 2.6; its sound is within 0.3 dB of Wine's recording.
glDrawPixels, glReadPixels.pisco build reads a Wise installer and the InstallShield 6 setup inside it, and lifts the DLLs a title loads itself (the game, the client game, Miles and its plugins).ps5-raymarch-techdemo v1.4, a CPU raymarcher built as PS5 homebrew (ten threads, AVX2 and FMA for the console's Zen 2), now runs as a web title on a new base/ps5 runtime. Its three scenes, DualSense and synthesized music work in Node and in headless Chrome. AnyPS5 was the reference for the executable's format and for what the system functions do; nothing of Sony's is used or needed.
ps5_nids.txt. The functions start from the entry point and every FDE of .eh_frame_hdr.avx.rs, rt/avx.h) instead of trapping: the demo has about 4,700 such instructions. A ymm register is its xmm register and c->yh[n]. tests/avx.sh checks 120 results of a Zen 2 build against what the CPU printed. A fused multiply-add is a multiply then an add by default (the last bit can differ); OPT='-O2 -DPISCO_FMA_EXACT=1' makes float ones exact but for rare double rounding, about a third slower in the demo. CPUID still does not report AVX, so titles that check it take their SSE paths; a PS5 title does not ask.rt/ps5/) answers the 38 system functions this demo calls: libkernel (direct memory, time, pthreads, sysctl), the C library, the system and user services, VideoOut (frame buffers flipped to the GPU back end as a texture), Pad (the page's keys and gamepad as a DualSense) and AudioOut (ports as mixer sources). tools/build-title.sh picks the base for OS=ps5.--use-vulkan=swiftshader. Without it, Chrome 156 on the machine we used could not create the canvas's 1920x1080 swap chain texture, and the WebGPU device was lost on the first present.tools/build-ps5-raymarch.sh downloads the demo's v1.4 release (GPL-3.0-or-later, not vendored), checks its SHA-256 and builds it. docs/ps5.md says how to run it, what works and what does not.SW_CLOCK, SW_DUMP_RAW, SW_AUDIO_WAV, SW_MAX_FRAMES, SW_KEYS) dumps each 1920x1080 frame and the mix for ffmpeg. Worker yields no longer move the virtual clock, so the demo's own timers stay at 60 frames a second.Still missing: only these 38 functions are there, and an import without a name traps when called; no GPU (AGC) title runs (this one draws on the CPU); pisco build images of a PS5 title are not wired up (tools/build-title.sh is the way); kern.proc.pathname is not answered (the demo prints path=-).
Each pull request now adds its entry as a file in changelog/, and a workflow on main draws this page from them
and publishes the release holding an entry's video, in the manner of
changesets. The page was edited by hand before.
cowsay 3.8.4 on perl 5.44, built from source as a static Linux program: six runs (cowsay and cowthink, several
cows) print what native perl prints, in Node and in Chrome. The port found two recompiler gaps that a newer compiler
(gcc 13) exposes: a switch table whose bound is far from its jump, and notrack jumps through
tables. Without the fix, perl's parser was lifted as a recursion that overflowed Chrome's worker stack. Also
included, as an experimental option: tools/boat.sh runs the test steps on several boat.dev sandboxes at
once.
Desire (DESI:Re v0.1), a free maze escape on its author's own Direct3D 12 engine, on the Windows x64 runtime. Played by hand in Chrome on an M1 MacBook Pro: the logo, the maze, the enemy, the CRT effect, GAME OVER.
std::random_device drew, the maze the game writes is Wine's byte for byte (3 of 3 runs); the window title at each checkpoint and the set of Direct3D 12 methods called (51) are Wine's. In headless Chrome the still screens are within 0.3 of 255 of Wine's screenshots.pisco build reads a zip, adds your own files beside the exe (here Microsoft's C++ runtime DLLs), and compiles the title's HLSL into the image.switch tables (78 recovered in Desire's images instead of 43).neofetch 7.1.0, a bash script, runs on bash and busybox built as static Linux programs: 83 processes forked and executed (fork, execve, wait4, pipes), each in a worker with memory of its own. A title image can now hold several programs. In Chrome, fastfetch then neofetch, at real speed (video).
Linux at its system calls, for one statically linked program: files, memory, the clock, a generated /proc.
The recompiler reads ELF; the core's system-neutral parts moved to files of their own. fastfetch 2.71.0 prints the
machine it finds, a Linux x86-64 system imitated in WebAssembly, with its logo and colours, in Node and in the page.
DigiPen's paint-gun game (2008), with Microsoft's own D3DX from its installer lifted beside it: its 16 effects compile at run time to the same 46 shaders as under Wine, Direct3D 9 shader bytecode is translated to WGSL, FMOD Ex's calls are Wine's, and in headless Chrome its first level is within 1.4 of 255 of Wine's screenshots on average.
reuse lint.Steps 1 and 2 of the graphics ladder: Microsoft's SimpleTriangleDesktop (clang-cl and MSVC builds) and SimplePBR on the Windows x64 runtime, drawn with WebGPU.
The first Windows PC title, a 32-bit Direct3D 9 game, played by hand in Chrome on an M1 MacBook Pro (video). What it took: the recompiler's 32-bit mode with x87, a Win32 process for a 32-bit guest, fixed-function Direct3D 9 on WebGPU, GDI text, FMOD 3 on an AudioWorklet, DirectInput from the keyboard and a Pointer Lock mouse, saves in OPFS, and recipes that build title images. 103–355 frames a second on that machine.
Step 4 of the ladder: XCL's console test title passes all 50 of its checks in Chrome. The progress map shows what the runtime implements against what titles use.
doomgeneric + Freedoom, built against D3D12.X, GameInput, XAudio2 and XGameSave; its x86-64 code recompiled to WebAssembly, D3D12.X translated to WebGPU, XAudio2 mixed into an AudioWorklet, saves kept in the browser (OPFS). Recorded in headless Chrome with WebGPU on SwiftShader (no GPU); every frame was read back from WebGPU. Shows: title and attract demo, a new game from scripted keys, the automap, a save, a page reload (a new title process), the save loaded back.
Game data: Freedoom (BSD-3-Clause, © the Freedoom contributors). Engine: doomgeneric (GPL-2.0; Chocolate Doom, id Software's Doom). Narbacular Drop © DigiPen Institute of Technology; Tag: The Power of Paint © DigiPen Institute of Technology; Desire © satokunDayo. No game files are published here.