Skip to content

Instantly share code, notes, and snippets.

@jflopezfernandez
Created December 29, 2017 11:55
Show Gist options
  • Save jflopezfernandez/2263b55d7b3d418773a1ff4303d65bb4 to your computer and use it in GitHub Desktop.
Save jflopezfernandez/2263b55d7b3d418773a1ff4303d65bb4 to your computer and use it in GitHub Desktop.
Verifying Intel MODRM, thanks to Per Vognsen
Intel IA64 Documentation Section 2.1.5: Addressing-Mode Encoding of ModR/M and SIB Bytes
Figure 2-2:
Mod 11
RM 000
/digit (Opcode): REG = 001
--------------------------------
C8H 11001000
uint8_t code[1024];
uint8_t *emit_pointer = code;
void EmitModRxRm(uint8_t mod, uint8_t rx, uint8_t rm) {
*emit_poiner = rm | (rx << 3) | (mod << 6);
emit_pointer++;
}
Source: https://www.youtube.com/watch?v=N9B2KeAWXgE (40:00)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment