Enum OperandType

Source
pub enum OperandType<'e> {
    Arch(ArchId<'e>),
    Constant(u64),
    Memory(MemAccess<'e>),
    Arithmetic(ArithOperand<'e>),
    ArithmeticFloat(ArithOperand<'e>, MemAccessSize),
    Undefined(UndefinedId),
    SignExtend(Operand<'e>, MemAccessSize, MemAccessSize),
    Select(Operand<'e>, Operand<'e>, Operand<'e>),
    Custom(u32),
}
Expand description

Different values an Operand can hold.

Variants§

§

Arch(ArchId<'e>)

A variable representing some CPU state, such as a register or a flag.

§

Constant(u64)

A constant integer.

§

Memory(MemAccess<'e>)

A variable representing memory read. Scarf currently assumes memory to always be little-endian.

§

Arithmetic(ArithOperand<'e>)

Integer arithmetic expression of two Operands.

§

ArithmeticFloat(ArithOperand<'e>, MemAccessSize)

Float arithmetic expression of two Operands.

MemAccessSize is used to specify in what sized IEEE 754 floats (Effectively just 32- or 64-bit) the operation and input operands are. Note that constant inputs still use integer constant type OperandType::Constant, you will have to use f32::from_bits and f32::to_bits (Or equivalent f64 functions for MemAccessSize::Mem64) to inspect constant inputs as floats.

§

Undefined(UndefinedId)

An “completely unknown” variable, which is result of merging two differing Operands during a FuncAnalysis run.

§

SignExtend(Operand<'e>, MemAccessSize, MemAccessSize)

Sign extends the input Operand from first MemAccessSize to second MemAccessSize.

§

Select(Operand<'e>, Operand<'e>, Operand<'e>)

If-else / ternary operator: if .0 != 0 { .1 } else { .2 }. Note: Any nonzero value for condition is considered true, no limitation that condition has to be 0/1.

§

Custom(u32)

Arbitrary user-defined variable.

This is never created by scarf itself, and the user code may assign any meaning to the integer value.

Implementations§

Source§

impl<'e> OperandType<'e>

Source

pub fn expr_size(&self) -> MemAccessSize

Returns whether the operand is 8, 16, 32, or 64 bits. Relevant with signed multiplication, usually operands can be considered zero-extended u32.

Trait Implementations§

Source§

impl<'e> Clone for OperandType<'e>

Source§

fn clone(&self) -> OperandType<'e>

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<'e> Debug for OperandType<'e>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'e> PartialEq for OperandType<'e>

Source§

fn eq(&self, other: &OperandType<'e>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'e> Copy for OperandType<'e>

Source§

impl<'e> Eq for OperandType<'e>

Source§

impl<'e> StructuralPartialEq for OperandType<'e>

Auto Trait Implementations§

§

impl<'e> Freeze for OperandType<'e>

§

impl<'e> RefUnwindSafe for OperandType<'e>

§

impl<'e> Send for OperandType<'e>

§

impl<'e> Sync for OperandType<'e>

§

impl<'e> Unpin for OperandType<'e>

§

impl<'e> !UnwindSafe for OperandType<'e>

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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.