• 沒有找到結果。

Dynamic Binary Translators for Embedded Systems

Some recent research focused on improving DBT’s memory footprint and performance for embedded systems. Guha et al. [2007] proposed techniques to reduce the size of exit stubs in the translated code. They also proposed a dynamic trace selection strategy and a selective cache flushing strategy to improve memory efficiency and performance [Guha et al. 2012]. Baiocchi et al. [2008] proposed techniques to minimize the space needed by trampolines, indirect branch handling, and context switch code in a DBT for embedded systems with scratchpad memory. Their approach can significantly improve performance in constrained code caches. They also developed methods to compress the evicted code in constrained code caches to avoid re-translating previously seen code [Baiocchi et al. 2007]. Moore et al. [2009] provided another form of code cache management on embedded systems. Their techniques improve locality and reduce TLB pressure by arranging data and code in code caches for the ARM architecture. However, these DBTs’ methods address the management of constrained code caches and focus on utilizing code caches effectively. LLBT tries to avoid runtime translation overhead and improve the quality of generated code. There are no code cache issues for SBT.

6. CONCLUSIONS

This paper presents a retargetable SBT called LLBT, which translates ARM binaries into LLVM IRs and leverages the LLVM to generate binaries for different target archi-tectures. DBT is usually the first choice for migrating application binaries from one ISA to another. However, for embedded systems, start-up time, memory usage, and power

SBT. Because we target compiler-generated code rather than hand-crafted binaries, we could narrow down the possible destinations of indirect branches for inclusion in the AMT. In addition, SMC rarely happens in the applications available in Google Play.

Hence, we believe using SBT for migrating applications under Android for embedded systems to be a viable and practical solution.

In this article, we have discussed issues related to code generation in terms of regis-ter mapping, conditional execution, indirect branch, and helper function replacement.

These are techniques that make LLBT an effective and efficient retargetable binary translator. Our experiments show that LLBT-translated code can run more than 6× and 2.3× faster than a retargetable DBT system (i.e., QEMU) and a trace-based DBT system (i.e., HQEMU), respectively, on small and short-running embedded benchmarks. With the help of the comprehensive optimizations in LLVM, LLBT can effectively support migrating applications to new architectures, especially embedded environments. We have demonstrated its retargetability by translating ARM binaries into×86, ×86–64, ARM, and MIPS on real hardware, with high migration efficiency.

REFERENCES

E. R. Altman, D. Kaeli, and Y. Sheffer. 2000. Welcome to the opportunities of binary translation. Computer 33, 3 (March 2000), 40–45.

Kristy Andrews and Duane Sand. 1992. Migrating a CISC computer family onto RISC via object code trans-lation. In Proceedings of the 5th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS-V). ACM, New York, 213–222.

ARM Limited 2012. Run-time ABI for the ARM Architecture. ARM Limited.

Jose Baiocchi, Bruce R. Childers, Jack W. Davidson, Jason D. Hiser, and Jonathan Misurda. 2007. Fragment cache management for dynamic binary translators in embedded systems with scratchpad. In Proceedings of the 2007 International Conference on Compilers, Architecture, and Synthesis for Embedded Systems (CASES’07). ACM, New York, 75–84. DOI:http://dx.doi.org/10.1145/1289881.1289898

Jos´e A. Baiocchi, Bruce R. Childers, Jack W. Davidson, and Jason D. Hiser. 2008. Reducing pressure in bounded DBT code caches. In Proceedings of the 2008 International Conference on Compilers, Architec-tures and Synthesis for Embedded Systems (CASES’08). ACM, New York, 109–118. DOI:http://dx.doi.

org/10.1145/1450095.1450114

Sorav Bansal and Alex Aiken. 2006. Automatic generation of peephole superoptimizers. In Proceedings of the 12th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS-XII). ACM, New York, 394–403. DOI:http://dx.doi.org/10.1145/1168857.1168906 Sorav Bansal and Alex Aiken. 2008. Binary translation using peephole superoptimizers. In Proceedings

of the 8th USENIX Conference on Operating Systems Design and Implementation (OSDI’08). USENIX Association, Berkeley, CA, 177–192.

Leonid Baraz, Tevi Devor, Orna Etzion, Shalom Goldenberg, Alex Skaletsky, Yun Wang, and Yigel Zemach.

2003. IA-32 execution layer: A two-phase dynamic translator designed to support IA-32 applications on Itanium-based systems. In Proceedings of the 36th Annual IEEE/ACM International Symposium on Microarchitecture (MICRO’36). IEEE Computer Society, Washington, DC, 191–204.

