Abstract
The shortage of applications has become a major concern for new Instruction Set Architecture (ISA). Binary translation is a common solution to overcome this challenge. However, the performance of binary translation is heavily dependent on the quality of the translated code. To achieve high-quality translation, recent studies focus on integrating binary translators with compilation optimization methods. Nevertheless, such integration faces two main challenges. Firstly, it is hard to employ complex compilation optimization techniques in a dynamic binary translator (DBT) without introducing significant runtime overhead. Secondly, the task of implementing register mapping in the compiler is challenging, which can reduce expensive memory access instructions generated to maintain the guest CPU state. To resolve these challenges, we propose a hybrid binary translation system with multi-stage feedback, combining dynamic and static binary translator, named MFHBT. This system eliminates the runtime overhead caused by compilation optimization. Additionally, we introduce a mechanism to implement the register mapping through inline constraints and stack variables in the compiler. We implement a prototype of this new system powered by LLVM. Experimental results demonstrate an 81% decrease in the number of memory access instructions and a performance improvement of 3.28 times compared to QEMU.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
The EFLAGS register is the status register that contains the current state of a x86 CPU.
References
Altman, E.R., Kaeli, D., Sheffer, Y.: Welcome to the opportunities of binary translation. Computer 33(3), 40–45 (2000)
Bala, V., Duesterwald, E., Banerjia, S.: Dynamo: a transparent dynamic optimization system. In: Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation, pp. 1–12 (2000)
Bellard, F.: QEMU, a fast and portable dynamic translator. In: USENIX Annual Technical Conference, FREENIX Track, California, USA, vol. 41, p. 46 (2005)
Bezzubikov, A., Belov, N., Batuzov, K.: Automatic dynamic binary translator generation from instruction set description. In: 2017 Ivannikov ISPRAS Open Conference (ISPRAS), pp. 27–33. IEEE (2017)
Borin, E., Wu, Y.: Characterization of DBT overhead. In: 2009 IEEE International Symposium on Workload Characterization (IISWC), pp. 178–187. IEEE (2009)
Chen, J.Y., Yang, W., Hsu, W.C., Shen, B.Y., Ou, Q.H.: On static binary translation of ARM/Thumb mixed ISA binaries. ACM Trans. Embed. Comput. Syst. (TECS) 16(3), 1–25 (2017)
Chen, W., Shen, L., Lu, H., Wang, Z., Xiao, N.: A light-weight code cache design for dynamic binary translation. In: 2009 15th International Conference on Parallel and Distributed Systems, pp. 120–125. IEEE (2009)
Chernoff, A., et al.: FX! 32: a profile-directed binary translator. IEEE Micro 18(02), 56–64 (1998)
Cifuentes, Malhotra: Binary translation: static, dynamic, retargetable? In: 1996 Proceedings of International Conference on Software Maintenance, pp. 340–349. IEEE (1996)
Duesterwald, E., Bala, V.: Software profiling for hot path prediction: less is more. ACM SIGARCH Comput. Archit. News 28(5), 202–211 (2000)
Engelke, A., Okwieka, D., Schulz, M.: Efficient LLVM-based dynamic binary translation. In: VEE 2021, pp. 165–171. Association for Computing Machinery, New York (2021)
Fu, S.Y., Hong, D.Y., Wu, J.J., Liu, P., Hsu, W.C.: SIMD code translation in an enhanced HQEMU. In: 2015 IEEE 21st International Conference on Parallel and Distributed Systems (ICPADS), pp. 507–514. IEEE (2015)
Guan, H., et al.: A dynamic-static combined code layout reorganization approach for dynamic binary translation. J. Softw. 6(12), 2341–2349 (2011)
Guan, H., Zhu, E., Wang, H., Ma, R., Yang, Y., Wang, B.: SINOF: a dynamic-static combined framework for dynamic binary translation. J. Syst. Archit. 58(8), 305–317 (2012)
Hong, D.Y., et al.: HQEMU: a multi-threaded and retargetable dynamic binary translator on multicores. In: Proceedings of the Tenth International Symposium on Code Generation and Optimization, pp. 104–113 (2012)
Hu, W., Wang, J., Gao, X., Chen, Y., Liu, Q., Li, G.: Godson-3: a scalable multicore RISC processor with x86 emulation. IEEE Micro 29, 17–29 (2009)
Inoue, H., Hayashizaki, H., Wu, P., Nakatani, T.: A trace-based Java JIT compiler retrofitted from a method-based compiler. In: International Symposium on Code Generation and Optimization (CGO 2011), pp. 246–256. IEEE (2011)
Lattner, C., Adve, V.: LLVM: a compilation framework for lifelong program analysis & transformation. In: International Symposium on Code Generation and Optimization, CGO 2004, pp. 75–86. IEEE (2004)
Li, W., Luo, X., Zhang, Y., Meng, Q., Ren, F.: CrossDBT: an LLVM-based user-level dynamic binary translation emulator. In: Cano, J., Trinder, P. (eds.) Euro-Par 2022. LNCS, vol. 13440, pp. 3–18. Springer, Cham (2022). https://doi.org/10.1007/978-3-031-12597-3_1
Liu, I.C., Wu, I.W., Shann, J.J.J.: Instruction emulation and OS supports of a hybrid binary translator for x86 instruction set architecture. In: 2015 IEEE 12th International Conference on Ubiquitous Intelligence and Computing and 2015 IEEE 12th International Conference on Autonomic and Trusted Computing and 2015 IEEE 15th International Conference on Scalable Computing and Communications and Its Associated Workshops (UIC-ATC-ScalCom), pp. 1070–1077. IEEE (2015)
Payer, M., Gross, T.R.: Generating low-overhead dynamic binary translators. In: Proceedings of the 3rd Annual Haifa Experimental Systems Conference, pp. 1–14 (2010)
Shen, B.Y., Chen, J.Y., Hsu, W.C., Yang, W.: LLBT: an LLVM-based static binary translator. In: Proceedings of the 2012 International Conference on Compilers, Architectures and Synthesis for Embedded Systems, pp. 51–60 (2012)
Shen, B.Y., You, J.Y., Yang, W., Hsu, W.C.: An LLVM-based hybrid binary translation system. In: 7th IEEE International Symposium on Industrial Embedded Systems (SIES 2012), pp. 229–236. IEEE (2012)
Shi, H., Wang, Y., Guan, H., Liang, A.: An intermediate language level optimization framework for dynamic binary translation. ACM SIGPLAN Not. 42(5), 3–9 (2007)
Spink, T., Wagstaff, H., Franke, B., Topham, N.: Efficient code generation in a region-based dynamic binary translator. In: Proceedings of the 2014 SIGPLAN/SIGBED Conference on Languages, Compilers and Tools for Embedded Systems, pp. 3–12 (2014)
Ung, D., Cifuentes, C.: Dynamic re-engineering of binary code with run-time feedbacks. In: Proceedings Seventh Working Conference on Reverse Engineering, pp. 2–10. IEEE (2000)
Weiwu, H., et al.: Loongson instruction set architecture technology. J. Comput. Res. Dev. 60, 2–16 (2023). (in Chinese)
Wenzl, M., Merzdovnik, G., Ullrich, J., Weippl, E.: From hack to elaborate technique-a survey on binary rewriting. ACM Comput. Surv. (CSUR) 52(3), 1–37 (2019)
Acknowledgment
We would like to thank all the anonymous reviewers for their helpful comments and suggestions. This project is funded by the 2022 National Key Research and Development Program “Security Protection Technology for Distribution Network Key Information Infrastructure” Project 3 Distribution Network Computing Equipment Security Enhancement Technology Research and Localization Development (Project No. 2022YFB3105103).
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2024 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.
About this paper
Cite this paper
Yang, Z. et al. (2024). MFHBT: Hybrid Binary Translation System with Multi-stage Feedback Powered by LLVM. In: Li, C., Li, Z., Shen, L., Wu, F., Gong, X. (eds) Advanced Parallel Processing Technologies. APPT 2023. Lecture Notes in Computer Science, vol 14103. Springer, Singapore. https://doi.org/10.1007/978-981-99-7872-4_18
Download citation
DOI: https://doi.org/10.1007/978-981-99-7872-4_18
Published:
Publisher Name: Springer, Singapore
Print ISBN: 978-981-99-7871-7
Online ISBN: 978-981-99-7872-4
eBook Packages: Computer ScienceComputer Science (R0)