Skip to content

Instantly share code, notes, and snippets.

@jmpews
Last active July 15, 2020 07:30
Show Gist options
  • Save jmpews/793d95335257f396b8893b729106c0a6 to your computer and use it in GitHub Desktop.
Save jmpews/793d95335257f396b8893b729106c0a6 to your computer and use it in GitHub Desktop.
x86 & x64 architecture manual

mov rax, rbx // MR encoding

> rex > 0100, W = 1, R = 0, X = 0, B = 0
      > 0100 1 0 0 0 = 0x48
> opcode = 0x89
> ModR/M > REG = 011, Mod = 11, R/M = 000
         > 11 011 000 = 0xd8
> 0x48 0x89 0xd8

4d 89 e4 MOV R12,R12 // MR encoding
> rex > 0x100, W = 1, R = 1, X = 0, B = 1
> opcode = 0x89
> ModR/M > REG = 100, Mod = 11, R/M = 100
         > 11 100 100 - 0xe4


4d 8b a4 24 00 40 00 00  MOV R12,qword ptr [R12 + 0x4000] // RM encoding

> rex > 0100, W=1, R = 1, X = 0, B = 1
      > 0100 1 1 0 1 = 0x4d
> opcode = 8b
> ModR/M > REG = 100, Mod = 10, R/M = 100
         > 10 100 100 = 0xa4
> SIB > scale = 00, index = 100, base = 100
>     > 00 100 100 = 0x24

                
4f 8b a4 9c 00 80 00 00  R12,qword ptr [R12 + R11*0x4 + 0x8000] // RM encoding
> rex > 0100, W=1, R = 1, X = 1, B = 1
      > 0100 1 1 0 1 = 0x4d
> opcode = 8b
> ModR/M > REG = 100, Mod = 10, R/M = 100
         > 10 100 100 = 0xa4
> SIB > scale = 10 index = 011, base = 100
      > 10 011 100 = 0x9c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment