x86 instruction encoding tables

Posted by Cheery on Stack Overflow See other posts from Stack Overflow or by Cheery
Published on 2010-05-18T07:58:53Z Indexed on 2010/05/18 8:00 UTC
Read the original article Hit count: 478

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.

© Stack Overflow or respective owner

Related posts about x86

Related posts about assembler