x86 instruction encoding tables
- by Cheery
I'm in middle of rewriting my assembler. While at it I'm curious about implementing disassembly as well. I want to make it simple and compact, and there's concepts I can exploit while doing so.
It is possible to determine rest of the x86 instruction encoding from opcode (maybe prefix bytes are required too, a bit). I know many people have written tables for doing it.
I'm not interested about mnemonics but instruction encoding, because it is an actual hard problem there. For each opcode number I need to know:
does this instruction contain modrm?
how many immediate fields does this instruction have?
what encoding does an immediate use?
is the immediate in field an instruction pointer -relative address?
what kind of registers does the modrm use for operand and register fields?
sandpile.org has somewhat quite much what I'd need, but it's in format that isn't easy to parse.
Before I start writing and validating those tables myself, I decided to write this question. Do you know about this kind of tables existing somewhere? In a form that doesn't require too much effort to parse.