Skip to main content

LAST: An Efficient In-place Static Binary Translator for RISC Architectures

  • Conference paper
  • First Online:
Algorithms and Architectures for Parallel Processing (ICA3PP 2023)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 14488))

  • 150 Accesses

Abstract

The lack of software has been a persistent issue for emerging instruction set architecture (ISA). To overcome this challenge, binary translation has emerged as a widely adopted solution, enabling programs written for older ISA to run on new ones. In the past, dynamic binary translation (DBT) was commonly utilized for software migration, but this technique required dynamic translation and often suffered from suboptimal efficiency. In contrast, Static binary translation (SBT) is an offline technique for translating binary code without runtime translation overhead. Existing SBT systems always employ address mapping tables to handle the address relocation problem, but this approach introduces performance overhead and leads to issues with indirect jump correctness. To address these limitations, we propose a novel static in-place instruction translation method for reduced-instruction set computing (RISC) architectures. This method ensures that the address of the guest program remains unchanged after translation, leveraging the regular length of various RISC instructions. We have implemented this method in a portable SBT tool called LAST, specifically designed to run MIPS or RISCV programs on the LoongArch platform. Based on the SPEC CPU2000 benchmark results, LAST achieves over 80% performance compared to the native LoongArch program, demonstrating its effectiveness and efficiency.

