Program for generating an instruction decoder for Captive derived from the ARM ISA specification.
- Install
python3
- Install the following with pip
- Then, clone the repo
- Decompressed ARM spec and symlink the
A64_v82A_ISA_xml_00bet3.1
directory tospec/
- Run
main.py
- Output c++ files can be found in
out/
directory
General development scripts
For determining the number of instruction types from the Captive project's decode file - obviously should not be considered a complete set.
Example
awk -f instruction_types.awk <<captive/arch/aarch64/aarch64-decode.cpp>>
For finding all of the instructions that trigger the end of a block, so that it can be determined what property of the instructions in the XML spec files determines this.
To execute,
awk -f end_of_block.awk <<captive/arch/aarch64/aarch64-decode.cpp>> | sort | uniq | grep "true"
Source Code
A standalone disassembler that uses the generated decoder to disasemble a given ARM binary
gcc main.cpp -o decode.o -lstdc++ -Wno-c++11-extensions
The code for parsing the ISA spec's XML files, generated decoder, and outputing that as C++ code in a created root-level "out" directory
This is what parses the XML files, builds the decoder, and generates the C++ files in the /out directory
A simple program for querying the parsed instruction data - useful for when the output of the generated code, disassembler, or other part of the system outputs a piece of info about an instructions but not enough to aid with the debugging process e.g. the mnemonic is printed by the disassembler but the filename from which the decode is derived from is useful to know.
The command line args are explorable through the standard usage and help mechanics
All other files in this directory are modules that are called by the above scripts.
These are the files that Jinja2 uses to generated the output C++ files.
Unit tests