[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-112478":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":9,"pushedAt":25,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":15,"starSnapshotCount":15,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},112478,"WindowsiOS","ammaarreshi\u002FWindowsiOS","ammaarreshi","Native Windows 11 ARM64 on iOS (iPhone Duo) with direct ARM64 JIT, 4KB ASID MMU, UEFI\u002FACPI\u002FNVMe\u002FxHCI\u002FNetKVM, and Surface Laptop Ultra clamshell UI",null,"C",494,79,6,3,0,8,128,384,44,91.69,"GNU General Public License v2.0",false,"main",[],"2026-11-12 03:25:12","2026-11-23 20:37:56","\u003Cdiv align=\"center\">\n\n# WindowsiOS\n\n**Full Microsoft Windows 11 24H2 ARM64 running at near-native JIT speed on non-jailbroken modern iOS.**  \n*Verified end-to-end on the foldable **iPhone Duo** (`iPhone19,4` · Apple A20 Pro · iOS 27 TXM) — without `Hypervisor.framework`.*\n\n[![License: GPL v2+](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-GPL--2.0--or--later-blue.svg)](LICENSE)\n[![Guest OS](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FGuest-Windows_11_24H2_ARM64_(Build_26100)-0078D4.svg)](#visual-showcase)\n[![Engine](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FEngine-ARM64→ARM64_TXM_JIT_%2B_4KB_ASID_MMU-10B981.svg)](#what-was-original--hard--built-here-with-gemini-4-carbon)\n[![Built With](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FBuilt_With-Gemini_4_Carbon-7C3AED.svg)](#what-was-original--hard--built-here-with-gemini-4-carbon)\n\n\u003C\u002Fdiv>\n\n---\n\n## Visual Showcase\n\n\u003Ctable>\n  \u003Ctr>\n    \u003Ctd align=\"center\" width=\"50%\">\n      \u003Cimg src=\"docs\u002Fimages\u002Fduo_antigravity_desktop.png\" alt=\"Windows 11 24H2 ARM64 + Antigravity 2.31.0 + HD Audio + Ethernet on physical iPhone Duo\" \u002F>\n      \u003Cbr \u002F>\n      \u003Csub>\u003Cb>Physical iPhone Duo (\u003Ccode>iPhone19,4\u003C\u002Fcode>):\u003C\u002Fb> Windows 11 24H2 ARM64 Desktop with native ARM64 \u003Cb>Antigravity 2.31.0\u003C\u002Fb>, full-duplex Intel HD Audio (Speaker + Mic), and active VirtIO Ethernet.\u003C\u002Fsub>\n    \u003C\u002Ftd>\n    \u003Ctd align=\"center\" width=\"50%\">\n      \u003Cimg src=\"docs\u002Fimages\u002Fmac_antigravity_welcome.png\" alt=\"Native ARM64 Antigravity 2.31.0 running inside Windows 11 ARM64\" \u002F>\n      \u003Cbr \u002F>\n      \u003Csub>\u003Cb>Antigravity 2.31.0 (Native Windows ARM64):\u003C\u002Fb> Multi-process Electron\u002FChromium IDE running live inside the 4 KB software-MMU ARM64-to-ARM64 JIT.\u003C\u002Fsub>\n    \u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd align=\"center\" width=\"50%\">\n      \u003Cimg src=\"docs\u002Fimages\u002Fduo_win11_surface_net.png\" alt=\"Microsoft Edge + Ethernet live on physical iPhone Duo\" \u002F>\n      \u003Cbr \u002F>\n      \u003Csub>\u003Cb>Physical iPhone Duo:\u003C\u002Fb> Unmodified ARM64 Microsoft Edge running with WHQL \u003Ccode>NetKVM\u003C\u002Fcode> VirtIO Ethernet over rootless \u003Ccode>libslirp\u003C\u002Fcode> NAT.\u003C\u002Fsub>\n    \u003C\u002Ftd>\n    \u003Ctd align=\"center\" width=\"50%\">\n      \u003Cimg src=\"docs\u002Fimages\u002Fmac_edge_wikipedia.png\" alt=\"Live HTTPS Wikipedia rendering in Microsoft Edge\" \u002F>\n      \u003Cbr \u002F>\n      \u003Csub>\u003Cb>Live TLS 1.3 \u002F HTTPS Web Rendering:\u003C\u002Fb> Microsoft Edge rendering Wikipedia over user-mode NAT with zero host entitlements.\u003C\u002Fsub>\n    \u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd align=\"center\" colspan=\"2\">\n      \u003Cimg src=\"docs\u002Fimages\u002Fmac_winios_default_browser.png\" width=\"68%\" alt=\"WinIOSBrowser UCPD.sys-verified default HTTP\u002FHTTPS OAuth bridge\" \u002F>\n      \u003Cbr \u002F>\n      \u003Csub>\u003Cb>Native iOS \u003Ccode>SafariSheet\u003C\u002Fcode> OAuth Bridge:\u003C\u002Fb> \u003Ccode>WinIOSBrowser.exe\u003C\u002Fcode> registered as the \u003Ccode>UCPD.sys\u003C\u002Fcode>-verified default \u003Ccode>HTTP\u003C\u002Fcode>\u002F\u003Ccode>HTTPS\u003C\u002Fcode> handler, relaying \u003Ccode>localhost\u003C\u002Fcode> OAuth callbacks between iOS \u003Ccode>SFSafariViewController\u003C\u002Fcode> (Passkeys \u002F Face ID \u002F Google sessions) and Windows apps.\u003C\u002Fsub>\n    \u003C\u002Ftd>\n  \u003C\u002Ftr>\n\u003C\u002Ftable>\n\n---\n\n## What Didn't Exist Before This\n\nPrior to `WindowsiOS`, booting and interactively using **unmodified retail Microsoft Windows 11 24H2 ARM64** (`Build 26100`) — complete with **Microsoft Edge**, **Antigravity `2.31.0`**, **Prism x86-64 emulation (`xtajit64.dll`)**, **full-duplex Speaker + Microphone audio**, and **passkey-capable Google OAuth** — at near-native speed on **non-jailbroken modern iOS** did not publicly exist:\n\n1. **No Hardware Hypervisor on Stock iOS:** Apple restricted `com.apple.developer.kernel.hypervisor` (`Hypervisor.framework`) on stock iOS starting in iOS 16.4+, permanently cutting off hardware EL2 virtualization (`UTM HV`) on non-jailbroken iPhones and iPads. On iOS 26 and iOS 27 hardware (such as the A20 Pro), Apple's **Trusted Execution Monitor (TXM)** additionally enforces strict hardware page-table signing against arbitrary `MAP_JIT` execution.\n2. **Interpreter Emulators Are 5–10× Too Slow for Windows 11 24H2:** Sideloaded and App Store emulators such as **UTM SE** fall back to QEMU's **TCG threaded interpreter** (`TCI`). Under interpretation, modern Windows 11 24H2 takes tens of minutes to reach the desktop and cannot interactively drive heavy multi-process Chromium\u002FElectron stacks like Microsoft Edge or Antigravity.\n3. **ARM64 Binary Translation Existed Only for macOS \u002F Linux Guests — Not Windows NT:** [`Leviidev\u002FHenge`](https:\u002F\u002Fgithub.com\u002FLeviidev\u002FHenge) proved that an EL1&0 ARM64-to-ARM64 dynamic binary translator paired with a software MMU and TXM dual-mapped JIT could run macOS (`vmapple`, 16 KB pages) at near-native speed on modern iPhones. However, no open-source engine combined TXM ARM64-to-ARM64 JIT translation with everything the **Windows NT ARM64 kernel (`ntoskrnl.exe`)** demands:\n   - Strict **4 KB stage-1 translation granules** (`TG0`\u002F`TG1`) running on a 16 KB Darwin host;\n   - Windows NT's **`TCR_EL1.A1 = 1`** ASID placement in `TTBR1_EL1[63:48]` and transient `ASID 0` transitions inside `KiSwapProcess`;\n   - Windows 11's **Prism (`xtajit64.dll`)** unaligned `FEAT_LRCPC2` (`LDAPUR`\u002F`STLUR`) memory ordering semantics (`SCTLR_EL1.nAA = 1`);\n   - A full **UEFI + ACPI 6.3 + GICv3 LPI\u002FITS MSI-X + PCIe NVMe + USB 3.0 xHCI + Intel ICH6 HD Audio + WHQL VirtIO-Net** PC platform fitting comfortably inside iOS's Jetsam memory envelope.\n\n---\n\n## Standing on the Shoulders of Giants — Upstream Credits\n\n`WindowsiOS` would not exist without the trailblazing open-source work of the iOS virtualization, binary-translation, and firmware communities. Full license notices and attributions are documented in [`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md):\n\n- **[`Leviidev\u002FHenge`](https:\u002F\u002Fgithub.com\u002FLeviidev\u002FHenge) & [`Leviidev\u002FHenge#7`](https:\u002F\u002Fgithub.com\u002FLeviidev\u002FHenge\u002Fpull\u002F7)** (`GPL-2.0-or-later`) — Foundational ARM64-to-ARM64 dynamic binary translator (`HengeVM`), stage-1 software MMU and indirect-branch\u002Freturn cache design, multi-touch trackpad concepts, `\u002F.henge\u002F` WebDAV guest-host transport (`host\u002Fshare.c`), and the iOS 26\u002F27 TXM dual-mapped JIT substrate (`winios_jit.c`, `winios_brk.S`, `henge-jit.js`).\n- **[`Leviidev\u002FHusk`](https:\u002F\u002Fgithub.com\u002FLeviidev\u002FHusk)** (`GPL-2.0-or-later`) — ARM64 binary translation architecture, iOS `libslirp` cross-compilation patches, and on-device JIT helper insights.\n- **[`mxhm11cr\u002FLinuxRunner`](https:\u002F\u002Fgithub.com\u002Fmxhm11cr\u002FLinuxRunner)** (building on [`ish-app\u002Fish`](https:\u002F\u002Fgithub.com\u002Fish-app\u002Fish) & [`rcarmo\u002Fios-linuxkit`](https:\u002F\u002Fgithub.com\u002Frcarmo\u002Fios-linuxkit)) — Early ARM64 guest OS bring-up patterns and iOS runtime\u002FJetsam discipline.\n- **[`StephenDev0\u002FStikDebug`](https:\u002F\u002Fgithub.com\u002FStephenDev0\u002FStikDebug) \u002F `StikJIT`** (`MPL-2.0` \u002F `BSD-3-Clause`) & **[`jkcoxson\u002Fidevice`](https:\u002F\u002Fgithub.com\u002Fjkcoxson\u002Fidevice)** (`MIT`) — On-device iOS 26\u002F27 TXM debugger attachment, `universal.js` (`BRK #0x69` \u002F `BRK #0xF00D`) RX\u002FRW page-blessing, and `CS_DEBUGGED` ledger-exempt memory enablement.\n- **[`libslirp`](https:\u002F\u002Fgitlab.freedesktop.org\u002Fslirp\u002Flibslirp)** (`BSD-3-Clause`) — Rootless user-mode TCP\u002FIP, DHCP, and DNS NAT stack (`host\u002Fnet_slirp.c`).\n- **[TianoCore EDK2 `ArmVirtQemu`](https:\u002F\u002Fgithub.com\u002Ftianocore\u002Fedk2)** (`BSD-2-Clause-Patent`) — `AARCH64` UEFI firmware (`QEMU_EFI.fd`, fetched locally at provisioning time).\n- **[Red Hat `virtio-win` (`NetKVM`)](https:\u002F\u002Fgithub.com\u002Fvirtio-win\u002Fkvm-guest-drivers-windows)** (`BSD-3-Clause` \u002F `GPL-2.0`) — WHQL-signed Windows 11 ARM64 VirtIO Ethernet driver (fetched locally at provisioning time).\n\n---\n\n## System Architecture\n\n```mermaid\nflowchart TB\n    subgraph Guest[\"Guest OS — Microsoft Windows 11 24H2 ARM64 (Build 26100)\"]\n        Apps[\"Antigravity 2.31.0 (ARM64) · Microsoft Edge · Win32 + Prism x86-64 (xtajit64.dll)\"]\n        Bridge[\"WinIOSBrowser.exe (14 KB Freestanding AArch64 HTTP\u002FHTTPS & Loopback OAuth Relay)\"]\n        NT[\"ntoskrnl.exe (4 KB Pages · TCR_EL1.A1=1 ASIDs · StorNVMe · USBXHCI · HdAudio · NetKVM)\"]\n        UEFI[\"EDK2 ArmVirtQemu UEFI (pflash0 Code + Persistent CFI01 pflash1 NVRAM)\"]\n        Apps --> NT\n        Bridge --> NT\n        NT --> UEFI\n    end\n\n    subgraph VirtHW[\"Windows-Compatible Virtual Hardware Platform (devices\u002F)\"]\n        ACPI[\"ACPI 6.3 (FADT PSCI · GTDT · MCFG · MADT · IORT · DSDT GPEX + GED) + GICv3 LPI\u002FITS MSI-X\"]\n        NVMe[\"NVMe 1.4 (WIN11IOS01) + hvsparse Block Store\"]\n        XHCI[\"USB 3.0 xHCI (HID Boot Keyboard + Absolute Tablet)\"]\n        HDA[\"PCIe Intel ICH6 HD Audio (8086:2668) + 6-Node Duplex Codec (Speaker + Mic)\"]\n        VNET[\"VirtIO-Net (1af4:1000) + libslirp NAT + \u002F.henge WebDAV & Dynamic IPv4\u002FIPv6 Port Forwarder\"]\n    end\n\n    subgraph Engine[\"ARM64-to-ARM64 Dynamic Binary Translator & 4 KB MMU (core\u002F)\"]\n        JIT[\"Block Translator · Inline LSE Atomics (CASPAL \u002F LDXR XZR Fix) · Unaligned FEAT_LRCPC2 Helpers\"]\n        MMU[\"4 KB Stage-1 Software MMU · ASID-Keyed HvTlbStash · 2 MB \u002F 1 GB Bloom Filters · 16-Table IJC\"]\n    end\n\n    subgraph Host[\"Non-Jailbroken iOS 26\u002F27 TXM Host — Foldable iPhone Duo (iPhone19,4 · A20 Pro)\"]\n        TXM[\"384 MiB Dual-Mapped RX\u002FRW TXM JIT (\u003C 0x7000000000) + 4.5 GB Ledger-Exempt Guest RAM\"]\n        UI[\"Midnight-Sapphire Surface Laptop Ultra UI (UIHingeInteraction Clamshell \u002F Open Studio + 120Hz Metal)\"]\n        IOSIO[\"CoreAudio RemoteIO + AudioQueueInput · SFSafariViewController Passkey\u002FGoogle OAuth Sheet\"]\n    end\n\n    UEFI --> ACPI\n    NT --> NVMe & XHCI & HDA & VNET\n    Guest --> JIT\n    JIT \u003C--> MMU\n    Engine --> TXM\n    XHCI \u003C--> UI\n    HDA \u003C--> IOSIO\n    VNET \u003C--> IOSIO\n    VirtHW --> UI\n```\n\n---\n\n## What Was Original & Hard — Built Here with Gemini 4 Carbon\n\nBringing unmodified Windows 11 24H2 ARM64 to full interactive life on a non-jailbroken foldable iPhone required solving a chain of deep OS kernel, ARMv8 architecture, PCIe\u002FUSB\u002FHDA hardware, and iOS TXM memory problems. Every piece of this bring-up and engineering was built with **Gemini 4 Carbon**:\n\n### 1. Windows NT 4 KB Software MMU & `TCR_EL1.A1 = 1` ASID-Keyed `HvTlbStash` ([`core\u002Fmmu.c`](core\u002Fmmu.c), [`core\u002Fcpu.h`](core\u002Fcpu.h), [`core\u002Fsysreg.c`](core\u002Fsysreg.c))\n- **4 KB Granule & CPU Identity:** `ntoskrnl.exe` mandates 4 KB stage-1 translation granules (`HV_TLB_PAGE_BITS = 12`) and validates CPU identification and cycle counters during `KiInitializeKernel`. `core\u002Fsysreg.c` exposes an ARM Cortex-A76 r4p1 `MIDR_EL1` (`0x414fd0b1`), calibrated `PMCCNTR_EL0`, and 4-way per-privilege software TLB tables (`[EL0, EL1, EL1+PAN]` packed into single 128-byte cache lines so kernel `PAN` toggles around user copies never flush TLB state), paired with 2 MB and 1 GB large-block Bloom filters (`large_2m_bloom`, `large_big_bloom`) for fast range `TLBI`.\n- **The `TCR_EL1.A1 = 1` & `KiSwapProcess` `ASID 0` Trap:** Unlike Linux and macOS (which store the user ASID in `TTBR0_EL1[63:48]`), **Windows 11 ARM64 sets `TCR_EL1.A1 = 1` (bit 22)**, placing the active process ASID in `TTBR1_EL1[63:48]`. Worse, during every context switch (`KiSwapProcess` — **64,800+ switches\u002Fsec** under desktop load), Windows writes the new `TTBR0_EL1` (`DirectoryTableBase`) while `TTBR1_EL1`'s ASID transiently transitions through **`ASID 0`**! Keying TLB stashes naively by `TTBR0` or stashing under `ASID 0` either thrashes every user TLB entry on every context switch or leaks stale user mappings across recycled physical `DirectoryTableBase` pages.\n- **Solution:** `hv_mmu_ukey()` synthesizes a canonical `(ASID \u003C\u003C 48) | (TTBR0 & OA_MASK)` address-space key reading the ASID from `TTBR1` whenever `TCR.A1 == 1` and explicitly returning `0` whenever `ASID == 0`. `HvTlbStash` (`hv_tlb_switch_user`) saves and restores ~266–313 live user TLB slots across context switches in microseconds without re-walking 4-level page tables.\n\n### 2. Inline ARMv8.1 LSE Exclusive Atomics & the Clang `LDXR`\u002F`LDAXR XZR` Bug ([`core\u002Ftranslate.c`](core\u002Ftranslate.c))\n- **128-bit `SLIST` (`LDXP`\u002F`STXP` → `LDP` + `CASPAL`):** The Windows NT dispatcher, heap, and I\u002FO manager execute lock-free 128-bit `SLIST` operations (`ExpInterlockedPopEntrySList`) millions of times per second via `LDXP`\u002F`LDAXP` and `STXP`\u002F`STLXP`. Exiting to C on every pair-exclusive crippled boot performance; `translate_excl_pair()` lowers 64-bit and 128-bit exclusives directly into inline Apple Silicon `LDP` + ARMv8.1 LSE `CASPAL` fast paths.\n- **The Subtle `rt == 31` (`LDXR XZR`) Deadlock\u002FCorruption:** Clang-compiled C++ code inside Chromium (`msedge.dll`) and Electron (`Antigravity.exe`) frequently emits `ldxr xzr, [rn]; stlxr ws, xt, [rn]` (`rt == 31`) to arm the exclusive monitor without keeping the old value in a general-purpose register. In AArch64 machine code, register `31` encodes `XZR` in `LDXR` but encodes **`SP`** in `MOV`\u002F`ADD` instructions — and if `HV_CPU_EXCL_VAL` is not populated with the true loaded memory word before checking `rt != 31`, either guest `SP` gets clobbered or `STLXR`'s `CASAL` compare-and-swap perpetually fails whenever `[rn] != 0`, deadlocking renderer threads. `translate_excl()` always loads into scratch `x6`, records `x6` into `HV_CPU_EXCL_VAL`, and suppresses register writeback when `rt == 31`.\n\n### 3. Windows Prism (`xtajit64.dll`) Unaligned `FEAT_LRCPC2` Emulation ([`core\u002Ftranslate.c`](core\u002Ftranslate.c), [`core\u002Fmemop.c`](core\u002Fmemop.c))\n- Windows 11 ARM64's **Prism** x86-64 binary translator (`xtajit64.dll`) executes with `SCTLR_EL1.nAA = 1` (non-aligned access permitted on Weakly-Ordered RCpc instructions) and emits unaligned **`LDAPUR` \u002F `STLUR` \u002F `LDAPR`** (`FEAT_LRCPC` \u002F `FEAT_LRCPC2`) loads and stores to emulate x86-64 TSO memory ordering on packed x86 data structures.\n- Darwin\u002FXNU on Apple Silicon enforces **`SCTLR_EL1.nAA = 0`** in EL0 user space — executing a native `LDAPUR` or `STLUR` on an unaligned host address immediately kills the host process with **`SIGBUS` (`EXC_ARM_DA_ALIGN`)**.\n- `translate_mem_impl()` enforces an inline alignment mask (`host_align`) on `HV_MEM_ORDERED` accesses: aligned RCpc instructions execute natively inline in 1 instruction (stripping `imm9` once `A` holds the effective host address), while unaligned accesses branch seamlessly out-of-line to acquire\u002Frelease-fenced software helpers in `core\u002Fmemop.c`.\n\n### 4. Full Windows-Compatible Virtual Hardware Platform ([`devices\u002F`](devices\u002F))\nWindows 11 24H2 refuses FDT\u002FDeviceTree boot and demands a compliant ServerReady\u002FPC-class UEFI + ACPI + MSI-X topology:\n- **UEFI + Persistent CFI01 NVRAM ([`devices\u002Fpflash.c`](devices\u002Fpflash.c), [`devices\u002Ffw_cfg.c`](devices\u002Ffw_cfg.c), [`devices\u002Ffb_metal.m`](devices\u002Ffb_metal.m)):** Dual 64 MB flash banks (`pflash0` read-only `HvRam` code at `0x00000000` + `pflash1` persistent Intel CFI01 NVRAM at `0x04000000` so `bcdboot` `Boot0001` entries survive reboots) plus `ramfb` double-buffered 120 Hz Metal presentation.\n- **Programmatic ACPI 6.3 + GICv3 ITS ([`devices\u002Facpi.c`](devices\u002Facpi.c), [`devices\u002Fgicv3.c`](devices\u002Fgicv3.c)):** Synthesizes `RSDP`, `XSDT`, `FADT` (HW-reduced ACPI + `PSCI` `HVC`), `GTDT`, `MCFG` (PCIe ECAM at `0x4010000000`), `MADT` (`GICD`, per-CPU `GICR`, and `GIC ITS` `0x0F` at `0x08080000`), **`IORT`** (mapping PCIe Root Complex RIDs `0x0000..0xFFFF` to `GICv3 ITS#0` so Windows arms MSI-X LPIs cleanly), and `DSDT` (`PNP0A08` GPEX Root Complex + `ACPI0013` GED power button).\n- **NVMe 1.4 + `USBXHCI.SYS`-Compliant USB 3.0 xHCI + WHQL `virtio-net` ([`devices\u002Fnvme.c`](devices\u002Fnvme.c), [`devices\u002Fxhci.c`](devices\u002Fxhci.c), [`devices\u002Fvirtio_net.c`](devices\u002Fvirtio_net.c)):**\n  - PCIe endpoints advertise **Root Complex Integrated Endpoint (`0x0092`)** capabilities so `pci.sys` accepts bus-0 devices without root ports.\n  - `nvme.c` implements admin\u002FI\u002FO queues, PRP lists, MSI-X, serial `WIN11IOS01`, and deferred flush synchronization (`hv_disk_sync()`) so NTFS metadata bursts don't stall iOS flash storage.\n  - `xhci.c` implements **Event Data TRB (`ED = 1`) cumulative transfer-length tracking (`EDTLA`)** and `CC_STALL` endpoint-halt recovery strictly required by Windows's `USBXHCI.SYS`, exposing Port 1 Boot Keyboard (`0627:0002`) and Port 2 Absolute Touch\u002FTrackpad Tablet (`0627:0001`).\n\n### 5. From-Scratch PCIe Intel ICH6 Full-Duplex HD Audio ([`devices\u002Fhda.c`](devices\u002Fhda.c), [`host\u002Faudio_mac.c`](host\u002Faudio_mac.c))\n- Red Hat's `virtio-win` suite has **no** Windows `virtio-snd` driver. To achieve zero-driver-install plug-and-play audio in Windows 11 ARM64, we built a complete **Intel ICH6 High Definition Audio PCIe controller (`8086:2668`, `PCI\\CC_0403`)** from scratch in `devices\u002Fhda.c` paired with a 6-node Full-Duplex HDA Codec (`1af4:0022`):\n  - `NID 0` Root → `NID 1` Audio Function Group → `NID 2` Stereo DAC + `NID 3` Speakers Pin Complex (`0x01114010`) + `NID 4` Stereo ADC + `NID 5` Microphone Pin Complex (`0x01a19020`).\n  - Full CORB\u002FRIRB verb ring engines, 24.000 MHz `WALCLK`, DMA Position Buffer (`DPLBASE`\u002F`DPUBASE`), `LPIB`, and scatter-gather BDL streams.\n- Windows 11 binds inbox `hdaudbus.sys` + `HdAudio.sys` automatically on first boot, streaming lock-free 48 kHz S16LE playback to iOS `RemoteIO` (`AudioUnit`) and live microphone capture from iOS `AudioQueueNewInput` (`AVAudioSessionCategoryPlayAndRecord`).\n\n### 6. 384 MiB TXM Dual-Mapped JIT + 4.5 GB Ledger-Exempt RAM + Featherweight Windows 11 ([`ios\u002FSources\u002FNative\u002Fwinios_jit.c`](ios\u002FSources\u002FNative\u002Fwinios_jit.c), [`tools\u002Fopt_hive_arm64.c`](tools\u002Fopt_hive_arm64.c), [`scripts\u002Foptimize_windows_lite.py`](scripts\u002Foptimize_windows_lite.py))\n- **TXM Low-VA Reservation & Ledger-Exempt RAM:** On iOS 26\u002F27 TXM devices, executable JIT mappings placed above `0x7000000000` hang in hardware. `winios_jit.c` reserves a static zero-fill region in `__DATA` below `0x180000000` at Mach-O load time, releases it right before `debugserver` `_M\u003Csize>,rx` allocation to claim a **384 MiB RX\u002FRW dual-mapped JIT**, and uses `mach_make_memory_entry_64` + `mach_memory_entry_ownership(..., LEDGER_NO_FOOTPRINT)` (`hv_alloc_no_footprint`) while `CS_DEBUGGED` is active to pre-allocate **4,608 MiB (4.5 GB) of Jetsam-exempt Guest RAM** before LLDB detaches — leaving **~2–3 GB of free iOS Jetsam headroom**.\n- **Featherweight Offline Hive Surgery (`1.46 GB` Idle RAM):** Using an offline WinPE environment plus a custom freestanding ARM64 Win32 tool (`tools\u002Fopt_hive_arm64.c`, opening `SYSTEM`\u002F`SOFTWARE` hives with `SeBackupPrivilege` + `SeRestorePrivilege` + `REG_OPTION_BACKUP_RESTORE` to bypass `TrustedInstaller` DACLs cleanly), `optimize_windows_lite.py` strips 35+ background UWP\u002Ftelemetry\u002FDefender\u002Findexer hogs and KVA Shadow overhead — bringing Windows 11 24H2 idle desktop memory down to **`1.46 GB \u002F 4.5 GB` (`~31.7%`)** and **`89%` WFI idle** across 4 A20 Pro performance-core vCPUs, packed into a compact `hvsparse` block image (`host\u002Fhvsparse.c`).\n\n### 7. Foldable iPhone Duo Surface Laptop Ultra UI + Native iOS `SafariSheet` OAuth Bridge ([`ios\u002FSources\u002F`](ios\u002FSources\u002F), [`tools\u002Fwinios_browser_arm64.c`](tools\u002Fwinios_browser_arm64.c))\n- **Posture-Aware Foldable UI:** Hooks iOS 27's `UIHingeInteraction` (`HingeSensorView.swift`) on the foldable iPhone Duo to transition fluidly between:\n  - **Folded Clamshell Laptop Mode:** Top 50% razor-bezel Obsidian-Glass Metal display lid (with Studio camera indicator and coordinate-snapping XAML double-tap) + bottom 50% Midnight-Sapphire CNC deck housing a 6-row chiclet keyboard (`F1–F10`, Copilot key, stacked `Up`\u002F`Down` arrows) and a 120 Hz haptic matte-glass multi-touch trackpad (`LaptopDeckView.swift`).\n  - **Unfolded Open Studio Mode:** Edge-to-edge full-screen Windows 11 tablet\u002Fdesktop canvas with an auto-hiding frosted-sapphire command pill (`SessionView.swift`).\n- **Seamless Google \u002F Passkey OAuth Loopback Relay:** Signing into desktop IDEs like **Antigravity `2.31.0`** opens an OAuth URL whose `redirect_uri` points to an ephemeral `http:\u002F\u002Flocalhost:\u003CPORT>\u002Foauth-callback` listener inside Windows. Clicking **\"Continue with Google\"** invokes `WinIOSBrowser.exe` (`tools\u002Fwinios_browser_arm64.c` — a 14 KB freestanding `AArch64` Win32 executable registered as `WinIOSHTML` \u002F `MSEdgeHTM`), which:\n  1. Parses single- or double-URL-encoded `localhost:\u003CPORT>` \u002F `127.0.0.1:\u003CPORT>` redirect URIs;\n  2. Spawns a guest TCP relay (`10.0.2.15:\u003CPORT> ↔ 127.0.0.1:\u003CPORT>`) and calls `PUT http:\u002F\u002F10.0.2.4\u002F.henge\u002Fexpose-port` so `host\u002Fnet_slirp.c` binds dual-stack iOS `127.0.0.1:\u003CPORT>` and `[::1]:\u003CPORT>` forwards into the guest;\n  3. Calls `PUT http:\u002F\u002F10.0.2.4\u002F.henge\u002Fopen-url` to pop up iOS's native **`SFSafariViewController`** (`SafariSheet`) — giving instant access to the user's existing iOS Safari Google session, Passkeys, and Face ID — and signals `\u002F.henge\u002Foauth-done` to auto-dismiss the sheet with haptic confirmation the moment the token lands back in Windows! (Includes a 1-tap `OAuth: Safari` \u002F `OAuth: Edge` toggle in the Studio bar.)\n\n---\n\n## Virtual Machine Physical Memory Map & PCIe Topology\n\n| Guest Physical Address | Size | Device \u002F Subsystem | Implementation |\n| :--- | :--- | :--- | :--- |\n| `0x0000_0000` | `64 MiB` | `pflash0` — EDK2 `ArmVirtQemu` UEFI Code (Read-Only `HvRam`) | [`devices\u002Fpflash.c`](devices\u002Fpflash.c) |\n| `0x0400_0000` | `64 MiB` | `pflash1` — Persistent Intel CFI01 UEFI Variable Store (`vars.fd`) | [`devices\u002Fpflash.c`](devices\u002Fpflash.c) |\n| `0x0800_0000` | `64 KiB` | ARM GICv3 Distributor (`GICD`) | [`devices\u002Fgicv3.c`](devices\u002Fgicv3.c) |\n| `0x0808_0000` | `128 KiB` | ARM GICv3 Interrupt Translation Service (`GIC ITS#0`, LPI MSI-X) | [`devices\u002Fgicv3.c`](devices\u002Fgicv3.c) |\n| `0x080A_0000` | `15 MiB` | ARM GICv3 Per-vCPU Redistributors (`GICR`) | [`devices\u002Fgicv3.c`](devices\u002Fgicv3.c) |\n| `0x0900_0000` | `64 KiB` | PrimeCell `PL011` UART, `PL031` RTC (`0x09010000`), `fw_cfg` + `ramfb` (`0x09020000`), `PL061` GPIO (`0x09030000`), ACPI GED (`0x09080000`) | [`devices\u002Fwinvirt.c`](devices\u002Fwinvirt.c) |\n| `0x1000_0000` | `752 MiB` | PCIe 32-bit MMIO Window + PIO (`0x3EFF0000`) | [`devices\u002Fpcie.c`](devices\u002Fpcie.c) |\n| `0x4000_0000` | `4.5 GiB` | Guest System DRAM (`hv_alloc_no_footprint` on iOS) | [`devices\u002Fwinvirt.c`](devices\u002Fwinvirt.c) |\n| `0x40_1000_0000` | `256 MiB` | PCIe ECAM Configuration Space (`MCFG`) | [`devices\u002Fpcie.c`](devices\u002Fpcie.c) |\n| `0x80_0000_0000` | `512 GiB` | PCIe 64-bit High MMIO BAR Window | [`devices\u002Fpcie.c`](devices\u002Fpcie.c) |\n\n**PCIe GPEX Bus `00` Endpoints:**\n- `00:00.0` — Red Hat GPEX Host Bridge (`1b36:0008`)\n- `00:01.0` — VirtIO Network Adapter (`1af4:1000`, WHQL `NetKVM` over `libslirp` NAT + `\u002F.henge\u002F` WebDAV\u002FOAuth)\n- `00:02.0` — NVMe 1.4 Controller (`1b36:0010`, Serial `WIN11IOS01`, MSI-X + `hvsparse` backing)\n- `00:03.0` — USB 3.0 xHCI Host Controller (`1b36:000d`, Port 1 HID Boot Keyboard + Port 2 Absolute Tablet)\n- `00:04.0` — Intel ICH6 High Definition Audio (`8086:2668`, Codec `1af4:0022` Stereo Speaker Out + Stereo Mic In)\n\n---\n\n## Building, Provisioning & Deploying\n\n> **Note:** No disk images (`*.img`, `*.hvsparse`), UEFI firmware binaries (`*.fd`), or Windows\u002Fdriver ISOs (`*.esd`, `*.iso`, `*.exe`) are stored in git. All large artifacts live exclusively inside `work\u002F` and `build\u002F` (enforced by [`.gitignore`](.gitignore)).\n\n### Prerequisites\n- macOS on Apple Silicon (`M1` or newer; developed on M5 Pro) with Xcode, `xcodegen`, `meson`, `ninja`, `pkg-config`, `libslirp`, `llvm`\u002F`lld` (for compiling freestanding `AArch64` Win32 guest helpers), and Python 3.\n- An official Microsoft **Windows 11 24H2 ARM64** retail ESD placed at `work\u002Fdownloads\u002FWin11_24H2_ARM64_en-us.esd`, EDK2 `QEMU_EFI.fd` at `work\u002Fcode.fd`, and WHQL `virtio-win` `NetKVM` (`w11\u002FARM64`) drivers.\n\n### 1. Build Engine, Unit Tests, macOS Runner & iOS Static Archive\n```bash\n# Cross-compile libffi + glib + libslirp for arm64-apple-ios into ios\u002Fdeps\u002F\n.\u002Fscripts\u002Fbuild_ios_deps.sh\n\n# Build macOS host VM (build\u002Fwinvm), sparse packer (build\u002Fhvsparse), iOS library (build\u002Fios\u002Flibwinvm.a), and run core JIT\u002FMMU tests\nmake -j8 all ios-lib test-core\n```\n\n### 2. Provision & Optimize Featherweight Windows 11 24H2 ARM64 Image\n```bash\n# Unattended WinPE DISM + NetKVM injection + BCDBOOT UEFI NVRAM provisioning -> work\u002Fwindows11.img + work\u002Fvars.fd\n\u002Fopt\u002Fhomebrew\u002Fbin\u002Fpython3 scripts\u002Fprovision_windows_arm64.py\n\n# Offline WinPE DISM bloat removal + SeRestorePrivilege registry hive surgery -> work\u002Fwindows11_lite.img (1.46 GB idle RAM)\n\u002Fopt\u002Fhomebrew\u002Fbin\u002Fpython3 scripts\u002Foptimize_windows_lite.py\n\n# Pack into fast zero-skipping sparse container for iOS transfer -> work\u002Fwindows11.hvsparse\n.\u002Fbuild\u002Fhvsparse pack work\u002Fwindows11_lite.img work\u002Fwindows11.hvsparse\n```\n\n### 3. Run Locally on macOS (`build\u002Fwinvm`)\n```bash\nHV_OAUTH_BRIDGE=1 .\u002Fbuild\u002Fwinvm \\\n  --cpus 4 --ram 4608 \\\n  --bios work\u002Fcode.fd --vars work\u002Fvars.fd \\\n  --disk work\u002Fwindows11_lite.img\n```\n\n### 4. Build, Install & Launch on Physical iOS 26\u002F27 TXM Hardware (iPhone Duo)\n```bash\n# Generate Xcode project from ios\u002Fproject.yml and build Release iphoneos bundle\nxcodegen generate --spec ios\u002Fproject.yml\nxcodebuild -project ios\u002FWindowsiOS.xcodeproj -scheme WindowsiOS -configuration Release \\\n  -sdk iphoneos -derivedDataPath build\u002FDerivedData build\n\n# Install WindowsiOS.app and copy work\u002Fwindows11.hvsparse + code.fd + vars.fd to Documents\u002FMachines\u002FWin11,\n# then launch --start-stopped, bless 384 MiB TXM JIT + 4,608 MiB ledger-exempt RAM via LLDB, and detach cleanly:\nxcrun devicectl device install app --device \u003CDEVICE_UDID> \\\n  build\u002FDerivedData\u002FBuild\u002FProducts\u002FRelease-iphoneos\u002FWindowsiOS.app\n.\u002Fscripts\u002Flaunch_on_duo.sh \u003CDEVICE_UDID> me.ammaar.windowsios\n```\n\n---\n\n## Repository Layout\n\n```text\nWindowsiOS\u002F\n├── core\u002F         # ARM64-to-ARM64 JIT compiler, 4 KB stage-1 software MMU, ASID HvTlbStash, LSE\u002FLRCPC2 helpers\n├── devices\u002F      # UEFI pflash, ACPI 6.3, GICv3 + ITS, PCIe GPEX, NVMe 1.4, USB 3.0 xHCI, Intel HDA, VirtIO-Net, 120Hz Metal fb\n├── host\u002F         # Mach entry\u002Fexit assembly (enter.S), dual-mapped JIT allocator, CoreAudio full-duplex backend, libslirp NAT, WebDAV\u002FOAuth share, hvsparse\n├── ios\u002F          # SwiftUI + UIKit iPhone Duo app (UIHingeInteraction Clamshell\u002FStudio UI, 120Hz MetalDisplayView, SafariSheet OAuth, TXM JIT bridge)\n├── scripts\u002F      # Automated iOS dep builder, Windows 11 ARM64 ESD provisioner, Featherweight hive optimizer, and LLDB TXM launcher\n├── tools\u002F        # hvsparse CLI, freestanding ARM64 WinPE hive surgery (opt_hive_arm64.c), and WinIOSBrowser.exe OAuth relay (winios_browser_arm64.c)\n├── tests\u002F        # Instruction classifier, operand decoder, JIT block, exclusive\u002FLRCPC2 memory, exception, and 4 KB MMU unit test suites\n├── docs\u002Fimages\u002F  # Verified physical iPhone Duo & macOS showcase screenshots\n├── LICENSE       # GNU General Public License v2.0 or later (GPL-2.0-or-later)\n└── THIRD_PARTY_NOTICES.md\n```\n\n---\n\n## License\n\n`WindowsiOS` is free software licensed under the **GNU General Public License v2.0 or later** (`GPL-2.0-or-later`). See [`LICENSE`](LICENSE) for the full license text and [`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md) for complete upstream attributions and third-party license notices.\n","WindowsiOS 是一个在非越狱现代 iOS 设备（如 iPhone Duo）上原生运行 Windows 11 24H2 ARM64 的虚拟化\u002F仿真运行时环境。它采用自研的 ARM64→ARM64 JIT 编译器与 4KB ASID 软件 MMU，支持 UEFI 启动、ACPI 电源管理、NVMe 存储、xHCI USB 和 NetKVM 网络驱动，并集成 Surface Laptop Ultra 风格折叠屏 UI。不依赖 Hypervisor.framework，可在 rootless 用户态下运行完整 Windows 桌面及原生 ARM64 应用（如 Edge、Antigravity）。适用于 iOS 硬件受限场景下的轻量级 Windows 兼容性验证、ARM64 跨平台应用调试及移动设备桌面化探索。",2,"2026-11-24 04:43:35","CREATED_QUERY"]