Brussels / 3 & 4 February 2024


Arm64EC: Microsoft's emulation Frankenstein

Arm64EC ("Emulation Compatible") is Microsoft's latest answer to emulating x86_64 on arm64, allowing code from both architectures to coexist in a single address space, so that an application can be incrementally ported from x86_64 to arm64. I'll cover what Arm64EC is, postulate on why it is the way it is, and lessons learnt from porting LuaJIT to it. What if there was a CPU (and associated C toolchain) capable of executing both x86_64 and arm64 instructions, cheaply switching back and forth at any function call boundary? While there isn't such a thing, Arm64EC emulates such a CPU - any x86_64 code is emulated, and any arm64 code needs to contort itself slightly to allow cheap switching in to and out of the emulator. The result is something of an emulation Frankenstein, but just maybe it'll help adoption of Windows on arm64.

Speaking about a Windows feature at an open source event might seem initially odd, but things can be intellectually interesting regardless of origin, and open source tooling such as Wine and LLVM have started to add some support for it, and open source developers might want to port their applications to it (as I have done for LuaJIT).

Related resources: * Out of tree LuaJIT support for Arm64EC * My Arm64EC ABI notes

Note that I have no association with Microsoft or with ARM.


Photo of Peter Cawley Peter Cawley