ArchTraits

Struct ArchTraits 

Source
pub struct ArchTraits {
    pub sp_reg_id: u8,
    pub fp_reg_id: u8,
    pub link_reg_id: u8,
    pub ip_reg_id: u8,
    pub hw_stack_alignment: u8,
    pub min_stack_offset: u32,
    pub max_stack_offset: u32,
    pub regs_signature: [OperandSignature; 32],
    pub reg_type_to_type_id: [TypeId; 32],
    pub type_id_to_reg_type: [RegType; 32],
}

Fields§

§sp_reg_id: u8§fp_reg_id: u8§link_reg_id: u8§ip_reg_id: u8§hw_stack_alignment: u8§min_stack_offset: u32§max_stack_offset: u32§regs_signature: [OperandSignature; 32]§reg_type_to_type_id: [TypeId; 32]§type_id_to_reg_type: [RegType; 32]

Implementations§

Source§

impl ArchTraits

Source

pub const fn sp_reg_id(&self) -> u32

Returns stack pointer register id.

Source

pub const fn fp_reg_id(&self) -> u32

Returns stack frame register id.

Returns link register id, if the architecture provides it.

Source

pub const fn ip_reg_id(&self) -> u32

Returns instruction pointer register id, if the architecture provides it.

Source

pub const fn hw_stack_alignment(&self) -> u32

Returns a hardware stack alignment requirement.

§Note

This is a hardware constraint. Architectures that don’t constrain it would return the lowest alignment (1), however, some architectures may constrain the alignment, for example AArch64 requires 16-byte alignment.

Tests whether the architecture provides link register, which is used across function calls. If the link register is not provided then a function call pushes the return address on stack (X86/X64).

Source

pub const fn min_stack_offset(&self) -> u32

Returns minimum addressable offset on stack guaranteed for all instructions.

Source

pub const fn max_stack_offset(&self) -> u32

Returns maximum addressable offset on stack depending on specific instruction.

Source

pub const fn has_reg_type(&self, typ: RegType) -> bool

Source

pub const fn reg_type_to_signature(&self, typ: RegType) -> OperandSignature

Source

pub fn reg_type_to_group(&self, typ: RegType) -> RegGroup

Source

pub fn reg_type_to_size(&self, typ: RegType) -> u32

Source

pub const fn reg_type_to_type_id(&self, typ: RegType) -> TypeId

Source

pub const fn by_arch(arch: Arch) -> &'static Self

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> 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, 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.