A Study on Retargetable Binary Translation for the ARM Architecture
|摘要:||新的指令集架構往往缺乏足夠的應用程式。為了解決這個問題，二元碼轉譯技術經常被用在移植應用程式到新的指令集架構上。在過去, 動態二元碼轉譯系統(DBT)被廣泛應用是因為它避免了二元碼轉譯下的幾個困難問題，例如針對不定長度指令及的程式碼發現(Code Discovery)問題，以及因為間接跳躍所產生的程式碼位置(Code Location)問題。也因為如此，靜態二元碼轉譯(SBT)通常較少被拿來研究和使用。然而，相對於動態二元碼轉譯，靜態二元碼轉譯可以在轉譯的過程中執行更多的優化，產生更小、質量更高的程式碼。此外，透過靜態二元碼轉譯的應用程式在執行時，相對於動態二元碼轉譯也只需使用較少的記憶體，較低的處理器時脈週期，較少的功耗，也可以較快的開始執行。這些優點在嵌入式系統上尤其關鍵。因此我們相信，即使靜態二元碼轉譯不像動態二元碼轉譯如此普遍，在嵌入式系統上仍然可以扮演獨特的腳色。此篇論文中，我們設計了一個新的靜態二元碼轉譯系統(LLBT)。此系統可以將ARM指令轉換成LLVM的中間表示碼(IR)，然後透過LLVM的編譯系統將IR轉譯到各種不同的指令集架構，包括x86、x86-64、ARM和MIPS等。此外，我們也結合了靜態二元碼轉譯以及動態二元碼轉譯優點，發展出一套混和型的二元碼轉譯系統(HBT)。另外，針對二元碼轉譯系統的驗證我們也有所創新。我們也開發了一套自動化的驗證系統用來驗證轉譯後的程式是否執行正確，讓二元碼系統的開發及除錯不再像是場噩夢。|
Lack of applications has always been a serious concern for designing machines with a new but incompatible ISA. To address this concern, binary translation is one common technique to migrate applications from one legacy ISA to new ones. In the past, dynamic binary translation (DBT) has been more widely adopted for migrating applications since it avoids some challenging problems for binary translation such as code discovery for variable length ISA and code location issues for handling indirect branches. Static binary translation (SBT) is usually regarded as a less general solution and has not been actively researched on. However, SBT has advantages of performing more aggressive optimizations, which could yield more compact code and greater code quality. In general, SBT translated applications are likely to consume less memory, processor cycles and power, and can be started more quickly. All the above advantages are more critical for embedded systems than for general systems. Therefore, we believe that even though SBT is not as general as DBT, it has a unique role to play for migrating applications in embedded systems. In this dissertation, we designed and implemented a new retargetable SBT tool, called LLBT, which translates source binary into LLVM IR and then retargets the LLVM IR to various ISAs, including x86, x86-64, ARM and MIPS. In addition, we present a hybrid binary translation (HBT) system which combines the merits of both SBT and DBT. Furthermore, we innovate on automatic validation of the translated binary code, making the development of binary translation tools less of a nightmare.
|Appears in Collections:||Thesis|