Fabrice Bellard. 2005. QEMU, a fast and portable dynamic translator. In Proceedings of the Annual Confer-ence on USENIX Annual Technical ConferConfer-ence (ATEC’05). USENIX Association, Berkeley, CA, 41–41.

Derek Bruening, Timothy Garnett, and Saman Amarasinghe. 2003. An infrastructure for adaptive dynamic optimization. In Proceedings of the International Symposium on Code Generation and Optimization (CGO’03). IEEE Computer Society, Washington, DC, 265–275.

Dominique Chanet, Bjorn De Sutter, Bruno De Bus, Ludo Van Put, and Koen De Bosschere. 2007. Automated reduction of the memory footprint of the Linux kernel. ACM Transactions in Embedded Computer Systems 6, 4, Article 23 (Sept. 2007). DOI:http://dx.doi.org/10.1145/1274858.1274861

Jiunn-Yeu Chen, Bor-Yeh Shen, Yuan-Jia Li, Wuu Yang, and Wei-Chung Hsu. 2013a. Automatic validation for static binary translation. In Proceedings of the 2nd Asia-Pacific Programming Languages and Compilers Workshop (APPLC’13). ACM, New York, 1–9.

Jiunn-Yeu Chen, Bor-Yeh Shen, Quan-Huei Ou, Wuu Yang, and Wei-Chung Hsu. 2013b. Effective code discovery for ARM/Thumb mixed ISA binaries in a static binary translator. In Proceedings of the 2013 International Conference on Compilers, Architectures and Synthesis for Embedded Systems (CASES’13).

ACM, New York, IEEE, Piscataway, NJ, 1–10.

Jiunn-Yeu Chen, Wuu Yang, Charlie Su, and Wei-Chung Hsu. 2008. A static binary translator for efficient migration of ARM based applications. In Proceedings of the 6th Workshop on Optimizations for DSP and Embedded Systems (ODES’08). ACM, New York, 55–64.

Anton Chernoff, Mark Herdeg, Ray Hookway, Chris Reeve, Norman Rubin, Tony Tye, S. Bharadwaj Yadavalli, and John Yates. 1998. FX!32: A profile-directed binary translator. IEEE Micro 18, Issue 2 (March 1998), 56–64.

Cristina Cifuentes and Mike Van Emmerik. 1999. Recovery of jump table case statements from binary code. In Proceedings of the 7th International Workshop on Program Comprehension (IWPC’99). IEEE Computer Society, Washington, DC, 192–199.

Cristina Cifuentes and Mike Van Emmerik. 2000. UQBT: Adaptable binary translation at low cost. Computer 33 (March 2000), 60–66. Issue 3.

Cristina Cifuentes, Brian Lewis, and David Ung. 2002a. Walkabout: A Retargetable Dynamic Binary Trans-lation Framework. Technical Report. Mountain View, CA.

Cristina Cifuentes and Vishv M. Malhotra. 1996. Binary translation: Static, dynamic, retargetable? In Proceedings of the 1996 International Conference on Software Maintenance (ICSM’96). IEEE Computer Society, Washington, DC, 340–349.

Cristina Cifuentes, Mike Van Emmerik, Norman Ramsey, and Brian Lewis. 2002b. Experience in the Design, Implementation and Use of a Retargetable Static Binary Translation Framework. Technical Report.

Mountain View, CA.

Bjorn De Sutter, Ludo Van Put, Dominique Chanet, Bruno De Bus, and Koen De Bosschere. 2007. Link-time compaction and optimization of ARM executables. ACM Transactions on Embedded Computer Systems 6, 1 (Feb. 2007), Article 5. DOI:http://dx.doi.org/10.1145/1210268.1210273

Kemal Ebcio ˘glu and Erik R. Altman. 1997. DAISY: Dynamic compilation for 100 compatibility. SIGARCH Comput. Archit. News 25, 2 (May 1997), 26–37. DOI:http://dx.doi.org/10.1145/384286.264126

Michael Gschwind, Erik R. Altman, Sumedh Sathaye, Paul Ledak, and David Appenzeller. 2000. Dynamic and transparent binary translation. Computer 33, 3 (March 2000), 54–59.

Apala Guha, Kim Hazelwood, and Mary Lou Soffa. 2007. Reducing exit stub memory consumption in code caches. In Proceedings of the 2nd International Conference on High Performance Embedded Architectures and Compilers (HiPEAC’07). Springer-Verlag, Berlin, 87–101.

Apala Guha, Kim Hazelwood, and Mary Lou Soffa. 2012. Memory optimization of dynamic binary translators for embedded systems. ACM Transactions on Architecture and Code Optimization 9, 3, Article 22 (Oct.

2012), 29 pages. DOI:http://dx.doi.org/10.1145/2355585.2355595

