Building a Minimal Viable Armv7 Emulator from Scratch
a day ago
- #Rust
- #ARMv7
- #Emulation
- A minimal ARMv7 emulator was developed in Rust with zero dependencies, spanning 1.3k lines of code.
- The emulator parses and validates 32-bit ARM binaries, maps segments, decodes ARM instructions, and translates memory interactions.
- It forwards ARM Linux syscalls to x86-64 System V syscalls, enabling execution of ARM binaries on x86 systems.
- Performance benchmarks show the emulator executes a 'Hello, World!' binary in ~0.015ms (guest execution time), with an end-to-end time of ~2ms, outperforming QEMU in this specific scenario.
- The project includes features like ELF parsing, memory mapping, instruction decoding, and syscall forwarding, with a focus on understanding low-level execution details.
- Syscall handling includes modes for forwarding, sandboxing, and denying, with sandboxing as the default to restrict certain operations.
- The emulator demonstrates the feasibility of lightweight, dependency-free emulation for educational and practical purposes.