Binary translation for legacy applications
Our advanced binary translation solutions are based on our experience with virtual machines, just-in-time compilation and embedded operating systems. Accurate emulation is provided, enabling even the side-by-side execution of legacy applications with modern embedded operating systems.
Overview
Theobroma Systems provides binary translation solutions for customers, who wish to migrate their embedded applications to different processor architectures and platforms. Based on our expertise in compilers and virtual machines, we offer binary translation solutions for the translation between virtually any two architectures. The current application focus is on the translation from legacy x86 platforms to and emulation on current ARMv5, ARMv6, MIPS32 and PowerPC solutions.
Our products for the migration of legacy software to new platforms are based on dynamic binary translation: by translating code at the level of basic blocks, a cache of translated basic blocks is created; whenever branching into already translated code, direct branches are inserted. If necessary, already translated code can be re-translated under the direction of an optimizer to reconstruct programming language functions (or "superblocks"). Such "superblocks" eliminate unnecessary inter-block branches. An optimal tradeoff between application performance and memory footprint can be approached by adapting basic parameters of the translator (i.e., the amount of memory used for caching translated code, the types of optimizations used, etc.).
Operating system calls are redirected to an emulation layer, as it is the case for direct accesses to embedded peripheral devices. We support multiple mechanisms to trap such operations and interface to different emulation layers: the machine and platform personalities provided are as individual as customer applications.
Unlike static translation, dynamic translation accurately mimics the execution semantics of the source platform. This provides for the correct processing of uncommon and complex implementation techniques used in some legacy applications: even indirect branches, whose target address is only known at run-time, and self-modifying code can be migrated.
Functional consolidation through binary translation and device partitioning
Modern embedded microprocessors are considerably more powerful than earlier generations, often improving their performance by orders of magnitudes. This fact results in tremendous performance gains when introducing current processors into embedded systems that have been designed five to ten years ago. Even when taking the processing power absorbed by added functionality and features into account, sufficient performance reserves remain to consolidate independent functions of an embedded system onto a single device.
Functional consolidation of multiple functions using binary
translation.
Multiple functions implemented by distinct
legacy applications can be consolidated into a single
system. Emulation of each legacy device is provided by dynamic
binary translation. Isolated partitions with guaranteed resources
ensure reliability.
Binary translation, combined with our embedded OS virtualization and partitioning technologies, offers a consistent and reliable solution for the consolidation of multiple device functions within a single system image: even functions implemented using architecture-specific features, can be reliably integrated. Each function or work-load executes in a separate device partition, isolating individual modules from each other and guaranteeing resource availability.
Under the hood: how binary translation works
Dynamic binary translation is rather similar to the execution and just-in-time compilation of Java byte-code. However, unlike executing Java, a number of additional challenges have to be overcome:
- Executables are not intended as input to a compiler, but are optimized for compact storage and low runtime overheads. Consequently, the extraction of an intermediate representation from a native executable is more difficult and significantly less information can be retrieved than from Java class files. To improve performance inspite of the limited information available, an optional runtime profile and optimizer continuously tracks the execution of translated code and feeds back into a dynamic optimizer.
- Self-modifying code and indirect branches need to function correctly with a transparent binary translator. To ensure this, both dispatches into untranslated code need to be detected and modifications to the original code space have to be trapped. Our technology utilizes multiple mechanisms to achieve that these goals are reached reliably and efficiently. Both operating system mechanisms, such as the MMU-assisted protection of certain memory regions, and inlined detection code (where appropriate) are used.
- Depending on the legacy application environment, either legacy peripheral devices or legacy operating system services need to be emulated. The binary translator traps both OS interface calls and memory accesses to legacy peripherals: these are redirected to an emulation layer. This emulation layer can either be a standard module (e.g., when translating from Linux/x86 to Linux/PowerPC) or an entirely custom module (e.g., when emulating a legacy platform with embedded peripherals).
A diagram of the individual subsystems of our binary translation solution and their interaction is provided below for easier reference:
Anatomy of dynamic binary translation.
The binary
translator executes unmodified legacy applications. On application
startup, the execution of untranslated code is detected and
automatically translated. Optional optimization and profiling
modules extract additional information from the execution to
optimize performance. If direct hardware accesses are performed by
the legacy application, these are handled by an application- and
platform-specific emulation layer.
Even though a considerable amount of technology is involved in binary translation, both the solution's footprint and its performance impact can be kept moderate: depending on the legacy application's requirements, even close to the performance of a native executable is achievable.
Tailored binary translation for everyone
Our binary translation technology includes solutions for
- semiconductor vendors who wish to provide a migration (or competitive upgrade) path for their customers' legacy applications,
- systems integrators who need a solution for the integration of legacy applications, and
- embedded application developers looking to extend the reach of their product to new platforms.
As most applications are different, we offer extensive customization services for our binary translation technology to match the needs of each legacy application as closely as possible:
- development of emulation layers for peripherals and legacy operating systems;
- integration into board support kits;
- performance tuning and application-specific optimizations;
- tuning for specific footprint and response-time requirements.
To analyse your application requirements, please contact us.
Contact us
If you have questions, require further details or would like to discuss the use of our binary translation solutions for your application, don't hesitate to contact us.