Ding-Yong Hong, Chun-Chen Hsu, Pen-Chung Yew, Jan-Jan Wu, Wei-Chung Hsu, Pangfeng Liu, Chien-Min Wang, and Yeh-Ching Chung. 2012. HQEMU: A multi-threaded and retargetable dynamic binary translator on multicores. In Proceedings of the 10th International Symposium on Code Generation and Optimization (CGO’12). ACM, New York, 104–113. DOI:http://dx.doi.org/10.1145/2259016.2259030 Yuan-Shin Hwang, Tzong-Yen Lin, and Rong-Guey Chang. 2010. DisIRer: Converting a retargetable compiler

into a multiplatform binary translator. ACM Transactions on Architecture and Code Optimization 7, 4 (December 2010), Article 18, 36 pages.

Dawid Kurzyniec and Vaidy Sunderam. 2001. Efficient cooperation between Java and native codes - JNI performance benchmark. In Proceedings of the 2001 International Conference on Parallel and Distributed Processing Techniques and Applications. Computer Science Research, Education, and Applications Press, Athens, GA, 2232–2239.

Chris Lattner and Vikram Adve. 2004. LLVM: A compilation framework for lifelong program analysis &

transformation. In Proceedings of the International Symposium on Code Generation and Optimization (CGO’04). IEEE Computer Society, Washington, DC, 75–86.

Sangchul Lee and Jae Wook Jeon. 2010. Evaluating performance of Android platform using native C for embedded systems. In Proceedings of the 2010 International Conference on Control Automation and Systems (ICCAS’10). IEEE Computer Society, Washington, DC, 1160–1163.

Chi-Keung Luk, Robert Cohn, Robert Muth, Harish Patil, Artur Klauser, Geoff Lowney, Steven Wallace, Vijay Janapa Reddi, and Kim Hazelwood. 2005. Pin: Building customized program analysis tools with

Steven S. Muchnick. 1998. Advanced Compiler Design and Implementation. Morgan Kaufmann.

Kevin Scott, Jack W. Davidson, and Kevin Skadron. 2001. Low-Overhead Software Dynamic Translation.

Technical Report CS-2001-18. Department of Computer Science, University of Virginia, Charlottesville.

K. Scott, N. Kumar, S. Velusamy, B. Childers, J. W. Davidson, and M. L. Soffa. 2003. Retargetable and reconfigurable software dynamic translation. In Proceedings of the International Symposium on Code Generation and Optimization (CGO’03). IEEE Computer Society, Washington, DC, 36–47.

David Seal. 2000. ARM Architecture Reference Manual. Addison-Wesley Longman.

Bor-Yeh Shen, Jyun-Yan You, Wuu Yang, and Wei-Chung Hsu. 2012. An LLVM-based hybrid binary transla-tion system. In Proceedings of the 7th IEEE Internatransla-tional Symposium on Industrial Embedded Systems (SIES’12). IEEE Computer Society, Washington, DC, 229–236.

Richard L. Sites, Anton Chernoff, Matthew B. Kirk, Maurice P. Marks, and Scott G. Robinson. 1993. Binary translation. Communication ACM 36, 2 (February 1993), 69–81.

Jim Smith and Ravi Nair. 2005. Virtual Machines: Versatile Platforms for Systems and Processes. Morgan Kaufmann.

David Ung and Cristina Cifuentes. 2000. Machine-adaptable dynamic binary translation. In Proceedings of the ACM SIGPLAN Workshop on Dynamic and Adaptive Compilation and Optimization (DYNAMO’00).

ACM, New York, 41–51.

Chih-Sheng Wang, Guillermo Perez, Yeh-Ching Chung, Wei-Chung Hsu, Wei-Kuan Shih, and Hong-Rong Hsu. 2011. A method-based ahead-of-time compiler for android applications. In Proceedings of the 14th International Conference on Compilers, Architectures and Synthesis for Embedded Systems (CASES’11).

ACM, New York, 15–24. DOI:http://dx.doi.org/10.1145/2038698.2038704

Xinran Wang, Yoon-Chan Jhi, Sencun Zhu, and Peng Liu. 2008. STILL: Exploit code detection via static taint and initialization analyses. In Proceedings of the 24th Annual Computer Security Applications Conference (ACSAC’08). IEEE, Los Alamitos, CA, 289–298.

Cindy Zheng and Carol Thompson. 2000. PA-RISC to IA-64: Transparent execution, no recompilation. Com-puter 33, 3 (March 2000), 47–52.

Received October 2013; revised January 2014; accepted January 2014

相關文件