pub struct RexPrefix { /* private fields */ }Expand description
Construct and emit the REX prefix byte.
For more details, see section 2.2.1, “REX Prefixes” in Intel’s reference manual.
Implementations§
Source§impl RexPrefix
impl RexPrefix
Sourcepub const fn one_op(enc: u8, w_bit: bool, uses_8bit: bool) -> Self
pub const fn one_op(enc: u8, w_bit: bool, uses_8bit: bool) -> Self
Construct the RexPrefix for a unary instruction.
Used with a single register operand:
xandrare unused.bextends theregregister, allowing access to r8-r15, or the top bit of the opcode digit.
Sourcepub const fn two_op(
enc_reg: u8,
enc_rm: u8,
w_bit: bool,
uses_8bit: bool,
) -> Self
pub const fn two_op( enc_reg: u8, enc_rm: u8, w_bit: bool, uses_8bit: bool, ) -> Self
Construct the RexPrefix for a binary instruction.
Used without a SIB byte or for register-to-register addressing:
rextends theregoperand, allowing access to r8-r15.xis unused.bextends ther/moperand, allowing access to r8-r15.
Sourcepub const fn mem_op(
enc_reg: u8,
enc_rm: u8,
w_bit: bool,
uses_8bit: bool,
) -> Self
pub const fn mem_op( enc_reg: u8, enc_rm: u8, w_bit: bool, uses_8bit: bool, ) -> Self
Construct the RexPrefix for a binary instruction where one operand
is a memory address.
This is the same as RexPrefix::two_op except that enc_rm is
guaranteed to address a 64-bit register. This has a slightly different
meaning when uses_8bit is true to omit the REX prefix in more cases
than two_op would emit.
Sourcepub const fn with_digit(
digit: u8,
enc_reg: u8,
w_bit: bool,
uses_8bit: bool,
) -> Self
pub const fn with_digit( digit: u8, enc_reg: u8, w_bit: bool, uses_8bit: bool, ) -> Self
Construct the RexPrefix for an instruction using an opcode digit.
:
rextends the opcode digit.xis unused.bextends theregoperand, allowing access to r8-r15.
Sourcepub const fn three_op(
enc_reg: u8,
enc_index: u8,
enc_base: u8,
w_bit: bool,
uses_8bit: bool,
) -> Self
pub const fn three_op( enc_reg: u8, enc_index: u8, enc_base: u8, w_bit: bool, uses_8bit: bool, ) -> Self
Construct the RexPrefix for a ternary instruction, typically using a
memory address.
Used with a SIB byte:
rextends theregoperand, allowing access to r8-r15.xextends the index register, allowing access to r8-r15.bextends the base register, allowing access to r8-r15.