Instruction analysis program
|
Instruction analysis program
|
|
|
This application reads in a binary list of instructions, and analyses it with a
|
This application reads in a binary list of instructions, and analyses it with a
|
set of functions looking at various parameters in each instruction.
|
set of functions looking at various parameters in each instruction.
|
|
|
It has been designed so a different instruction set support can be added.
|
It has been designed so a different instruction set support can be added.
|
|
|
Right now it's not so user friendly. Everything is hardcoded, and only support
|
Right now it's not so user friendly. Everything is hardcoded, and only support
|
for the OR1K instruction set exists.
|
for the OR1K instruction set exists.
|
|
|
Compile the program with:
|
Compile the program with:
|
|
|
$ make all
|
$ make all
|
|
|
And run a test (it needs the or32-elf- toolchain) with:
|
And run a test (it needs the or32-elf- toolchain) with:
|
|
|
$ make test
|
$ make test
|
|
|
To run the program itself, just give it a binary blob of instructions (usually
|
To run the program itself, just give it a binary blob of instructions (usually
|
the output of objcopy -O binary).
|
the output of objcopy -O binary).
|
|
|
For instance the Linux kernel ELF can be prepared with the following command:
|
For instance the Linux kernel ELF can be prepared with the following command:
|
|
|
$ or32-elf-objcopy -O binary -j .text -S vmlinux vmlinux.text.bin
|
$ or32-elf-objcopy -O binary -j .text -S vmlinux vmlinux.text.bin
|
|
|
Run it in the program with
|
Run it in the program with
|
|
|
$ ./insnanalysis vmlinux.text.bin > vmlinux.insnanalysis
|
$ ./insnanalysis vmlinux.text.bin > vmlinux.insnanalysis
|
|
|
Currently the program will output all appropriate information for each
|
Currently the program will output all appropriate information for each
|
instruction (ie. only ones with rA, or immediate fields in the instructions will
|
instruction (ie. only ones with rA, or immediate fields in the instructions will
|
have reports on those fields.)
|
have reports on those fields.)
|
|
|
|
|
|
|
TODO:
|
TODO:
|
o Add a more flexible way of indicating the instructions to dump
|
|
o Add an easy way to switch between human readable and CSV output
|
o Add an easy way to switch between human readable and CSV output
|
o Figure out how to tack this thing onto a simulator (or1ksim maybe) to give
|
o Figure out how to tack this thing onto a simulator (or1ksim maybe) to give
|
results of execution when that finishes executing, or just how to get the
|
results of execution when that finishes executing, or just how to get the
|
simulator to output a binary dump of executed instructions to be fed through
|
simulator to output a binary dump of executed instructions to be fed through
|
this
|
this
|
o Instruction group analysis (pairs, triplets, etc.)
|
|
|
|