Re:X86 Register Encoding
by Flow on Wednesday November 02, 2016 @06:04AM
(#12853345)
Interesting, would you mind sharing the script or give a short overview how it works?
[ Parent
| on HN ]
Here it is (warning: Perl): http://pastebin.com/MFmDzY0g
It calls "objdump -d" on the binary, which is binutil's disassembler.
objdump prints each instruction out in the following format:
5dc: 67 80 7d 00 00 cmpb $0x0,0x0(%ebp)
The first part is the instruction offset; the second is the bytes that comprise the instruction; the third part is the instruction in AT&T assembly syntax.The script uses regexs to cut off the front and back, then counts the number of bytes (in hex format) in the second part.
Then it calculates the average for all instructions.
Might I suggest http://pastebin.com/2PHXi78A instead? It handles a few bugs from the original, and cleans the nested loops.