Supported by The National Key Research and Development Program of China under grant number 2022YFB3105103.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 59.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 79.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Apple: Rosetta. https://support.apple.com/en-us/HT211861

  2. Baraz, L., et al.: IA-32 execution layer: a two-phase dynamic translator designed to support IA-32 applications on Itanium/spl reg/-based systems. In: 2003 Proceedings of the 36th Annual IEEE/ACM International Symposium on Microarchitecture, MICRO-36, pp. 191–201 (2003). https://doi.org/10.1109/MICRO.2003.1253195

  3. Bauman, E., Lin, Z., Hamlen, K.W.: Superset disassembly: statically rewriting x86 binaries without heuristics. In: 25th Annual Network and Distributed System Security Symposium, NDSS 2018. Internet Society, Reston (2018). wOS:000722005800038. https://doi.org/10.14722/ndss.2018.23300

  4. Bellard, F.: QEMU, a fast and portable dynamic translator. In: Proceedings of the FREENIX Track: 2005 USENIX Annual Technical Conference, 10–15 April 2005, pp. 41–46. USENIX, Anaheim (2005). https://www.usenix.org/events/usenix05/tech/freenix/bellard.html

  5. Bruening, D., Garnett, T., Amarasinghe, S.: An infrastructure for adaptive dynamic optimization. In: 2003 International Symposium on Code Generation and Optimization, CGO 2003, pp. 265–275 (2003). https://doi.org/10.1109/CGO.2003.1191551

  6. Bruening, D., Garnett, T., Amarasinghe, S.: An infrastructure for adaptive dynamic optimization. In: Proceedings of the International Symposium on Code Generation and Optimization: Feedback-Directed and Runtime Optimization, CGO 2003, pp. 265–275. IEEE Computer Society, USA (2003)

    Google Scholar 

  7. Chow, F.C., Himelstein, M.I., Killian, E., Weber, L.: Engineering a RISC compiler system. In: COMPCON, pp. 132–137 (1986)

    Google Scholar 

  8. Cifuentes, C., Van Emmerik, M.: UQBT: adaptable binary translation at low cost. Computer 33(3), 60–66 (2000). https://doi.org/10.1109/2.825697

    Article  Google Scholar 

  9. Cota, E.G., Bonzini, P., Bennée, A., Carloni, L.P.: Cross-ISA machine emulation for multicores. In: Proceedings of the 2017 International Symposium on Code Generation and Optimization, CGO 2017, pp. 210–220. IEEE Press (2017)

    Google Scholar 

  10. Cota, E.G., Carloni, L.P.: Cross-ISA machine instrumentation using fast and scalable dynamic binary translation. In: Proceedings of the 15th ACM SIGPLAN/SIGOPS International Conference on Virtual Execution Environments, VEE 2019, pp. 74–87. Association for Computing Machinery, New York (2019). https://doi.org/10.1145/3313808.3313811

  11. Cunha, M., Fournel, N., Pétrot, F.: Collecting traces in dynamic binary translation based virtual prototyping platforms. In: Proceedings of the 2015 Workshop on Rapid Simulation and Performance Evaluation: Methods and Tools, RAPIDO 2015, Association for Computing Machinery, New York (2015). https://doi.org/10.1145/2693433.2693437

  12. d’Antras, A., Gorgovan, C., Garside, J., Luján, M.: Optimizing indirect branches in dynamic binary translators. ACM Trans. Archit. Code Optim. 13(1) (2016). https://doi.org/10.1145/2866573

  13. Dehnert, J.C., et al.: The Transmeta Code Morphing\(^{\rm TM}\) software: using speculation, recovery, and adaptive retranslation to address real-life challenges. In: Proceedings of the International Symposium on Code Generation and Optimization: Feedback-Directed and Runtime Optimization, CGO 2003, pp. 15–24. IEEE Computer Society, USA (2003)

    Google Scholar 

  14. Eyolfson, J., Lam, P.: Detecting unread memory using dynamic binary translation. In: Qadeer, S., Tasiran, S. (eds.) RV 2012. LNCS, vol. 7687, pp. 49–63. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-35632-2_8

    Chapter  Google Scholar 

  15. Federico, A.D., Agosta, G.: A jump-target identification method for multi-architecture static binary translation. In: 2016 International Conference on Compliers, Architectures, and Synthesis of Embedded Systems (CASES), pp. 1–10 (2016)

    Google Scholar 

  16. Horspool, R., Marovac, N.: An approach to the problem of detranslation of computer-programs. Comput. J. 23(3), 223–229 (1980). WOS:A1980KD91500005. https://doi.org/10.1093/comjnl/23.3.223

  17. Hu, W., et al.: Godson-3B: a 1GHz 40W 8-core 128GFLOPS processor in 65nm CMOS. In: 2011 IEEE International Solid-State Circuits Conference, pp. 76–78 (2011). https://doi.org/10.1109/ISSCC.2011.5746226

  18. Hu, W., Yang, L., Fan, B., Wang, H., Chen, Y.: An 8-core MIPS-compatible processor in 32/28 nm bulk CMOS. IEEE J. Solid-State Circ. 49(1), 41–49 (2014). https://doi.org/10.1109/JSSC.2013.2284649

    Article  Google Scholar 

  19. Hu, W., et al.: Godson-3B1500: a 32nm 1.35GHz 40W 172.8GFLOPS 8-core processor. In: 2013 IEEE International Solid-State Circuits Conference Digest of Technical Papers, pp. 54–55 (2013). https://doi.org/10.1109/ISSCC.2013.6487634

  20. Luk, C.K., et al.: Pin: building customized program analysis tools with dynamic instrumentation. In: Proceedings of the 2005 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2005, pp. 190–200. Association for Computing Machinery, New York (2005). https://doi.org/10.1145/1065010.1065034

  21. Molnar, I.: Performance counters for Linux (2009). https://lwn.net/Articles/337493/. Accessed 23 Feb 2022

  22. Niu, G., Zhang, F., Li, X.: Eliminate the overhead of interrupt checking in full-system dynamic binary translator. In: Proceedings of the 15th ACM International Conference on Systems and Storage (2022)

    Google Scholar 

  23. Prasad, M.: A binary rewriting defense against stack-based buffer overflow attacks. In: 2003 USENIX Annual Technical Conference, USENIX ATC 03, San Antonio, TX, June 2003. USENIX Association (2003). https://www.usenix.org/conference/2003-usenix-annual-technical-conference/binary-rewriting-defense-against-stack-based

  24. Shen, B.Y., Chen, J.Y., Hsu, W.C., Yang, W.: LLBT: an LLVM-based static binary translator. In: International Conference on Compilers, Architecture, and Synthesis for Embedded Systems (2012)

    Google Scholar 

  25. Shen, B.Y., Hsu, W.C., Yang, W.: A retargetable static binary translator for the arm architecture. ACM Trans. Archit. Code Optim. 11(2) (2014). https://doi.org/10.1145/2629335

  26. Loongson Technology: Loongarch documentation (2022). https://loongson.github.io/LoongArch-Documentation/

  27. Weiwu, H., et al.: Loongson instruction set architecture technology. J. Comput. Res. Dev., 1–22 (2022)

    Google Scholar 

  28. Wenzl, M., Merzdovnik, G., Ullrich, J., Weippl, E.: From hack to elaborate technique - a survey on binary rewriting. ACM Comput. Surv. 52(3), 1–37 (2020)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Fuxin Zhang .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2024 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Lan, Y., Hu, Q., Niu, G., Li, X., Wang, L., Zhang, F. (2024). LAST: An Efficient In-place Static Binary Translator for RISC Architectures. In: Tari, Z., Li, K., Wu, H. (eds) Algorithms and Architectures for Parallel Processing. ICA3PP 2023. Lecture Notes in Computer Science, vol 14488. Springer, Singapore. https://doi.org/10.1007/978-981-97-0801-7_14

Download citation

  • DOI: https://doi.org/10.1007/978-981-97-0801-7_14

  • Published:

  • Publisher Name: Springer, Singapore

  • Print ISBN: 978-981-97-0800-0

  • Online ISBN: 978-981-97-0801-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics