Expand description

Encodes instructions in the standard x86 encoding mode. This is called IA-32E mode in the Intel manuals but corresponds to the addition of the REX-prefix format (hence the name of this module) that allowed encoding instructions in both compatibility mode (32-bit instructions running on a 64-bit OS) and in 64-bit mode (using the full 64-bit address space).

For all of the routines that take both a memory-or-reg operand (sometimes called “E” in the Intel documentation, see the Intel Developer’s manual, vol. 2, section A.2) and a reg-only operand (“G” in Intelese), the order is always G first, then E. The term “enc” in the following means “hardware register encoding number”.

Enums

We may need to include one or more legacy prefix bytes before the REX prefix. This enum covers only the small set of possibilities that we actually need.

Allows using the same opcode byte in different “opcode maps” to allow for more instruction encodings. See appendix A in the Intel Software Developer’s Manual, volume 2A, for more details.

Functions

Encode the ModR/M byte.