Reputation: 1746
I'm reading https://www.felixcloutier.com/x86/mov (mov as example) and there are these opcodes in the tables like 88 /r
and REX + 88 /r
and even REX.W + 8C /r
. I couldn't find an explanation at the website. What does r
, REX
, REX.W
, and 8C
mean? How do I come up with the hex value for an entire mov instruction based on this table?
Upvotes: 1
Views: 504
Reputation: 4812
Intel® 64 and IA-32 Architectures Developer's Manual: Vol. 2A, section 2.2.1 gives the answer to your question.
REX prefixes are instruction-prefix bytes used in 64-bit mode. They do the following:
- Specify GPRs and SSE registers.
- Specify 64-bit operand size.
- Specify extended control registers.
Particularities are given in Section 2.2.1.2:
- Setting REX.W can be used to determine the operand size but does not solely determine operand width.
- REX.R modifies the ModR/M reg field when that field encodes a GPR, SSE, control or debug register.
- REX.X bit modifies the SIB index field.
- REX.B either modifies the base in the ModR/M r/m field or SIB base field; or it modifies the opcode reg field used for accessing GPRs.
Please further refer to the Intel’s manual on how exactly they are encoded.
According to Section 3.1.1.1,
/r — Indicates that the ModR/M byte of the instruction contains a register operand and an r/m operand.
The ModR/M byte is explaned in section 2.1 of the Manual. 88
, 89
, 8A
, 8B
, 8C
, etc. are just opcode bytes also explained in this section of the Manual.
Upvotes: 4