_____ _ ____ ___ _____ _____ ________ ____ _ | _ | | | | | \/ |/ ___| | _ | ___| \/ | | | | | | | |_ __ ___ _ __ | | | | . . |\ `--. | | | | |__ | . . | | | | | | | | '_ \ / _ \ '_ \| | | | |\/| | `--. \ | | | | __|| |\/| | | | | \ \_/ / |_) | __/ | | \ \_/ / | | |/\__/ / \ \/' / |___| | | | |_| | \___/| .__/ \___|_| |_|\___/\_| |_/\____/ \_/\_\____/\_| |_/\___/ | | |_| _________ . . (.. \_ , |\ /| \ 0 \ /| \ \/ / \______ \/ | \ / vvvv\ \ | / | \^^^^ == \_/ | `\_ === \. | / /\_ \ / | |/ \_ \| / \________/ Running OpenVMS 9.2-3 (x86_64) on macOS arm64 with QEMU TCG ============================================================= Complete guide: from zero to a running OpenVMS system on Apple Silicon. Patches included in this directory fix two issues that prevent VMS from running correctly under QEMU's TCG (software emulation) on arm64: 01-lapic-timer-fix.patch Fixes LAPIC timer handling for VMS's mask-set-unmask pattern. Without this, VMS hangs during boot (timer interrupt never fires). 02-max-insns-per-tb.patch Adds a "max-insns-per-tb" TCG property that limits translation block size via a soft translator clamp (keeps TB chaining active). Without this, VMS crashes with %RMS-F-BUG during any heavy file I/O (compilers, shutdown, TCP/IP startup). The root cause is a TCG codegen issue on arm64 with multi-instruction translation blocks. Setting max-insns-per-tb=1 avoids the bug while keeping TB chaining for performance. Tested against QEMU commit e9fa1f6 (staging branch, Nov 2026). Patches should apply cleanly to any QEMU 11.x release. STEP 1: BUILD SDL2 ------------------- QEMU needs SDL2 for the graphical display window. curl -LO https://github.com/libsdl-org/SDL/releases/download/release-2.30.10/SDL2-2.30.10.tar.gz tar xf SDL2-2.30.10.tar.gz cd SDL2-2.30.10 ./configure --prefix=/usr/local make -j$(sysctl -n hw.ncpu) sudo make install cd .. STEP 2: BUILD SOCAT (optional, for QEMU monitor access) --------------------------------------------------------- curl -LO http://www.dest-unreach.org/socat/download/socat-1.8.0.2.tar.gz tar xf socat-1.8.0.2.tar.gz cd socat-1.8.0.2 ./configure --prefix=/usr/local make -j$(sysctl -n hw.ncpu) sudo make install cd .. STEP 3: CLONE AND PATCH QEMU ------------------------------ git clone https://gitlab.com/qemu-project/qemu.git cd qemu git submodule update --init --recursive git apply /path/to/QEMU-PATCH/01-lapic-timer-fix.patch git apply /path/to/QEMU-PATCH/02-max-insns-per-tb.patch STEP 4: CONFIGURE AND BUILD QEMU ---------------------------------- mkdir -p build && cd build ../configure \ --target-list=x86_64-softmmu \ --enable-tcg \ --enable-sdl \ --disable-werror \ --disable-docs \ --disable-gtk \ --disable-cocoa \ --disable-vnc \ --disable-spice-protocol \ --disable-usb-redir \ --disable-libusb \ --disable-brlapi \ --prefix=/usr/local make -j$(sysctl -n hw.ncpu) The build takes about 2-3 minutes on Apple Silicon. STEP 5: SET UP THE WORKING DIRECTORY -------------------------------------- Create a directory for the VM and copy the binaries: mkdir -p ~/openvms && cd ~/openvms cp /path/to/qemu/build/qemu-system-x86_64 . cp /path/to/qemu/build/qemu-img . macOS requires clearing extended attributes and code-signing: xattr -cr qemu-system-x86_64 qemu-img codesign -f -s - qemu-system-x86_64 codesign -f -s - qemu-img Without this step, macOS kills the binary immediately (exit code 137). STEP 6: EXTRACT AND CONVERT THE OPENVMS IMAGE ----------------------------------------------- The VSI community image is distributed as a RAR archive containing VMDK files (VMware format). Download it from VSI's community program. The archive is named something like community_2026.rar (~1.3 GB). Extract the VMDK files: unrar x community_2026.rar This creates a directory (e.g. community_2026/) with VMDK files: community_2026/ X86_V923-comm-2026.vmdk (descriptor) X86_V923-comm-2026-s001.vmdk (data extent 1) X86_V923-comm-2026-s002.vmdk (data extent 2) ... Convert the VMDK to qcow2 (point at the descriptor, not the extents): ./qemu-img convert -f vmdk -O qcow2 \ community_2026/X86_V923-comm-2026.vmdk openvms-vanilla.qcow2 This produces a ~4 GB qcow2 file. The conversion takes about 1 minute. Create an overlay so the original image stays untouched: ./qemu-img create -f qcow2 \ -b openvms-vanilla.qcow2 -F qcow2 openvms-run.qcow2 Create a writable UEFI variable store (required for snapshots): ./qemu-img convert -f raw -O qcow2 \ /usr/local/share/qemu/edk2-i386-vars.fd OVMF_VARS.qcow2 You can now delete the RAR and extracted VMDK directory to save space. STEP 7: CREATE THE BOOT SCRIPT -------------------------------- Create boot-vms.sh: #!/bin/bash BASEDIR="$(cd "$(dirname "$0")" && pwd)" QEMU="$BASEDIR/qemu-system-x86_64" FIRMWARE=/usr/local/share/qemu export DYLD_LIBRARY_PATH=/usr/local/lib exec "$QEMU" \ -machine q35,hpet=off \ -accel tcg,thread=single,max-insns-per-tb=1 \ -cpu max \ -m 4096 \ -smp 1 \ -icount shift=auto,align=off \ -rtc base=utc,clock=vm \ -nodefaults \ -device VGA,vgamem_mb=8 \ -drive if=pflash,format=raw,readonly=on,file="$FIRMWARE/edk2-x86_64-code.fd" \ -drive if=pflash,format=qcow2,file="$BASEDIR/OVMF_VARS.qcow2" \ -drive file="$BASEDIR/openvms-run.qcow2",format=qcow2,if=none,id=disk0 \ -device ahci,id=ahci0 \ -device ide-hd,drive=disk0,bus=ahci0.0 \ -monitor unix:"$BASEDIR/monitor.sock",server,nowait \ -display sdl \ -no-reboot \ -netdev user,id=net0,net=10.0.2.0/24,dhcpstart=10.0.2.15,hostfwd=tcp::2222-:22,hostfwd=tcp::2223-:23,hostfwd=tcp::2221-:21 \ -device e1000e,netdev=net0 Make it executable: chmod +x boot-vms.sh STEP 8: FIRST BOOT -------------------- ./boot-vms.sh Boot sequence: 1. UEFI loads (~1 minute). You see the boot manager. 2. type OPA0 at the UEFI shell. type BOOT at the UEFI shell. 3. VMS boots through SYSINIT. Watch the SDL window. 4. Login prompt appears after ~5-10 minutes. (be patient, default VSI image is heavy) 5. Default login: SYSTEM / your-password First boot is the slowest because VMS initializes databases and starts all services. Subsequent boots from snapshot are instant. We will also cleanup some unecessary daemons to speedup the boot time. STEP 9: POST-INSTALL TUNING ------------------------------ After first login, disable unnecessary services to speed up boot and reduce resource usage. Upload and run disable-services.com (included alongside this README), or do it manually: $ @SYS$STARTUP:SAMBA$SHUTDOWN.COM $ RENAME SYS$STARTUP:APACHE$STARTUP.COM SYS$STARTUP:APACHE$STARTUP.COM_DISABLED $ RENAME SYS$STARTUP:SAMBA$STARTUP.COM SYS$STARTUP:SAMBA$STARTUP.COM_DISABLED $ RENAME SYS$COMMON:[SYSMGR]TOMCAT$DEFINE_LOGICALS.COM - SYS$COMMON:[SYSMGR]TOMCAT$DEFINE_LOGICALS.COM_DISABLED If you want the SYSTEM password to never expire: $ MC AUTHORIZE MODIFY SYSTEM /PWDLIFETIME=NONE STEP 10: SAVE A SNAPSHOT -------------------------- Once the system is configured the way you want it, save a snapshot so you never have to cold-boot again: echo "savevm vms-clean" | socat - UNIX-CONNECT:monitor.sock Restore instantly next time by adding -loadvm to the boot command: exec "$QEMU" ... -loadvm vms-clean STEP 11: SSH ACCESS --------------------- The boot script forwards ports via QEMU's NAT networking: Host port 2222 -> VMS port 22 (SSH) Host port 2223 -> VMS port 23 (Telnet) Host port 2221 -> VMS port 21 (FTP) Connect from your Mac: ssh -p 2222 system@127.0.0.1 VMS SSH is slow to handshake. Use a long timeout: ssh -p 2222 -o ConnectTimeout=120 -o ServerAliveInterval=30 system@127.0.0.1 For scripted access (sshpass must be installed): sshpass -p 'your-password' ssh -p 2222 \ -o StrictHostKeyChecking=no \ -o UserKnownHostsFile=/dev/null \ -o ConnectTimeout=120 \ system@127.0.0.1 'SHOW SYSTEM' PERFORMANCE (MacBook Air M2, arm64) -------------------------------------- Host: Apple MacBook Air M2 (8-core, 8 GB RAM) Guest: OpenVMS V9.2-3 x86_64, single vCPU, 4 GB RAM QEMU: TCG with max-insns-per-tb=1, icount shift=auto Boot and general: Cold boot to login prompt 2:40 (services disabled) Snapshot restore to login instant (< 1 second) CC compile + LINK ~5 seconds System shutdown ~30 seconds Dhrystone 2.1 VUPs 95.1 VUPs (167,084 Dhrystones/sec) Benchmark results (benchmark.c): Test Time Notes --------------------- ---------- --------------------------- Integer arithmetic 0.79 sec 10M iters, add/mul/div/mod/bit Floating point 40.18 sec 10M iters, sin/cos/sqrt/log/exp Memory bandwidth 0.52 sec 160 MB sequential r/w (4 MB buf) String operations 253.36 sec 1M iters, memcpy/memset/strcmp 8KB Sieve of Eratosthenes 1.10 sec 10 passes, primes < 2M File I/O 1.07 sec write+read 4 MB, 4 KB blocks --------------------- ---------- TOTAL 297.04 sec Integer, memory, sieve, and file I/O are fast. Floating point and string operations are slow because TCG must emulate x86 SSE and REP-prefixed string instructions individually on arm64. The system is fully usable for development: compiling, linking, running programs, and network access all work at interactive speed. KEY FLAGS EXPLAINED -------------------- -machine q35,hpet=off Use Q35 chipset. Disable HPET (VMS doesn't use it, avoids issues). -accel tcg,thread=single,max-insns-per-tb=1 Software emulation. Single thread (required for icount). Limit each translation block to 1 guest instruction with TB chaining enabled. This is the fix that makes VMS stable. -cpu max Expose all CPU features the host can emulate. VMS requires at least XSAVE and SSE4.1 (qemu64 model is not enough). -icount shift=auto,align=off Tie virtual time to instruction count. Without this, UEFI timed delays take ~1000x longer (hours instead of seconds). The shift=auto lets QEMU calibrate automatically. align=off avoids unnecessary synchronization overhead. -device VGA,vgamem_mb=8 VGA display. VMS sends all output to VGA after early boot. -device e1000e,netdev=net0 Intel e1000e NIC. VMS recognizes this as interface IE0. Connected to NAT with DHCP + port forwarding. -netdev user,...,hostfwd=tcp::2222-:22,... QEMU user-mode (NAT) networking. VMS gets IP via DHCP from QEMU (10.0.2.15). Port forwards provide host access to SSH, Telnet, and FTP.