qiuyuX/disasm_perf
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
This code measures the x86-64 disassembling performance of Capstone (http://www.capstone-engine.org/), Intel XED (https://intelxed.github.io/), and Zydis (https://zydis.re). parse_elf.py takes ELF binary file as input and generates x86-64 instructions. disasm_perf.c measures on average how many CPU cycles are taken to disassemble each instruction. Environment ----------- The code was tested in Ubuntu 16.04 with 4.4.0 kernel. It should be able to run in other Linux systems as well. Compile code ------------ * Install Capstone. In Ubuntu, run "sudo apt-get install libcapstone-dev". * Follow the steps in https://intelxed.github.io/build-manual/ to build and install Intel XED. Make sure headers and static libraries are installed in path where GCC can find. * Follow the steps in https://zyantific.com/doc/zydis/ to build and install Zydis. * Install The GNU Multiple Precision Arithmetic Library. In Ubuntu, run "sudo apt-get install libgmp3-dev". * Run "make". Run test -------- ./parse_elf.py <elf_file> | ./disasm_perf <option> <elf_file> is the ELF executable's file path, e.g., /bin/ls. <option> selects the disassembling engines and output modes. Below are several examples: ./parse_elf.py <elf_file> | ./disasm_perf --capstone Choose Capstone to disassemble x86-64 instructions. ./parse_elf.py <elf_file> | ./disasm_perf --capstone --verbose Choose Capstone to disassemble x86-64 instructions, and print per-instruction disassembling time. ./parse_elf.py <elf_file> | ./disasm_perf --capstone --detail Choose Capstone to disassemble x86-64 instructions, and get more details for the disassembled instruction, e.g., implicit register read/write. ./parse_elf.py <elf_file> | ./disasm_perf --xed Choose XED to disassemble the x86-64 instructions. XED always gives detailed disassembling result. ./parse_elf.py <elf_file> | ./disasm_perf --zydis Choose Zydis to disassemble the x86-64 instructions. Zydis always gives detailed disassembling result.