Run a virtual iPhone on an Apple Silicon Mac.
Swift
Pin OpenSEP and OpenAVB to the merged fixes
Jacky91a1a62620b7
diff --git a/Research/Firmware/openavb_boot_rom.md b/Research/Firmware/openavb_boot_rom.mdindex 5c015cf9..efc5096e 100644--- a/Research/Firmware/openavb_boot_rom.md+++ b/Research/Firmware/openavb_boot_rom.md@@ -81,7 +81,9 @@ merged as `02ca2e5`. Upstream then rewrote `main` into one commit, `115169e`,which keeps those changes and builds the same image the patched `54b67bf`did. A sixth change, found later, went upstream in[owngoal-dev/OpenAVB#2](https://github.com/owngoal-dev/OpenAVB/pull/2) as-`3c7e7f6`, which is the pin; OpenAVB's `make verify` passes on it. Each change+`3c7e7f6`. A seventh went upstream in+[owngoal-dev/OpenAVB#3](https://github.com/owngoal-dev/OpenAVB/pull/3) as+`65a776e`, which is the pin. Each changewas found on a live machine by the first thing that stopped, in this order:1. **ROM aperture is read-only.** `_start` stores `avp_el2_present` at@@ -133,8 +135,8 @@ 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+7. **SIDP block on a small guest** (owngoal-dev/OpenAVB#3, carried as a+ patch until it was merged). Before LLBruns, `source_image_publish_boot_manifest` writes the LLB manifest'sSHA-384 into the t8110 SIDP block (`0x2_3D2E_0044`, `+0x74`, `+0x84`).Virtualization.framework maps nothing there unless the guest has about@@ -194,11 +196,12 @@ log show `OpenBootROM:` for OpenAVB.## Upstream-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 tree-and `main` reaches both, but upstream has rewritten `main` once, and GitHub-keeps a PR's head commit reachable (`refs/pull/2/head`) after a rewrite. If+All seven changes are upstream: 1 to 5 in owngoal-dev/OpenAVB#1 (folded into+`115169e`), 6 in owngoal-dev/OpenAVB#2, 7 in owngoal-dev/OpenAVB#3. vphone+carries no patch. The pin is #3's own commit, `65a776e`, not its merge+`234a080`: both have the same tree and `main` reaches both, but upstream has+rewritten `main` once, and GitHub keeps a PR's head commit reachable+(`refs/pull/3/head`) after a rewrite. Ifupstream rewrites `main` again, `UpdateOpenAVB.sh` fails at checkout; move thepin to the rewritten commit that builds the same image.diff --git a/Research/Firmware/opensep_sep_rom.md b/Research/Firmware/opensep_sep_rom.mdindex 2f5f1d81..8d462185 100644--- a/Research/Firmware/opensep_sep_rom.md+++ b/Research/Firmware/opensep_sep_rom.md@@ -37,9 +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 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 table+`make PLATFORM=vresearch1 build/OpenSEP.bin` at the pinned commit, with no+patches. The pin, `8b1633f`, is the head of owngoal-dev/OpenSEP#1, which+fixed 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@@ -76,8 +76,8 @@ 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, and the pinned commit- does it on `vresearch1` too. Virtualization.framework maps nothing at that+ `0x2_3D2E_4804` that only the t8110 runtime writes, and the initial+ import (`39ff3d7`) did it on `vresearch1` too. Virtualization.framework maps nothing at thatIPA unless the guest has about 7.5 GiB of memory or more (measured on macOS27.0.1 26A434: DFU came up at 7680 and 8192 MB, never at 4096, 6144 or7168 MB). Below that the load is the SEP core's first fault: VBAR_EL1 is@@ -87,8 +87,7 @@ and loaded by iBoot at boot, `sepfw-load-at-boot = 1`) stays as it was.`virtual-clock` threads). The AP's ROM, OpenAVB or Apple's, then spins inits 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+ GDB stub stops on that load. Since `ef26920` (owngoal-dev/OpenSEP#1) the check is left outof 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@@ -96,16 +95,15 @@ and loaded by iBoot at boot, `sepfw-load-at-boot = 1`) stays as it was.- **DART.** OpenSEP translated every address that arrives over the mailboxthrough 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+ warm-boot fix alone a 6144 MB iPhone17,3 iOS 27.0.1 machine came up inDFU, took iBSS, iBEC, the ramdisk and `RestoreSEP`, entered restore mode,and lost restored right after NORData (`Could not read data (-256)`), withno crash report from the framework (by then OpenSEP's own vector table isset, 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+ observed directly). With the DART fix too, the same restore finishes. Onthe 8 GiB machines of the first validation the read was guest RAM thatstill 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`+ address as it is. Since `8b1633f` (owngoal-dev/OpenSEP#1) that is the `vresearch1`behaviour.## Validation@@ -142,11 +140,11 @@ 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)+### 6144 MB, with both fixes (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…`):+build of vphone upstream `61b4efb2` with both fixes, as patches then (the image is the one `8b1633f` builds, `92690b9c…`):- DFU comes up through OpenAVB, the restore ends `Restore Finished`, CFWinstalls.@@ -188,7 +186,8 @@ Not covered: iPad guests, other iOS versions, and the Mac fleet's own hosts## Upstream-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.+Both fixes above are upstream in owngoal-dev/OpenSEP#1, and vphone carries no+patch. The pin is the PR's head, `8b1633f`, which `main` reaches through the+merge `74b2359` (same tree). A change upstream has not taken yet goes in+`Resources/OpenSEP/patches/` as a `git format-patch` file until it is merged;+`UpdateOpenSEP.sh` refuses a patch that no longer applies.diff --git a/VPhoneExecutable/VPhoneVirtualization/Build/UpdateOpenAVB.sh b/VPhoneExecutable/VPhoneVirtualization/Build/UpdateOpenAVB.shindex 3dd9dfdc..f39516ea 100755--- a/VPhoneExecutable/VPhoneVirtualization/Build/UpdateOpenAVB.sh+++ b/VPhoneExecutable/VPhoneVirtualization/Build/UpdateOpenAVB.sh@@ -20,7 +20,7 @@set -euo pipefailrepository="https://github.com/owngoal-dev/OpenAVB.git"-pinned="3c7e7f602d2d35af67f50454a8216337f35b11bb"+pinned="65a776e9ae00b2e1de22b18cbbad1359945d7277"root="$(cd "${0:a:h}/../../.." && pwd)"destination="$root/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB"diff --git a/VPhoneExecutable/VPhoneVirtualization/Build/UpdateOpenSEP.sh b/VPhoneExecutable/VPhoneVirtualization/Build/UpdateOpenSEP.shindex e36478e1..023775cc 100755--- a/VPhoneExecutable/VPhoneVirtualization/Build/UpdateOpenSEP.sh+++ b/VPhoneExecutable/VPhoneVirtualization/Build/UpdateOpenSEP.sh@@ -23,7 +23,7 @@set -euo pipefailrepository="https://github.com/owngoal-dev/OpenSEP.git"-pinned="39ff3d7572059668077388dd907b63308ddf645e"+pinned="8b1633f7e6606f0bc9e1422c93e8d2e056154d2f"root="$(cd "${0:a:h}/../../.." && pwd)"destination="$root/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP"diff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/README.md b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/README.mdindex 6e96b0d5..1a74121e 100644--- a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/README.md+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/README.md@@ -10,8 +10,8 @@ the image into each new machine folder.| | || --- | --- || Source | `https://github.com/owngoal-dev/OpenAVB` |-| Commit | `3c7e7f602d2d35af67f50454a8216337f35b11bb` |-| Patches | `patches/*.patch`, applied in order (one, see below) |+| Commit | `65a776e9ae00b2e1de22b18cbbad1359945d7277` |+| Patches | none (`patches/*.patch`, applied in order, when there are any) || Target | `make build/OpenAVB.bin` || Toolchain | Homebrew LLVM 23.1.3 (`clang`, `llvm-objcopy`), Homebrew LLD 23.1.3 || SHA-256 | `bbcabe73fd39fb92b96fbb4c661c1a15b0f9e5d9411468f7954c4f433911cb9c` |@@ -26,17 +26,7 @@ header). It clones and builds outside the repository and needs## Patches-- `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 under+None. 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), now@@ -44,9 +34,14 @@ part of `115169e`. A sixth let a guest reboot: after a reboot the SEP restartstogether with the ROM, a request sent before it was up was dropped, and everyreboot hung, so the ROM now waits for the SEP's first message before sending.Upstream took it in-[owngoal-dev/OpenAVB#2](https://github.com/owngoal-dev/OpenAVB/pull/2). The pin-is that PR's commit, `3c7e7f6`, which `main` reaches through the merge-`63c1ead` (same tree), rather than the merge itself.+[owngoal-dev/OpenAVB#2](https://github.com/owngoal-dev/OpenAVB/pull/2). A+seventh lets a guest with less than about 7.5 GiB of memory boot: the ROM+published the LLB manifest digest into the t8110 SIDP block at `0x2_3D2E_0044`,+which Virtualization.framework does not back there, and now skips it when the+chip ID register reads 0. Upstream took it in+[owngoal-dev/OpenAVB#3](https://github.com/owngoal-dev/OpenAVB/pull/3). The pin+is that PR's head, `65a776e`, which `main` reaches through the merge `234a080`+(same tree), rather than the merge itself.`Research/Firmware/openavb_boot_rom.md` has the evidence for each change.If vphone needs a change upstream has not taken yet, put it in `patches/` as adiff --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.patchdeleted file mode 100644index 7a49b04b..00000000--- a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenAVB/patches/0001-Publish-the-iLLB-manifest-digest-on-t8110-only.patch+++ /dev/null@@ -1,98 +0,0 @@-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/README.md b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/README.mdindex c6cc3b3e..63bd933b 100644--- a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/README.md+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/README.md@@ -11,8 +11,8 @@ each new machine folder.| | || --- | --- || Source | `https://github.com/owngoal-dev/OpenSEP` |-| Commit | `39ff3d7572059668077388dd907b63308ddf645e` |-| Patches | `patches/*.patch`, applied in order (two, see below) |+| Commit | `8b1633f7e6606f0bc9e1422c93e8d2e056154d2f` |+| Patches | `patches/*.patch`, applied in order (none) || Target | `make PLATFORM=vresearch1 build/OpenSEP.bin` || Toolchain | Homebrew LLVM 23.1.3 (`clang`, `llvm-objcopy`), Homebrew LLD 23.1.3 || SHA-256 | `92690b9c7e900ec0054271dbbc0444ee2d8567c8d41d3a2e491ba011e2b08b12` |@@ -27,21 +27,14 @@ header). It clones and builds outside the repository and needs## Patches-- `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).+None. The initial import, `39ff3d7`, read two t8110 addresses that+Virtualization.framework backs only for a guest with about 7.5 GiB of memory+or more: the warm-boot mark at `0x2_3D2E_4804`, which stopped DFU, and the+DART at `0x2_5D2C_0000`, which broke a restore after NORData. vphone carried+both fixes until upstream took them in+[owngoal-dev/OpenSEP#1](https://github.com/owngoal-dev/OpenSEP/pull/1). The pin+is that PR's head, `8b1633f`, which `main` reaches through the merge `74b2359`+(same tree). `Research/Firmware/opensep_sep_rom.md` has the evidence.If vphone needs a change upstream has not taken yet, put it in`patches/` as a `git format-patch` file. `UpdateOpenSEP.sh` applies patches indiff --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.patchdeleted file mode 100644index 91c60094..00000000--- a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/patches/0001-Check-the-warm-boot-mark-on-t8110-only.patch+++ /dev/null@@ -1,109 +0,0 @@-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.patchdeleted file mode 100644index 8767b8be..00000000--- a/VPhoneExecutable/VPhoneVirtualization/Resources/OpenSEP/patches/0002-Walk-the-DART-on-t8110-only.patch+++ /dev/null@@ -1,145 +0,0 @@-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,- },- };-