Some x86 Instruction Encoding Resources
Just sharing a few useful resources, relating to x86-64 instruction encoding.
[ Check out all posts in “low-level” series here. ]
As of my previous post, I wrapped the topic of x86-64 instruction encoding, for now.
We used a bunch of resources in the previous posts. I am listing them (and a few more) here for reference:
- Wikipedia - X86 : Good overview, and details on register extensions.
- Wikipedia - X86-64 : Operating modes : Operand size defaults of various modes listed.
- StackOverflow X86 Tag Wiki : Nice set of learning resources.
- Encoding Real X86 Instructions : A good resource on x86 (32 bit) encoding.
- OSDev - X86-64 Instruction Encoding : Very good resource on x86-64 encoding.
- Online X86 Opcode and Instruction Reference : Great resource, separate pages for 32 and 64 bit, and separate pages for coder (more brief info), geek (complete info), along with alphabetical tables (abc).
- Another Unofficial X86 and AMD64 Instruction Reference : Great for looking up all info about a mnemonic.
- Really good talk on X86-64 instruction encoding by Borislav Petkov.
- Intel’s Software Developer’s Manuals : The ultimate guides on the topic. Volume 2 is the Instruction Set Reference.
- AMD’s AMD64 Architecture Programmer’s Manuals : Volume 3 has Instruction Encoding and General-Purpose Instruction Reference.
- Agner Fog’s Software optimization resources : One of the most highly respected set of resources on optimization and x86 hardware details.
- Standord CS107 - Guide to x86-64 : Nice and compact guide, that includes topics like addressing modes.
- x86 Instruction Encoding Revealed: Bit Twiddling for Fun and Profit : This one seems to go into details on ModR/M and SIB, which is cool.
- X86_64 Instruction Encoding - Compiler Programming Ep4 : Looks like a nice video walkthrough of the encoding, referencing the relevant resources. (I only skimmed through it so far.)
Also, when I look for reliable and focused information on a specific x86 topic, I first see if I will get lucky finding a StackOverflow answer from Peter Cordes. Here is an example.
I will keep adding to this list as I encounter new resources.
Update [ 2024-01-08 ]: Adding useful resources pointed out in this HN discussion.
- Intel XED: “An library and CLI tool for encoding and decoding instructions between hex and their mnemonics.” - HN comment from xelxebar
- x86 Is an Octal Machine (1995): “Understanding x86 instruction encoding is far better done in octal — you can memorise most of the instruction set this way.” - HN comment from userbinator
- Compiling a Lisp: Instruction encoding interlude - Great post describing the instruction encoding with diagrams and references to Intel’s SDM Volume 2. (Thanks to HN comment from tekknolagi.)