Struct RexPrefix

Source
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

Source

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 and r are unused.
  • b extends the reg register, allowing access to r8-r15, or the top bit of the opcode digit.
Source

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 the reg operand, allowing access to r8-r15.
  • x is unused.
  • b extends the r/m operand, allowing access to r8-r15.
Source

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 the reg operand, allowing access to r8-r15.
Source

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 the reg 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.
Source

pub fn encode(&self, sink: &mut impl CodeSink)

Possibly emit the REX prefix byte.

This will only be emitted if the REX prefix is not 0x40 (the default) or if the instruction uses 8-bit operands.

Trait Implementations§

Source§

impl Clone for RexPrefix

Source§

fn clone(&self) -> RexPrefix

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RexPrefix

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.