Dynarmic
A dynamic recompiler for ARM.
An adversarial guest program can determine if it is running under Dynarmic. Preventing this is not a goal of this project.
Dynarmic supports these guest and host architecture targets:
| Target | Architectures |
|---|---|
| Guest | ARM A32 and A64 |
| Host | x86-64, AArch64, RISC-V 64-bit, LoongArch 64-bit |
The A32 interface defaults to ARMv8; its ArchVersion enum exposes earlier versions as well. The build includes RISC-V and LoongArch backends, though CMake marks both frontends as incomplete.
See an example usage.
Design documentation can be found at Design.
Alternatives to Dynarmic
Here are some projects with the same goals as Dynarmic:
- Unicorn - Recompiling multi-architecture CPU emulator, based on QEMU
- SkyEye - Cached interpreter for ARM
More general alternatives
- tARMac - Tarmac's use of armlets was initial inspiration for us to use an intermediate representation
- QEMU - Recompiling multi-architecture system emulator
- VisUAL - Visual ARM UAL emulator intended for education
- A wide variety of other recompilers, interpreters and emulators can be found embedded in other projects, here are some we would recommend looking at:
- firebird's recompiler - Takes more of a call-threaded approach to recompilation
- higan's arm7tdmi emulator - Very clean code-style
- arm-js by ozaki-r - Emulates ARMv7A and some peripherals of Versatile Express, in the browser
Disadvantages of Dynarmic
In the pursuit of speed, some behavior not commonly depended upon is elided. Hence this emulator doesn't match spec. Note that this would mean that a guest application can easily determine if it's being ran under instrumentation.
Known examples:
- Only user-mode is emulated, there is no emulation of any other privilege levels.
- FPSR state is approximate.
- Misaligned loads/stores are not appropriately trapped in certain cases.
- Exclusive monitor behavior may not match any known physical processor.
No formal verification has been done, and no security assessment has been made. Use this code base at your own risk.
Legal
The vendored Dynarmic build files and many project files are marked GPL-3.0-or-later; some upstream files have their own license headers (for example, 0BSD). Check individual file headers for applicable terms.
Dynarmic also uses open-source libraries; consult their respective license terms.