Repository navigation
Architecture
Vodka is a 100% standalone Windows compatibility runtime built from scratch as a modular set of native ELF binaries, shared Unix boundary libraries, and cross-compiled Windows PE modules. Engineered in Zig (0.17.1+) and architecture-specific inline assembly (x86_64, i386, aarch64) under the Apache License 2.0, every boundary separates Linux/POSIX host mechanics from Microsoft Windows ABI execution for Linux and Pisco.
flowchart TD
CLI["vodka (CLI Launcher)"] --> Preloader["vodka-preloader / vodka64-preloader (Freestanding ELF + Inline Asm)"]
Preloader -->|"Reserves Win32 VA ranges & hands off to ld-linux"| Loader["vodka-loader / vodka64 (ELF Host Loaders)"]
Loader -->|"dlopen + vodka_main"| Ntdll["libvodka_ntdll.so (Unix Boundary, PE64 & CS=0x23 WoW64, SEH/VEH)"]
Ntdll -->|"Maps PE64 / PE32, Forwarders & TLS"| App["Windows Apps (116 Native PE64 Programs) & 731 PE Modules (DLLs, Drivers, TypeLibs, Compat16)"]
App -->|"Win64 <-> SysV & CS=0x23 <-> CS=0x33 Gates"| Ntdll
Ntdll -->|"43-Opcode 64-byte Binary RPC over AF_UNIX"| Server["vodkaserver (NT Kernel Daemon)"]
Server -->|"Synchronization"| NTSync["Linux /dev/ntsync & epoll"]
Server -->|"Hive Persistence + vodka.inf"| RegFiles["Prefix .reg Files"]
Ntdll -->|"Futex Win32 Sync, BCrypt getrandom, WinHTTP TLS"| LinuxHost["Linux Kernel (futex, sigaction, getrandom, POSIX TCP/libssl)"]
Ntdll -->|"GUI / WSI Bridge"| Wayland["libvodkawayland.so (Zero-Dep Wayland Driver)"]
Wayland -->|"AF_UNIX Wire Protocol + memfd SHM"| Compositor["Wayland Compositor"]
Ntdll -->|"Dynamic Vulkan 1.4 WSI & D3D11-over-Vulkan"| Vulkan["Host Vulkan 1.4 ICD (libvulkan.so.1)"]
Vulkan -->|"Wayland WSI / GPU Queues"| GPU["Host GPU (RADV / Vulkan Driver)"]
Ntdll -->|"WASAPI / XAudio2 / DirectSound / WinMM"| Audio["libvodka_audio.so (Native Audio Engine)"]
Audio -->|"dlopen"| AudioHost["PipeWire (libpipewire-0.3) / ALSA (libasound)"]
Vodka's entire process bootstrap pipeline — preloaders, host loaders, prefix INF engine, and desktop/bundle metadata — is implemented natively in Zig and inline assembly with zero external C dependencies.
vodka (vodka/src/cli/main.zig) is the user-facing launcher. It:
- Resolves its own runtime
bindirvia/proc/self/exe(falling back toargv[0]). - Computes the relative installed
libdirfrom compile-timebindir/libdirbuild options. - Locates the matching host architecture directory (
/x86_64-unix,/i386-unix,/aarch64-unix, or/arm-unix) and loadsntdll.so/libvodka_ntdll.so, then transfers control tovodka_main.
-
Linux ELF Preloader (
vodka/src/preloader/main.zig,elf_util.zig): Compiled completely freestanding (link_libc = false, zero dynamic dependencies, zero ELF relocations, zero stack protector/red-zone overhead) forx86_64,i386, andaarch64Linux:- Uses an architecture-specific naked
_startassembly entry point and issues raw Linux kernel syscalls (mmap/mmap2,mprotect,open/openat,read,write,close,prctl,arch_prctl/set_thread_area). - Reserves Win32 low-memory, DOS, and top-down virtual address space regions before
ld-linuxcan occupy them. - Parses and honors
VODKAPRELOADRESERVE=(andWINEPRELOADRESERVE=) address ranges. - Maps the target ELF loader (
vodka-loader/vodka64) and itsPT_INTERPdynamic linker (ld-linux). - Exposes GDB
_r_debug/_r_debug_statehooks. - Resolves and patches
vodka_r_debug/vodka_main_preload_info(and compatibility aliases) in place viaDT_GNU_HASH/DT_HASH. - Rewrites the Linux ELF auxiliary vector (
auxv), shiftsargv, and jumps directly told-linux's entry point with a clean ABI register/stack state. - Builds as a fixed-base static executable at
0x7d400000oni386and as a static PIE executable on 64-bit targets (x86_64,aarch64).
- Uses an architecture-specific naked
-
Darwin Mach-O Preloader (
vodka/src/preloader/macho_preloader.zig): Pure-Zig + inline-assembly Mach-O preloader cross-compiling cleanly forx86_64-macosandaarch64-macos.
vodka-loader (vodka/src/loader/main.zig) and vodka64 (vodka/src/loader/loader64.zig) are PIE ELF binaries compiled with rdynamic = true and linked with libpthread:
-
vodka64: Dedicated 64-bit host loader installed acrossx86_64-unix,i386-unix(dual-arch bridge), andaarch64-unix, featuring an inline-assemblycpuid(x86_64) /mrs(aarch64) 64-bit CPU capability probe,VODKAPRELOADRESERVE=support,vodka_r_debug/vodka_main_preload_infodynamic symbol exports, directntdll.so/libvodka_ntdll.solookup, and--loader64-infodiagnostics. -
vodka-loader: General multi-arch host loader supporting--loader-infodiagnostics, dual-arch launch layouts (i386-unix/vodka64[-preloader]->x86_64-unix), and nativelibvodka_ntdll.so(vodka_main) invocation.
-
Prefix Setup INF (
vodka.inf&inf_engine.zig): From-scratch prefix installation manifest (zig-out/share/vodka/vodka.inf) paired with a pure-Zig INF parser,%String%& Windows DIRID macro expander, and.regregistry hive compiler. -
Desktop & Bundle Metadata (
vodka.desktop,vodka_info.plist.in,desktop_bundle.zig): Standalone XDG desktop entry (zig-out/share/applications/vodka.desktop) and Apple bundleInfo.plisttemplate (zig-out/share/vodka/vodka_info.plist.in) with programmatic generator/validator support.
libvodka_ntdll.so (vodka/src/ntdll/, also installed as lib/vodka/<arch>-unix/ntdll.so) is the central Unix-side runtime engine:
-
PE Parsing, Forwarders & TLS (
pe.zig,virtual.zig,loader.zig,exec.zig): Parses PE32/PE64 headers, maps sections with Win32 page protections, appliesIMAGE_REL_BASED_DIR64andHIGHLOWrelocations, resolves Import Address Tables (IATs) recursively across DLL dependencies, resolves recursive PE Export Directory forwarders (dll.symbol), allocates full PE64IMAGE_TLS_DIRECTORY64(GS:[0x58]/TEB64.ThreadLocalStoragePointer) slots and initializes_tls_indexprior toDllMain, and executesDllMain(DLL_PROCESS_ATTACH). -
x86_64 SEH & VEH Signal Recovery (
seh.zig): Registers PE64.pdataexception tables on module load, implementsRtlLookupFunctionEntryand.xdataRtlVirtualUnwind, installs Linuxsigaction(SA_SIGINFO)handlers translatingSIGSEGV/SIGBUS/SIGFPE/SIGILL/SIGTRAPinto WindowsEXCEPTION_POINTERS, and supports fullEXCEPTION_CONTINUE_EXECUTIONregister restoration. -
Hardware
CS=0x23PE32 / WoW64 Execution (wow64.zig): Mapsi386PE32 images below 4 GiB (MAP_32BIT), appliesHIGHLOWrelocations, sets flat 32-bitDS/ES(0x2B), initializesTEB32/PEB32, enters hardware 32-bit compatibility mode (CS=0x23), and bridges 32-bitstdcallAPI imports across a dynamicCS=0x23 <-> CS=0x33call gate into Vodka's 64-bit runtime. -
Thread/Process Environment (
teb.zig): Constructs ABI-exactTEB64/PEB64/FastPebLock/RtlUserProcessParameters(setting userGSbase viaSYS_arch_prctl(ARCH_SET_GS)onx86_64) and inline-assembly trampolines (callWin64_1,callWin64_2,callWin64_3) that translate System V AMD64 calls to Microsoft x64 ABI (rcx/rdx/r8/r9, 32-byte shadow space, 16-byte stack alignment). -
Modular Win64 Thunk Layers:
-
win32_deep_thunks.zig— Linux futex-backedSRWLOCK,CONDITION_VARIABLE,InitOnce,WaitOnAddress, recursiveCRITICAL_SECTION, and Win32 Mutex synchronization; per-thread 1088-slot TLS & FLS storage; OS-backedbcrypt.dll(Linuxgetrandom+ SHA-256/SHA-512/SHA-1/MD5); OS-backedwinhttp.dll(POSIX TCP + dynamiclibssl.soTLS); UTF-8 <-> UTF-16LE conversion; and MinGW/UCRT C++ runtime thunks (_beginthreadex, stdio, heap, locale). -
crt_win32_thunks.zig— UCRT/MinGW startup thunks, Win32 process/sync/registry compatibility thunks, andntdll.dllnative syscall thunks. -
os_thunks.zig&proc_thunks.zig— Filesystem, console, heap, virtual memory, timers, environment, threads, process creation, pipes, and directory enumeration. -
reg_thunks.zig&kernel_rpc_thunks.zig— Live 43-opcodeAF_UNIXRPC bridge tovodkaserverfor Registry, atoms, IOCP, jobs, pipes, mailslots, clipboard, and file locks. -
vk_thunks.zig— Dynamic Vulkan 1.4 ICD & Wayland WSI swapchain bridge (vulkan-1.dll->libvulkan.so.1). -
dxgi_crt_thunks.zig— Live D3D11-over-Vulkan / DXGI adapter & device bridge, GDI DIB software rasterizer, and extended C11 CRT thunks. -
gui_thunks.zig— Win32 128-entry message queue and User32/GDI32 windowing bridge intolibvodkawayland.so. -
net_input_thunks.zig— WinSock2, WinMM, and XInput/evdev thunks. -
desktop_thunks.zig— COM (ole32), Shell (shell32/shlwapi), PSAPI, IP Helper, SetupAPI, and Crypto/Cert thunks. -
audio_thunks.zig— WASAPIIAudioClient/IAudioRenderClientCOM vtables, PipeWire/ALSA probe, and XAudio2/DirectSound bridge. -
game_fixes.zig— Compartmentalized per-game workaround registry gated strictly by executable basename so title-specific flags never regress other applications.
-
vodkaserver (vodka/src/server/) runs per-prefix over a private AF_UNIX stream socket (/tmp/.vodka-<uid>/server-<dev>-<ino>/socket with 0700 directory permissions and an fcntl write lock). Multiple Vodka processes sharing a prefix communicate with it using fixed 64-byte GenericRequest / GenericReply frames across 43 RPC opcodes (0–42). See Vodka Server and RPC.
libvodkawayland.so (vodka/src/wayland/) implements the Wayland binary wire protocol directly over AF_UNIX (sendmsg/recvmsg + SCM_RIGHTS file-descriptor passing) with zero libwayland-client dependency. See Vulkan, DXGI, and Wayland.
libvodka_audio.so (vodka/src/audio/) provides a lock-free SPSC PCM ring buffer, sample format conversion (i16/i24/i32/f32), WASAPI endpoint/session/client management, and dynamic dlopen backends for PipeWire (libpipewire-0.3.so.0) and ALSA (libasound.so.2) with automatic software sink fallback in headless environments. See Audio Engine.
vodka/
├── build/
│ └── dll_manifest.zig # Declarative manifest for all 731 cross-compiled 3-arch PE modules (-Ddll-set=core|gaming|full)
└── src/
├── audio/ # libvodka_audio.so & vodka-audio (PipeWire, ALSA, WASAPI, SPSC ring buffer)
├── cli/ # vodka top-level launcher
├── dlls/ # 731 3-arch PE modules (DLLs, WoW64, ntoskrnl/hal, 20 .sys drivers, TypeLibs, themes, 16-bit/VxD), shared core engines & 24 PE test binaries
├── install/ # vodka-install atomic staging installer
├── loader/ # vodka-loader, vodka64, inf_engine, vodka.inf, desktop_bundle, vodka.desktop, vodka_info.plist.in
├── ntdll/ # libvodka_ntdll.so & vodka-pe (PE64 + CS=0x23 WoW64 loader, SEH/VEH, futex sync, BCrypt/WinHTTP, Vulkan 1.4 WSI, D3D11-over-Vulkan)
├── preloader/ # vodka-preloader & vodka64-preloader (freestanding ELF + Darwin Mach-O)
├── programs/ # Shared win_rt.zig + 116 native cross-compiled PE64 Windows programs
├── server/ # vodkaserver 43-opcode NT kernel daemon & vodka-proto compiler
├── tools/ # 21-tool pure-Zig build, Unicode/NLS (7 .nls tables), WinAPI ABI, debug, & CI toolchain
└── wayland/ # libvodkawayland.so & vodka-wayland zero-dependency Wayland driver
Copyright (c) 2026 buntatoes. Vodka is a 100% standalone runtime built from scratch and licensed under the Apache License 2.0. The Vodka name, wordmark, and logo are All Rights Reserved.
Trademarks & Non-Affiliation: Vulkan, SPIR-V, and the Vulkan logo are trademarks or registered trademarks of The Khronos Group Inc. DirectX, Direct3D, DXGI, and Windows are trademarks or registered trademarks of Microsoft Corporation. Steam, Steam Play, and Proton are trademarks or registered trademarks of Valve Corporation. AMD, NVIDIA, Intel, and other third-party trademarks belong to their respective owners; Vodka is an independent open-source project and is not affiliated with, endorsed by, or sponsored by any of them.
Core Runtime
Graphics, Display & Audio
Tools & Programs
Platform & Project
Links