CPU idling support in Windows 98+ and Unix-like systems
masterhlt instruction. No additional configuration or software is required to prevent CPU spin looping.repository·master·Indexed 12 days ago
https://github.com/copy/v86An x86-compatible CPU and hardware emulator that runs in the browser via WebAssembly. It emulates a Pentium 4 level instruction set with SSE3 support, allowing developers to run entire operating systems like Linux, Windows, or FreeDOS directly in a web page. Features include support for VGA graphics, NE2000 networking, and various virtio devices.
hlt instruction. No additional configuration or software is required to prevent CPU spin looping.v86 is an x86-compatible CPU and hardware emulator that uses WebAssembly to achieve performance in the browser. It emulates a Pentium 4 level instruction set with full SSE3 support.
Emulated Hardware:
virtio devices (Filesystem, network, balloon).v86 supports several network backends that operate at different layers of the TCP/IP model. The choice of backend determines the level of virtualization and the type of network access available to the guest:
inbrowser: Operates at the Data Link/Network layer using the BroadcastChannel API. It allows multiple v86 guests in the same browser process (same page or different tabs) to communicate with each other. It is highly efficient but provides no access to external networks.wsproxy: Operates at the Data Link/Network layer using WebSockets. It provides raw ethernet services and typically connects guests to a separate IP subnet via a proxy server, often providing access to the physical network or Internet.wisp: Operates at the Transport layer. It wraps TCP/UDP payloads into WISP messages. It is designed for client/server communication over WebSockets. Note that guests are isolated from each other.fetch: Operates at the Application layer using the browser's fetch() API. It allows guests to make HTTP requests to external servers. It handles DHCP/ARP internally and is useful when CORS is not an issue, though a CORS proxy may be required for general Internet access.The Modem translates dial addresses into WebSocket addresses using the following priority:
phonebook config.If the resulting address does not start with ws:// or wss://, the prefix is added based on the current dial mode (ws:// for pulse, wss:// for tone).
D "<dial-address>" [;] : Dial using preset method (default: pulse).DP "<dial-address>" [;] : Dial using pulse dialling (ws://).DT "<dial-address>" [;] : Dial using tone dialling (wss://).Note: Use quotes if the address starts with P, T, p, or t.
# Examples assuming phonebook {"911": "ws://example.com:56789"}
AT D 111.22.3.44:56789 # Dotted-IP
AT D 111-22-3-44-56789 # Separator variation
AT D example.com:56789 # Hostname
AT D "example.com:56789" # Quoted hostname
AT D ws://example.com:56789 # Explicit protocol
AT DP ws://111.22.3.44:56789 # Explicit pulse
AT DT ws://111.22.3.44:56789 # Explicit tone (overrides DT prefix)
AT D 11102200304456789 # Zero-padded IP
AT D 911 # Phonebook matchNetworking in v86 consists of two primary components:
ne2k: An NE2000/RTL8390-compatible NIC. Use this for older operating systems like FreeDOS.virtio: A VirtIO-compatible device. This is recommended for modern operating systems. If the guest OS supports both, try virtio first.Booting via the 9p network filesystem allows v86 to load files on-demand via HTTP requests. This enables near-instant startup when combined with a saved state, as only the necessary files are fetched over the network.
Requirements for 9p Booting:
fs2json.py.atkbd, i8042, 9p, 9pnet, 9pnet_virtio, fscache, and netfs in its MODULES array.9p_root hook must be added to initcpio to remount the root filesystem using the host9p device.filesystem and bzimage_initrd_from_filesystem keys in the V86 configuration.v86 Configuration Example:
{
filesystem: {
baseurl: "../output/images/arch/",
basefs: "../output/images/fs.json",
},
bzimage_initrd_from_filesystem: true,
cmdline: [
"rw",
"root=host9p rootfstype=9p rootflags=trans=virtio,cache=loose",
].join(" "),
acpi: false,
autostart: true,
}filesystem: {
baseurl: "../output/images/arch/",
basefs: "../output/images/fs.json",
},
bzimage_initrd_from_filesystem: true,
cmdline: [
"rw",
"root=host9p rootfstype=9p rootflags=trans=virtio,cache=loose",
].join(" "),
acpi: false,
autostart: true,The v86 Modem implements a V.250-compatible command-line interpreter. Commands are case-insensitive and follow the syntax:
AT <CMD>[<ARG>] [<CMD>[<ARG>] ...] <CR>
A, D, H, Z, and &F terminate the command line. Other commands can be combined.;), the Modem stays in AT command mode after completion. Otherwise, it switches to online data mode.To build a custom Alpine Linux 9p image for use with v86, follow these steps:
Dockerfile to select your preferred kernel flavor (e.g., virt for a smaller image vs lts) and to add any additional packages you require. The community repository is enabled by default../build.shmake run) and navigate to examples/alpine.html in your browser to see the image in action../build-state.js and update your alpine.html file to include the generated state URL in the configuration:initial_state: { url: "../images/alpine-state.bin.zst" }./build.shIf your MS-DOS guest is spin-looping instead of idling, you can use DOSIdle to enable hlt instruction support.
DOSID251.zip from Vogons.DOSIDLE.EXE to a location on your C: drive (e.g., C:\DOSIDLE.EXE).C:\autoexec.bat file.nul.C:\path\to\dosidle.exe > nuldebian Dockerfile to create a Docker image specifically configured to run a Debian environment within the v86 emulator.Run QEMU with these settings:
qemu-system-i386 -m 64 -drive file=hdd.img,format=raw -cdrom InstallCD.iso -cpu pentium -M pc,acpi=offDuring setup startup, press F5 and select Standard PC.
To avoid CPUID issues when running Windows NT 4.0 in the v86 emulator, you must configure the constructor with cpuid_level: 2 and acpi: false. Note that these options are not supported via the standard UI.
var emulator = new V86({
...
cpuid_level: 2,
acpi: false
});If installing via MS-DOS, use the Oak CD-ROM Driver and run <CD-ROM letter>:\I386\WINNT /B.
Note: If setup fails in newer QEMU versions, try older versions like PCem, 86Box, or PCBox.
After installation, you can apply the NT 3.51 SuperPack by copying files from the FAT32 (SYS\FAT32) and RENEW (SYS\RENEW) folders into C:\WINNT35\system32\drivers (replacing existing files).
Network Adapter Card: Novell NE2000 Compatible Adapter.100x300