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:
x
andr
are unused.b
extends thereg
register, 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:
r
extends thereg
operand, allowing access to r8-r15.x
is unused.b
extends ther/m
operand, 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.
:
r
extends the opcode digit.x
is unused.b
extends thereg
operand, 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:
r
extends thereg
operand, allowing access to r8-r15.x
extends the index register, allowing access to r8-r15.b
extends the base register, allowing access to r8-r15.