Run a virtual iPhone on an Apple Silicon Mac.
Swift
Boot OpenAVB and OpenSEP machines with less than 7.5 GiB of memory
Jacky52bbf8059c87
diff --git a/Research/Firmware/openavb_boot_rom.md b/Research/Firmware/openavb_boot_rom.mdindex be579fd8..5c015cf9 100644--- a/Research/Firmware/openavb_boot_rom.md+++ b/Research/Firmware/openavb_boot_rom.md@@ -133,6 +133,21 @@ was found on a live machine by the first thing that stopped, in this order:slot, and AVPBooter's "not full" send predicate were each tried and arenot needed.+7. **SIDP block on a small guest** (carried as+ `0001-Publish-the-iLLB-manifest-digest-on-t8110-only.patch`). Before LLB+ runs, `source_image_publish_boot_manifest` writes the LLB manifest's+ SHA-384 into the t8110 SIDP block (`0x2_3D2E_0044`, `+0x74`, `+0x84`).+ Virtualization.framework maps nothing there unless the guest has about+ 7.5 GiB of memory or more, the same threshold as OpenSEP's warm-boot mark+ and DART (`opensep_sep_rom.md`). On a 6144 MB iPhone17,3 iOS 27.0.1+ machine the first read of `+0x84` aborted right after `iLLB container+ accepted`; the AP sat in `pvpanic_trigger` with x19 = `0x2_3D2E_0084`, the+ SEP waited in its mailbox, and `vm create`'s first boot check timed out.+ The 2026-10-18 validation ran on 8192 MB machines, where the block is+ guest RAM. The vresearch101 iBoot boots on Apple's ROM, which publishes+ nothing there, so the patch skips the publish when the chip ID register+ reads 0, as it does under Virtualization.framework (change 2).+**How these were found.** The VM's GDB stub (the lower of the two ports`lsof -iTCP -sTCP:LISTEN` shows for the `com.apple.Virtualization.VirtualMachine`XPC process) reads registers and memory: the AP's PC, ESR/ELR/FAR, OpenAVB's@@ -145,6 +160,11 @@ reach the VM's serial log.## Validation+- 6144 MB (2026-10-19, change 7 and OpenSEP's two patches): an iPhone17,3+ iOS 27.0.1 machine boots on OpenAVB and OpenSEP, vphoned answers 13 s after+ launch, and three guest reboots come back in 9 to 10 s+ (`opensep_sep_rom.md` has the run).+- Normal boot: an iPhone17,3 iOS 26.6.2 machine restored on Apple's ROM, with`romImages.avpBooter` pointed at OpenAVB, prints `OpenBootROM: SEP bootstrapcomplete`, `Loaded LLB` and iBoot, and vphoned answers `device.info`.@@ -174,8 +194,8 @@ log show `OpenBootROM:` for OpenAVB.## Upstream-All six changes are upstream: 1 to 5 in owngoal-dev/OpenAVB#1 (folded into-`115169e`), 6 in owngoal-dev/OpenAVB#2. vphone carries no patch. The pin is+Changes 1 to 6 are upstream: 1 to 5 in owngoal-dev/OpenAVB#1 (folded into+`115169e`), 6 in owngoal-dev/OpenAVB#2. Change 7 is carried as a patch until owngoal-dev/OpenAVB#3 is merged. The pin is#2's own commit, `3c7e7f6`, not its merge `63c1ead`: both have the same treeand `main` reaches both, but upstream has rewritten `main` once, and GitHubkeeps a PR's head commit reachable (`refs/pull/2/head`) after a rewrite. Ifdiff --git a/Research/Firmware/opensep_sep_rom.md b/Research/Firmware/opensep_sep_rom.mdindex 42ce1f3e..2f5f1d81 100644--- a/Research/Firmware/opensep_sep_rom.md+++ b/Research/Firmware/opensep_sep_rom.md@@ -37,8 +37,9 @@ next start; the ROM it replaces stays in the folder. `vm info` prints## The build-`make PLATFORM=vresearch1 build/OpenSEP.bin` at the pinned commit, with no-patches. `vresearch1` is OpenSEP's default and the row of its handoff table+`make PLATFORM=vresearch1 build/OpenSEP.bin` at the pinned commit, with the+patches in `Resources/OpenSEP/patches/` applied (two: the warm-boot check+and the DART walk, below). `vresearch1` is OpenSEP's default and the row of its handoff tablethat stands in for Virtualization.framework's AVPSEPBooter: the SEPOS runtimeis entered at the runtime region's base (`0x06000000`) with the handoff pointerin `x0`, `x1` zero, and the firmware building its own translation tables. The@@ -47,7 +48,7 @@ OpenSEP's `docs/platforms.md` cites the AVPSEPBooter addresses each value ofthe `vresearch1` row was read from (macOS 26's image, SHA-256 `86d008eb…`, theone this Mac's Virtualization.framework ships).-The image is 147496 bytes and builds byte for byte the same from a fresh clone+The image is 147512 bytes and builds byte for byte the same from a fresh clone(`UpdateOpenSEP.sh` with no argument).## What changes on the boot chain@@ -75,14 +76,45 @@ and loaded by iBoot at boot, `sepfw-load-at-boot = 1`) stays as it was.`OPEN_SECURE_ROM_ENFORCE_IMAGE_TRUST`. The `vphone600` firmware is notencrypted, so OpenSEP's table of iPhone14,4 firmware keys is never used here.- **Warm boot.** OpenSEP's reset path checks a warm-boot word at- `0x2_3D2E_4804` that only the t8110 runtime writes. OpenSEP's own docs say- the path is unexercised on `vresearch1`; guest reboots, which restart the SEP- with the AP, come back (see Validation), so the SEP starts cold there.+ `0x2_3D2E_4804` that only the t8110 runtime writes, and the pinned commit+ does it on `vresearch1` too. Virtualization.framework maps nothing at that+ IPA unless the guest has about 7.5 GiB of memory or more (measured on macOS+ 27.0.1 26A434: DFU came up at 7680 and 8192 MB, never at 4096, 6144 or+ 7168 MB). Below that the load is the SEP core's first fault: VBAR_EL1 is+ still 0, it lands at `0x200`, and the framework's SEP process ends with+ `Unhandled exception code` about 130 ms after it starts (a crash report of+ `com.apple.Virtualization.VirtualMachine` with only `cpu-0` and+ `virtual-clock` threads). The AP's ROM, OpenAVB or Apple's, then spins in+ its mailbox acquire, `vm launch --dfu` says the VM started, and+ `recovery-probe` never finds it. Single-stepping the SEP core through its+ GDB stub stops on that load. The carried patch+ (`0001-Check-the-warm-boot-mark-on-t8110-only.patch`) leaves the check out+ of the `vresearch1` build, which then always starts cold; guest reboots,+ which restart the SEP with the AP, come back cold anyway (see Validation).+ Above the threshold the IPA is guest RAM, so the unpatched check could also+ read a stale `1` and take the warm path.+- **DART.** OpenSEP translated every address that arrives over the mailbox+ through dart-sep's stream zero, reading its TCR and TTBR at IPA+ `0x2_5D2C_0000`, the t8110 DART. That IPA has the same threshold. With the+ warm-boot patch alone a 6144 MB iPhone17,3 iOS 27.0.1 machine came up in+ DFU, took iBSS, iBEC, the ramdisk and `RestoreSEP`, entered restore mode,+ and lost restored right after NORData (`Could not read data (-256)`), with+ no crash report from the framework (by then OpenSEP's own vector table is+ set, so a fault there would end in OpenSEP's panic path; that was not+ observed directly). With the second patch the same restore finishes. On+ the 8 GiB machines of the first validation the read was guest RAM that+ still read zero, so the walk took the stream as unprogrammed and used the+ address as it is. The second patch+ (`0002-Walk-the-DART-on-t8110-only.patch`) makes that the `vresearch1`+ behaviour.## ValidationAll on 2026-10-18, iPhone17,3 iOS 26.6.2 / cloudOS 26.4 (23E5207q), on a-bundle with this change installed beside the default (`--keep-default`).+bundle with this change installed beside the default (`--keep-default`), on+machines with the default 8192 MB of memory and the unpatched image. That is+above the warm-boot threshold, which is why none of it saw the failure; the+Mac fleet's 6144 MB staging machines did.- Restore: a machine created with `vm create --no-template` (`OpenAVB.bin` and`OpenSEP.bin` in the folder) restores through OpenAVB's DFU:@@ -110,8 +142,53 @@ To check the image after an update: `UpdateOpenSEP.sh` with no argumentrebuilds the pinned commit and compares byte for byte. To check a machine:`vphone-cli vm info <vm>` prints `seprom:`.+### 6144 MB, with both patches (2026-10-19)++On this Mac (M5 Pro, macOS 27.0.1 26A434), iPhone17,3 iOS 27.0.1 (24A446) /+cloudOS 26.4 (23E5207q), 6 CPU, 6144 MB, `vm create --no-template` from a+build of upstream `61b4efb2` with both patches (image `92690b9c…`):++- DFU comes up through OpenAVB, the restore ends `Restore Finished`, CFW+ installs.+- The first boot check timed out. The SEP core was waiting in+ `sep_mailbox_receive_slot`; the AP was parked in OpenAVB's+ `pvpanic_trigger` after `prepare_virtual_firmware_illb`, with x19 at+ `0x2_3D2E_0084`. OpenAVB's `source_image_publish_boot_manifest` reads and+ writes the t8110 SIDP window at `0x2_3D2E_0044`…`0x84`, in the same unbacked+ range. That is OpenAVB's, not OpenSEP's; vphone carries a patch for it+ (`openavb_boot_rom.md`, change 7).+- The same machine after `vm config --rom apple` (Apple's AVPBooter, OpenSEP+ kept): iOS boots, AppleSEPKeyStore loads the keybag and the data volume+ unlocks, vphoned answers `device.info` (`ios_version` 27.0.1,+ `memory_bytes` 6418317312), and `system.reboot` (`force: true`) comes back+ in about 10 s with no `SEP RX timeout` or SEP panic on the console.++- The same machine back on OpenAVB with its patch (image `bbcabe73…`) and+ OpenSEP: `iLLB container accepted`, `virtual firmware prepared`, iBoot and+ iOS boot, vphoned answers `device.info` 13 s after launch, and three+ `system.reboot` (`force: true`) come back in 10, 9 and 10 s, with no+ `SEP RX timeout` or panic on the console.++- A template the way the Mac fleet builds one (`plan_template.go`), on the+ final images (OpenAVB `bbcabe73…`, OpenSEP `92690b9c…`): `vm new+ template-… --cpu 6 --memory 6144`, `fw prepare`, `fw patch --preset+ standard`, `vm launch --dfu` (the first `recovery-probe` answered),+ `restore` (`Restore Finished`), `cfw install`, `vm template trim --tier+ standard`, `vm template setup --slim on --strict` (settle 64 s, its reboot+ 13 s), `vm template adopt` (template `99538dfad74f`, not stale). A clone,+ `vm create --template … --cpu 6 --memory 6144`, boots on OpenAVB and+ OpenSEP: vphoned answers 15 s after launch, three `system.reboot` come back+ in 11, 13 and 15 s, with no `SEP RX timeout` or panic. `vm create` with a+ template does not reproduce the fleet here: it builds the template's staging+ machine at 8 CPU and 8192 MB whatever `--memory` says+ (`VPhoneVirtualMachineCreator.buildTemplate`), above the threshold.++Not covered: iPad guests, other iOS versions, and the Mac fleet's own hosts+(M4, the fleet's `tunnel` network).+## Upstream-No patches are carried. If one is needed, it goes in-`Resources/OpenSEP/patches/` as a `git format-patch` file until upstream takes-it; `UpdateOpenSEP.sh` refuses a patch that no longer applies.+Two patches are carried in `Resources/OpenSEP/patches/` as `git format-patch`+files until owngoal-dev/OpenSEP#1 is merged: the warm-boot check and the DART walk+above. `UpdateOpenSEP.sh`+refuses a patch that no longer applies; delete it once the pin moves past it.diff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/OpenAVB.bin b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/OpenAVB.binindex 08a4f977..2c370ca3 100644Binary files a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/OpenAVB.bin and b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/OpenAVB.bin differdiff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/README.md b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/README.mdindex 9f68e0f8..6e96b0d5 100644--- a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/README.md+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/README.md@@ -11,10 +11,10 @@ the image into each new machine folder.| --- | --- || Source | `https://github.com/owngoal-dev/OpenAVB` || Commit | `3c7e7f602d2d35af67f50454a8216337f35b11bb` |-| Patches | none (`patches/*.patch`, applied in order, when there are any) |+| Patches | `patches/*.patch`, applied in order (one, see below) || Target | `make build/OpenAVB.bin` || Toolchain | Homebrew LLVM 23.1.3 (`clang`, `llvm-objcopy`), Homebrew LLD 23.1.3 |-| SHA-256 | `d63ea62226d4383288a5a36c440aa2d1df8cccabe0118cac0ab2e0c23ba4c3d2` |+| SHA-256 | `bbcabe73fd39fb92b96fbb4c661c1a15b0f9e5d9411468f7954c4f433911cb9c` || Size | 460057 bytes |The image is checked in rather than built by the `VPhone` scheme, so building@@ -26,7 +26,17 @@ header). It clones and builds outside the repository and needs## Patches-None. OpenAVB's first commit, `54b67bf`, did not run under+- `0001-Publish-the-iLLB-manifest-digest-on-t8110-only.patch`. Before LLB runs,+ OpenAVB publishes the LLB manifest's SHA-384 into the t8110 SIDP block at+ IPA `0x2_3D2E_0044`…`0x84`. Virtualization.framework maps nothing there for+ a guest with less than about 7.5 GiB of memory: the first read aborts right+ after `iLLB container accepted` and the ROM parks in `pvpanic_trigger`, so a+ 6144 MB machine never boots. The patch skips the publish when the chip ID+ register reads 0, which is how Virtualization.framework presents it.+ Proposed upstream in+ [owngoal-dev/OpenAVB#3](https://github.com/owngoal-dev/OpenAVB/pull/3).++Earlier changes are all upstream. OpenAVB's first commit, `54b67bf`, did not run underVirtualization.framework. Five changes found on live machines made it boot andrestore, and upstream took them in[owngoal-dev/OpenAVB#1](https://github.com/owngoal-dev/OpenAVB/pull/1), nowdiff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/patches/0001-Publish-the-iLLB-manifest-digest-on-t8110-only.patch b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/patches/0001-Publish-the-iLLB-manifest-digest-on-t8110-only.patchnew file mode 100644index 00000000..7a49b04b--- /dev/null+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/patches/0001-Publish-the-iLLB-manifest-digest-on-t8110-only.patch@@ -0,0 +1,98 @@+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001+From: Jacky <[email protected]>+Date: Mon, 19 Oct 2026 11:06:52 +0800+Subject: [PATCH] Publish the iLLB manifest digest on t8110 only++source_image_publish_boot_manifest reads and writes the t8110 SIDP block at+0x2_3D2E_0044..0x84. Virtualization.framework maps nothing there for a guest+with less than about 7.5 GiB of memory: on a 6144 MB iPhone17,3 iOS 27.0.1+guest the read of +0x84 aborts right after "iLLB container accepted" and the+ROM parks in pvpanic_trigger before LLB runs (x19 = 0x2_3D2E_0084). With more+memory the block is guest RAM. The vresearch101 iBoot boots on Apple's ROM,+which publishes nothing there.++The chip ID register, which Virtualization.framework leaves at 0 and+platform_read_identity already falls back from, now names the machine: the+publish runs only when it reads non-zero.++Co-Authored-By: Claude Opus 5.5 <[email protected]>+---+ include/avp/platform/platform.h | 5 ++++++ src/image/boot/source_image.c | 10 +++++++++++ src/platform/platform.c | 5 +----+ 3 files changed, 16 insertions(+), 4 deletions(-)++diff --git a/include/avp/platform/platform.h b/include/avp/platform/platform.h+index 036ce25..764eec3 100644+--- a/include/avp/platform/platform.h++++ b/include/avp/platform/platform.h+@@ -7,6 +7,11 @@++ enum {+ AVP_PLATFORM_BASE = 0x00400000,++ /*++ * Virtualization.framework leaves this register at 0 (platform.c), which++ * is also how the ROM tells it from the t8110 machine it was written for.++ */++ AVP_PLATFORM_CHIP_ID = AVP_PLATFORM_BASE + 0x6f0,+ AVP_PLATFORM_VARIANT_CAPACITY = 64,+ AVP_AP_NONCE_SIZE = 32,+ AVP_SEP_NONCE_SIZE = 20,+diff --git a/src/image/boot/source_image.c b/src/image/boot/source_image.c+index f747f1e..174b10e 100644+--- a/src/image/boot/source_image.c++++ b/src/image/boot/source_image.c+@@ -4,6 +4,7 @@+ #include "avp/crypto/hash/corecrypto_sha512_compat.h"+ #include "avp/crypto/hash/sha256.h"+ #include "avp/platform/mmio.h"++#include "avp/platform/platform.h"+ #include "avp/runtime/memory/runtime_memory.h"+ #include "lzfse.h"++@@ -332,6 +333,12 @@ static bool prepare_source_fixture(const uint8_t *image, uint32_t image_size) {+ * panics on finding it already locked -- so this runs once, here, before the+ * firmware starts. Bit 16 of `+0x40` is the factory lock on the ROM manifest+ * and is not ours to touch; the board seeds it.++ *++ * Only the t8110 machine has the block. Virtualization.framework maps nothing++ * at `0x2_3D2E_0000` unless the guest has about 7.5 GiB of memory or more:++ * below that the first read of `+0x84` aborts and the ROM parks in pvpanic++ * before LLB runs, and above it the window is guest RAM. Its iBoot boots on++ * Apple's ROM, which publishes nothing here, so there the ROM leaves it alone.+ */+ enum {+ SOURCE_IMAGE_SIDP_BOOT = 0x23d2e0044ull,+@@ -349,6 +356,9 @@ static void source_image_publish_boot_manifest(+ AVPCCSHA512Context context;+ uint8_t digest[AVP_SHA384_DIGEST_SIZE];+++ if (mmio_read32(AVP_PLATFORM_CHIP_ID) == 0) {++ return;++ }+ if (image->encoded_manifest_bytes == 0 ||+ image->encoded_manifest_size == 0) {+ source_image_diagnostic(+diff --git a/src/platform/platform.c b/src/platform/platform.c+index bf18fb7..6891e6a 100644+--- a/src/platform/platform.c++++ b/src/platform/platform.c+@@ -13,7 +13,6 @@ enum {+ PLATFORM_ENTROPY_OFFSET = 0x38,+ PLATFORM_BOOT_CONTEXT_OFFSET = 0x300,+ PLATFORM_VARIANT_OFFSET = 0x5c8,+- PLATFORM_CHIP_ID_OFFSET = 0x6f0,+ /*+ * The matching vphone600 machine profile carries these values outside+ * the readable identity registers.+@@ -91,9 +90,7 @@ void platform_publish_boot_context(const AVPBootContext *context) {++ void platform_read_identity(AVPPlatformIdentity *identity) {+ identity->ecid = platform_ecid();+- identity->chip_id = mmio_read32(+- AVP_PLATFORM_BASE + PLATFORM_CHIP_ID_OFFSET+- );++ identity->chip_id = mmio_read32(AVP_PLATFORM_CHIP_ID);+ if (identity->chip_id == 0) {+ identity->chip_id = VPHONE600_CHIP_ID;+ }diff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/OpenSEP.bin b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/OpenSEP.binindex 70a69774..052d0b17 100644Binary files a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/OpenSEP.bin and b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/OpenSEP.bin differdiff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/README.md b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/README.mdindex f1519f72..c6cc3b3e 100644--- a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/README.md+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/README.md@@ -12,11 +12,11 @@ each new machine folder.| --- | --- || Source | `https://github.com/owngoal-dev/OpenSEP` || Commit | `39ff3d7572059668077388dd907b63308ddf645e` |-| Patches | `patches/*.patch`, applied in order (none) |+| Patches | `patches/*.patch`, applied in order (two, see below) || Target | `make PLATFORM=vresearch1 build/OpenSEP.bin` || Toolchain | Homebrew LLVM 23.1.3 (`clang`, `llvm-objcopy`), Homebrew LLD 23.1.3 |-| SHA-256 | `fe3f8de4334dd00ba6862bd95cd86d9bea7534e47592432a601d815edfb911d6` |-| Size | 147496 bytes (the SEP ROM window is `0x29000`, 167936) |+| SHA-256 | `92690b9c7e900ec0054271dbbc0444ee2d8567c8d41d3a2e491ba011e2b08b12` |+| Size | 147512 bytes (the SEP ROM window is `0x29000`, 167936) |The image is checked in rather than built by the `VPhone` scheme, so buildingthe bundle needs no cross toolchain. To move to another commit, or to check@@ -27,7 +27,23 @@ header). It clones and builds outside the repository and needs## Patches-None. If vphone needs a change upstream has not taken yet, put it in+- `0001-Check-the-warm-boot-mark-on-t8110-only.patch`. The reset path reads+ a warm-boot mark at IPA `0x2_3D2E_4804` that only the t8110 runtime writes.+ Virtualization.framework maps nothing there for a guest with less than about+ 7.5 GiB of memory, so the load aborts before the vector table is set, the+ framework ends the SEP core (`Unhandled exception code`) and the AP's ROM+ waits for the mailbox forever: DFU never comes up. The patch leaves the+ check out of the `vresearch1` build. Proposed upstream in+ [owngoal-dev/OpenSEP#1](https://github.com/owngoal-dev/OpenSEP/pull/1).+- `0002-Walk-the-DART-on-t8110-only.patch`. Mailbox addresses were translated+ through the t8110 DART, whose registers OpenSEP reads at IPA+ `0x2_5D2C_0000`. Under the same memory threshold that read aborts inside+ OpenSEP's own vector table during the first image copy of a restore, the+ SEP panics, and restored drops the connection right after NORData. The+ `vresearch1` build now uses the addresses as they are. Proposed upstream in+ [owngoal-dev/OpenSEP#1](https://github.com/owngoal-dev/OpenSEP/pull/1).++If vphone needs a change upstream has not taken yet, put it in`patches/` as a `git format-patch` file. `UpdateOpenSEP.sh` applies patches inorder and refuses one that no longer applies. Delete a patch once the pinmoves past it.diff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/patches/0001-Check-the-warm-boot-mark-on-t8110-only.patch b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/patches/0001-Check-the-warm-boot-mark-on-t8110-only.patchnew file mode 100644index 00000000..91c60094--- /dev/null+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/patches/0001-Check-the-warm-boot-mark-on-t8110-only.patch@@ -0,0 +1,109 @@+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001+From: Jacky <[email protected]>+Date: Mon, 19 Oct 2026 08:36:57 +0800+Subject: [PATCH 1/2] Check the warm-boot mark on t8110 only++The reset path reads the warm-boot mark at 0x2_3D2E_4804, which only the+t8110 runtime's deep-sleep path writes. Under Virtualization.framework+(vresearch1) nothing is mapped at that IPA for a guest with less than about+7.5 GiB of memory: the load takes a synchronous abort before VBAR_EL1 is set,+the framework ends the SEP core with "Unhandled exception code", and the AP's+ROM waits for the mailbox forever. With more memory the IPA is guest RAM, so+a stale 1 there would send a cold boot into the warm path.++Measured on macOS 27.0.1 (26A434) with a vresearch1 build: DFU comes up at+7680 and 8192 MB and never at 4096, 6144 or 7168 MB; with this change it+comes up at 4096 and 6144 MB. Single-stepping the SEP core through the GDB+stub stops at the load, then at the vector offset 0x200.++The vresearch1 build now always starts cold. The t8110 build is unchanged.++Co-Authored-By: Claude Opus 5.5 <[email protected]>+---+ Makefile | 3 ++-+ docs/external-contract.md | 9 +++++----+ docs/platforms.md | 9 ++++++---+ src/runtime/boot/start.S | 8 +++++++++ 4 files changed, 21 insertions(+), 8 deletions(-)++diff --git a/Makefile b/Makefile+index b26b822..472133c 100644+--- a/Makefile++++ b/Makefile+@@ -26,7 +26,8 @@ CFLAGS := --target=aarch64-none-elf -std=c17 -O3 -ffast-math -g \+ -mbranch-protection=bti -fno-pic -fno-pie -fno-common \+ -fno-vectorize -fno-slp-vectorize -Wall -Wextra -Werror $(INCLUDES) \+ -DOPEN_SECURE_ROM_PLATFORM=$(PLATFORM_ID)+-ASFLAGS := --target=aarch64-none-elf -g -c $(INCLUDES)++ASFLAGS := --target=aarch64-none-elf -g -c $(INCLUDES) \++ $(if $(filter t8110,$(PLATFORM)),-DOPEN_SECURE_ROM_WARM_BOOT)+ LDFLAGS := -T linker.ld --no-undefined --build-id=none \+ --fatal-warnings -nostdlib -static++diff --git a/docs/external-contract.md b/docs/external-contract.md+index 6144164..c187118 100644+--- a/docs/external-contract.md++++ b/docs/external-contract.md+@@ -23,10 +23,11 @@ per-platform differences in the handoff are in [platforms.md](platforms.md).+ pointer in x0. On `t8110` it is IPA `0x3_4000_0000`, where the d16+ firmware expects to run (it checks its own PC), so the emulator must alias+ that IPA onto the same memory. See [docs/platforms.md](platforms.md).+-- **Warm boot**: on reset the ROM reads the word at `0x2_3D2E_4804`. If it is+- `1` (the t8110 runtime's deep-sleep path writes it), the ROM clears it and+- jumps straight back into the runtime at `0x3_4000_0000`. On a cold boot it+- must read as anything other than `1`.++- **Warm boot** (`t8110` only): on reset the ROM reads the word at++ `0x2_3D2E_4804`. If it is `1` (the t8110 runtime's deep-sleep path writes++ it), the ROM clears it and jumps straight back into the runtime at++ `0x3_4000_0000`. On a cold boot it must read as anything other than `1`.++ The `vresearch1` build does not read it.+ - **DART**: addresses that arrive over the mailbox are dart-sep IOVAs. The ROM+ walks the DART itself (stream 0 at IPA `0x2_5D2C_0000`: TCR at `+0x1000`,+ TTBR at `+0x1400`, two levels of 11 index bits over 16 KiB pages). A+diff --git a/docs/platforms.md b/docs/platforms.md+index 041c956..96cd1d8 100644+--- a/docs/platforms.md++++ b/docs/platforms.md+@@ -83,9 +83,12 @@ them for this yet (see the end of this page).++ ## Not yet covered by the table++-- **Warm boot.** On every platform, `start.S` re-enters the runtime at+- `0x3_4000_0000` when the warm mark at `0x2_3D2E_4804` reads `1`. That is the+- t8110 behaviour. On `vresearch1` the path has not been exercised.++- **Warm boot.** Only the `t8110` build checks the warm mark at++ `0x2_3D2E_4804` and re-enters the runtime at `0x3_4000_0000` when it reads++ `1`. The `vresearch1` build always starts cold: Virtualization.framework++ backs nothing at that IPA for a guest with less than about 7.5 GiB of++ memory, where the load aborts before the vector table is set and the++ framework stops the SEP core, and for a larger guest it is guest RAM.+ - **Selection at run time.** The row is fixed when the ROM is built. Two ways+ to choose it at run time instead:+ - read the manifest's CHIP/BORD, which the ROM already evaluates;+diff --git a/src/runtime/boot/start.S b/src/runtime/boot/start.S+index eaa1171..469589e 100644+--- a/src/runtime/boot/start.S++++ b/src/runtime/boot/start.S+@@ -53,7 +53,14 @@ sep_reset_entry:+ * image+0x20000 and returns into the thread that went down (measured on+ * the 22G100 SEP runtime). A cold boot never has the word+ * set -- only that path writes it -- so nothing else here changes.++ *++ * Only t8110 has that path. Virtualization.framework backs nothing at++ * this IPA on vresearch1 unless the guest has about 7.5 GiB of memory or++ * more: below that the load takes a synchronous abort before++ * VBAR_EL1 is set and the framework ends the SEP core, and above it the++ * word is guest RAM, which can read 1.+ */++#if defined(OPEN_SECURE_ROM_WARM_BOOT)+ ldr x10, =SEP_BOOT_WARM_MARK+ ldr w11, [x10]+ cmp w11, #1+@@ -63,6 +70,7 @@ sep_reset_entry:+ isb+ ldr x10, =SEP_BOOT_RUNTIME_ENTRY+ br x10++#endif+ .Lbootstrap_cold:++ adr x10, sep_vector_tablediff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/patches/0002-Walk-the-DART-on-t8110-only.patch b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/patches/0002-Walk-the-DART-on-t8110-only.patchnew file mode 100644index 00000000..8767b8be--- /dev/null+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/patches/0002-Walk-the-DART-on-t8110-only.patch@@ -0,0 +1,145 @@+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001+From: Jacky <[email protected]>+Date: Mon, 19 Oct 2026 09:14:21 +0800+Subject: [PATCH 2/2] Walk the DART on t8110 only++Addresses that arrive over the mailbox are translated through dart-sep's+stream zero, whose registers are read at 0x2_5D2C_0000, the t8110 DART.+Virtualization.framework (vresearch1) maps nothing there for a guest with+less than about 7.5 GiB of memory. With only the warm-boot fix, a 6144 MB+guest entered restore mode and lost restored right after NORData ("Could not+read data (-256)") with no crash report from the framework; with this change+the same restore finishes, and the guest then boots with its SEP on this ROM+and comes back from a reboot. With more memory the read is guest RAM, which+only works while that RAM still reads zero.++The platform row gains walks_dart; vresearch1 uses the address as it is,+which is what those reads amounted to on the 8 GiB guests the platform was+validated on. t8110 is unchanged.++Co-Authored-By: Claude Opus 5.5 <[email protected]>+---+ docs/external-contract.md | 3 ++-+ docs/platforms.md | 5 ++++++ .../runtime/boot/boot_platform.h | 6 +++++++ src/image/shared/shared_region.c | 17 +++++++++++------+ src/runtime/boot/boot_platform.c | 7 ++++++++ 5 files changed, 31 insertions(+), 7 deletions(-)++diff --git a/docs/external-contract.md b/docs/external-contract.md+index c187118..153148b 100644+--- a/docs/external-contract.md++++ b/docs/external-contract.md+@@ -28,7 +28,8 @@ per-platform differences in the handoff are in [platforms.md](platforms.md).+ it), the ROM clears it and jumps straight back into the runtime at+ `0x3_4000_0000`. On a cold boot it must read as anything other than `1`.+ The `vresearch1` build does not read it.+-- **DART**: addresses that arrive over the mailbox are dart-sep IOVAs. The ROM++- **DART** (`t8110` only): addresses that arrive over the mailbox are dart-sep++ IOVAs. The `vresearch1` build uses them as they are. The `t8110` ROM+ walks the DART itself (stream 0 at IPA `0x2_5D2C_0000`: TCR at `+0x1000`,+ TTBR at `+0x1400`, two levels of 11 index bits over 16 KiB pages). A+ bypassed or unprogrammed stream means the address is used as is.+diff --git a/docs/platforms.md b/docs/platforms.md+index 96cd1d8..cafe97f 100644+--- a/docs/platforms.md++++ b/docs/platforms.md+@@ -89,6 +89,11 @@ them for this yet (see the end of this page).+ backs nothing at that IPA for a guest with less than about 7.5 GiB of+ memory, where the load aborts before the vector table is set and the+ framework stops the SEP core, and for a larger guest it is guest RAM.++- **DART.** Only the `t8110` build translates mailbox addresses through++ dart-sep's stream zero at `0x2_5D2C_0000`. The `vresearch1` build uses them++ as they are: under Virtualization.framework that IPA is unbacked for a++ guest with less than about 7.5 GiB of memory, where the read aborts and the++ image copy panics mid-restore, and guest RAM for a larger one.+ - **Selection at run time.** The row is fixed when the ROM is built. Two ways+ to choose it at run time instead:+ - read the manifest's CHIP/BORD, which the ROM already evaluates;+diff --git a/include/open_secure_rom/runtime/boot/boot_platform.h b/include/open_secure_rom/runtime/boot/boot_platform.h+index 51e82d1..48e048d 100644+--- a/include/open_secure_rom/runtime/boot/boot_platform.h++++ b/include/open_secure_rom/runtime/boot/boot_platform.h+@@ -48,6 +48,12 @@ typedef struct {+ * with; otherwise the runtime builds its own.+ */+ sep_bool rom_builds_translation_tables;++ /*++ * Addresses that arrive over the mailbox are translated through++ * dart-sep's stream zero, read at SEP_DART_BASE (shared_region.c);++ * otherwise they are used as they are.++ */++ sep_bool walks_dart;+ } sep_boot_platform_t;++ enum {+diff --git a/src/image/shared/shared_region.c b/src/image/shared/shared_region.c+index e6816f1..af1842c 100644+--- a/src/image/shared/shared_region.c++++ b/src/image/shared/shared_region.c+@@ -1,5 +1,7 @@+ #include "open_secure_rom/system_closure.h"+++#include "open_secure_rom/boot_platform.h"+++ #include "open_secure_rom/der.h"+ #include "open_secure_rom/event_log.h"+ #include "open_secure_rom/panic.h"+@@ -89,16 +91,19 @@ static sep_u64 sep_peek64(sep_u64 physical_address, sep_u32 attribute) {+ }++ sep_u64 sep_shared_region_translate(sep_u64 iova) {+- const sep_u32 tcr =+- sep_peek32(SEP_DART_BASE + SEP_DART_TCR + SEP_DART_STREAM * 4,+- SEP_ATTR_DEVICE);+- const sep_u32 ttbr =+- sep_peek32(SEP_DART_BASE + SEP_DART_TTBR + SEP_DART_STREAM * 4,+- SEP_ATTR_DEVICE);++ sep_u32 tcr;++ sep_u32 ttbr;+ sep_u64 table;+ sep_u64 entry = 0;+ int level;+++ if (!sep_boot_platform()->walks_dart) {++ return iova;++ }++ tcr = sep_peek32(SEP_DART_BASE + SEP_DART_TCR + SEP_DART_STREAM * 4,++ SEP_ATTR_DEVICE);++ ttbr = sep_peek32(SEP_DART_BASE + SEP_DART_TTBR + SEP_DART_STREAM * 4,++ SEP_ATTR_DEVICE);+ if ((tcr & SEP_DART_TCR_BYPASS) != 0) {+ return iova;+ }+diff --git a/src/runtime/boot/boot_platform.c b/src/runtime/boot/boot_platform.c+index 5d3f9e3..4fe45cf 100644+--- a/src/runtime/boot/boot_platform.c++++ b/src/runtime/boot/boot_platform.c+@@ -20,6 +20,11 @@ static const sep_boot_platform_t boot_platforms[] = {+ * 0x18000 (0x2001D00); and builds no translation tables. The+ * vphone600 SEPOS keeps x0, branches on it being zero, and reads the+ * magic through it (0x4008, 0x404C, 0x6328 in 23E5207q).++ *++ * It walks no DART. Virtualization.framework backs nothing at the++ * t8110 DART's address unless the guest has about 7.5 GiB of memory or++ * more; below that the read aborts and the copy panics mid-restore, and++ * above it the read is guest RAM.+ */+ [SEP_BOOT_PLATFORM_VRESEARCH1] = {+ .runtime_entry = 0,+@@ -28,6 +33,7 @@ static const sep_boot_platform_t boot_platforms[] = {+ .handoff_in_power_down_register = 0,+ .cold_input_offset = 0,+ .rom_builds_translation_tables = 0,++ .walks_dart = 0,+ },+ /*+ * What the d16 SEPOS needs from the t8110 SEPROM, measured on the+@@ -66,6 +72,7 @@ static const sep_boot_platform_t boot_platforms[] = {+ .handoff_in_power_down_register = 1,+ .cold_input_offset = 0x680000ULL,+ .rom_builds_translation_tables = 1,++ .walks_dart = 1,+ },+ };+