Rozšiřitelný disassembler s podporou interaktivního přerovnávání instrukcí

Abstract

Machine code disassembling is a process of transforming binary machine code into assembly code. The main purpose of this process is to help people to understand the purpose of the program without knowing its source code. Unfortunately, the machine code produced by compilers is quite hard to read due to numerous optimizations applied to it. One substantially problematic optimization is instruction scheduling which mangles instruction order to increase final performance. The goal of this thesis is to implement a disassembler capable of reordering individual instructions. This would allow the user to restructure the machine code into a more read- able form. To provide such functionality, the disassembler has to be able to understand the meaning of machine code instructions. For this reason, we will design a platform- independent internal representation of machine code and we will translate any machine code into it. This representation will be then used to analyze dependencies between in- structions which can be further used in instruction reordering algorithm. At the very end, we will discuss the possibility of platform-independent program emulation based on internal disassembler representation. 1Disassembling strojového kódu je proces, při kterém je binární strojový kód programu přetransformován do podoby assmbly kódu. Smyslem tohoto procesu je napomoci člověku v porozumění fungování programu, jehož zdrojový kód není znám. Strojový kód vypro- dukovaný kompilátory při kompilaci zdrojového kódu je však velmi náročné číst. Na vině jsou mnohé optimalizace a transformace kódu, které kompilátor učinil. Jednou obzvláště problematickou optimalizací je instruction scheduling, jehož úkolem je pozměnit pořadí instrukcí tak, aby výsledný kód byl co možná nejrychlejší. Cílem této práce je vyvinout disassembler schopný měnit pořadí instrukcí v kódu. Tato funkce by uživateli umožnila přeskládat instrukce tak, aby výsledek byl lépe čitelný. Aby disassembler mohl takovou funkcionalitu nabízet, musí být schopen porozumět významu jednotlivých instrukcí. Proto navrhneme kompilátor s vnitřní reprezentací nezávislé na platformě, s jejíž pomocí budeme reprezentovat libovolný strojový kód. Tuto reprezentaci pak bude možné použít k nalezení závislosti mezi instrukcemi, které budou dále použity pro změny jejich pořadí v kódu. Na konci práce probereme možnost emulace běhu pro- gramu. 1Department of Distributed and Dependable SystemsKatedra distribuovaných a spolehlivých systémůMatematicko-fyzikální fakultaFaculty of Mathematics and Physic

    Similar works