pub struct Opcodes {
pub prefixes: Prefixes,
pub escape: bool,
pub primary: u8,
pub secondary: Option<u8>,
}Expand description
Describe an instruction’s opcodes. From section 2.1.2 “Opcodes” in the reference manual:
A primary opcode can be 1, 2, or 3 bytes in length. An additional 3-bit opcode field is sometimes encoded in the ModR/M byte. Smaller fields can be defined within the primary opcode. Such fields define the direction of operation, size of displacements, register encoding, condition codes, or sign extension. Encoding fields used by an opcode vary depending on the class of operation.
Two-byte opcode formats for general-purpose and SIMD instructions consist of one of the following:
- An escape opcode byte
0FHas the primary opcode and a second opcode byte.- A mandatory prefix (
66H,F2H, orF3H), an escape opcode byte, and a second opcode byte (same as previous bullet).For example,
CVTDQ2PDconsists of the following sequence:F3 0F E6. The first byte is a mandatory prefix (it is not considered as a repeat prefix).Three-byte opcode formats for general-purpose and SIMD instructions consist of one of the following:
- An escape opcode byte
0FHas the primary opcode, plus two additional opcode bytes.- A mandatory prefix (
66H,F2H, orF3H), an escape opcode byte, plus two additional opcode bytes (same as previous bullet).For example,
PHADDWfor XMM registers consists of the following sequence:66 0F 38 01. The first byte is the mandatory prefix.
Fields§
§prefixes: PrefixesThe prefix bytes for this instruction.
escape: boolIndicates the use of an escape opcode byte, 0x0f.
primary: u8The primary opcode.
secondary: Option<u8>Some instructions (e.g., SIMD) may have a secondary opcode.