3 ms·
It took me a few days of reading the x86 (586) instruction set guide, to make a Lisp function called 'get-opcode-byte-count' which, given a few bytes (eg, 20 by
by zandorg 16y ago
It took me a few days of reading the x86 (586) instruction set guide, to make a Lisp function called 'get-opcode-byte-count' which, given a few bytes (eg, 20 bytes), calculates the MOD/RM stuff, to give the number of bytes in the next opcode. It's part of the pre-processing of my decompiler - finding all the code and branching into branches, subroutines, etc, is crucial when decompiling an x86 binary (but it doesn't do this as well as IDA, the disassembler, which uses tons of tricks to find code).