[Offer] 32↔64 bit UEFI Firmware Handoff Pair (boots Windows)

Sharing two companion experimental projects that do the 32↔64 bit UEFI firmware handoff in both directions. Both verified booting Windows under QEMU.

**efi64boot** — a 32-bit IA32 `BOOTIA32.EFI` that hosts a 64-bit EDK2 OVMF64, switches the CPU to long mode, and hands off to OVMF64’s SEC entry. Boots `win10ltc.iso` under QEMU (TCG + KVM; core2duo and qemu64 CPUs). Useful on machines with 32-bit firmware but 64-bit-capable CPUs — instead of emulating the 64-bit world, it hosts the real 64-bit firmware.

**efi32boot** — the reverse: a 64-bit host that hands off to a 32-bit OVMF32. Same hosting machinery, mode switch flipped.

Both are AI-assisted experimental projects, not production-safe.

Shared mechanics:

- Embedded firmware copied below 4 GiB with base relocations applied.

- Firmware MEMFD region reserved at its build address so no PCD patching is needed.

- Bridge GDT + far jump for the mode switch; pre-handoff CPU hygiene (CR0 NW/CD, CR4.PSE, MTRR_DEF_TYPE) so the inner PlatformPei asserts pass.

- Boot app deletes itself from the ESP before handoff so BdsDxe can’t re-select it.

Tested chains:

efi64boot: 32 bit host → BOOTIA32.EFI (32-bit) → OVMF64 SEC (64-bit) → PEI → DXE → BdsDxe → DVD boot → Windows Setup 64 Bit

efi32boot: 64-bit host → BOOTX64.EFI (64-bit) → OVMF32 (32-bit) → 32-bit firmware takes over → PEI → DXE → BdsDxe → DVD boot → Windows Setup 32 Bit

GitHub:

Pull requests welcome; treat as works in progress.


Edit by Fernando:
Thread moved into the “BIOS Modules” Forum Category and title shortened

1 Like

@Gelip you might like this :wink:

1 Like

This 32-bit host to OVMF64 handoff approach is interesting compared with simply emulating the 64-bit firmware, since the point about reserving the firmware MEMFD region at its build address to avoid PCD patching seems like a real simplification. I am curious about the CPU hygiene steps before handoff, particularly the CR0 NW/CD and MTRR_DEF_TYPE handling; did you find those were strictly required for PlatformPei asserts, or just enough to avoid intermittent failures? Also, deleting the boot app from the ESP before handoff is a neat workaround for BdsDxe re-selection.

Yeaaaa! This works in QEMU :smiley:

I tested efi32boot (efi32.efi) from UEFI Shell 64-bit - Win10 32-bit and Debian 9 32-bit ISO boot OK

Now I try same on VMware Workstation UEFI64 but stuck at this error: efi32.efi on VMware - Pastebin.com

Try Release v0.2.1 - added watch dogs · devtinoimao/efi32boot · GitHub , it would still crash and I know that, BUT I set console logging to verbose so that we know why it crashed, also there is the reverse of efi32boot, efi64boot, Release v0.2.1 - added watch dogs · devtinoimao/efi64boot · GitHub

Version 0.2.1 shows nothing more in Putty than the previous version :frowning:

Probably this is not possible run on VMware because bios OVMF32.fd is not compatible with VMware

Sorry - this is not interesting if works only on QEMU :frowning: