Trait binaryninja::architecture::Architecture
source · pub trait Architecture: 'static + Sized + AsRef<CoreArchitecture> {
type Handle: Borrow<Self> + Clone;
type RegisterInfo: RegisterInfo<RegType = Self::Register>;
type Register: Register<InfoType = Self::RegisterInfo>;
type RegisterStackInfo: RegisterStackInfo<RegType = Self::Register, RegInfoType = Self::RegisterInfo, RegStackType = Self::RegisterStack>;
type RegisterStack: RegisterStack<InfoType = Self::RegisterStackInfo, RegType = Self::Register, RegInfoType = Self::RegisterInfo>;
type Flag: Flag<FlagClass = Self::FlagClass>;
type FlagWrite: FlagWrite<FlagType = Self::Flag, FlagClass = Self::FlagClass>;
type FlagClass: FlagClass;
type FlagGroup: FlagGroup<FlagType = Self::Flag, FlagClass = Self::FlagClass>;
type Intrinsic: Intrinsic;
Show 46 methods
// Required methods
fn endianness(&self) -> Endianness;
fn address_size(&self) -> usize;
fn default_integer_size(&self) -> usize;
fn instruction_alignment(&self) -> usize;
fn max_instr_len(&self) -> usize;
fn opcode_display_len(&self) -> usize;
fn associated_arch_by_addr(&self, addr: &mut u64) -> CoreArchitecture;
fn instruction_info(
&self,
data: &[u8],
addr: u64
) -> Option<InstructionInfo>;
fn instruction_text(
&self,
data: &[u8],
addr: u64
) -> Option<(usize, Vec<InstructionTextToken>)>;
fn instruction_llil(
&self,
data: &[u8],
addr: u64,
il: &mut Lifter<Self>
) -> Option<(usize, bool)>;
fn registers_all(&self) -> Vec<Self::Register>;
fn registers_full_width(&self) -> Vec<Self::Register>;
fn stack_pointer_reg(&self) -> Option<Self::Register>;
fn register_from_id(&self, id: u32) -> Option<Self::Register>;
fn handle(&self) -> Self::Handle;
// Provided methods
fn flag_write_llil<'a>(
&self,
flag: Self::Flag,
flag_write_type: Self::FlagWrite,
op: FlagWriteOp<Self::Register>,
il: &'a mut Lifter<Self>
) -> Option<LiftedExpr<'a, Self>> { ... }
fn flags_required_for_flag_condition(
&self,
_condition: FlagCondition,
_class: Option<Self::FlagClass>
) -> Vec<Self::Flag> { ... }
fn flag_cond_llil<'a>(
&self,
cond: FlagCondition,
class: Option<Self::FlagClass>,
il: &'a mut Lifter<Self>
) -> Option<LiftedExpr<'a, Self>> { ... }
fn flag_group_llil<'a>(
&self,
_group: Self::FlagGroup,
_il: &'a mut Lifter<Self>
) -> Option<LiftedExpr<'a, Self>> { ... }
fn registers_global(&self) -> Vec<Self::Register> { ... }
fn registers_system(&self) -> Vec<Self::Register> { ... }
fn register_stacks(&self) -> Vec<Self::RegisterStack> { ... }
fn flags(&self) -> Vec<Self::Flag> { ... }
fn flag_write_types(&self) -> Vec<Self::FlagWrite> { ... }
fn flag_classes(&self) -> Vec<Self::FlagClass> { ... }
fn flag_groups(&self) -> Vec<Self::FlagGroup> { ... }
fn link_reg(&self) -> Option<Self::Register> { ... }
fn register_stack_from_id(&self, _id: u32) -> Option<Self::RegisterStack> { ... }
fn flag_from_id(&self, _id: u32) -> Option<Self::Flag> { ... }
fn flag_write_from_id(&self, _id: u32) -> Option<Self::FlagWrite> { ... }
fn flag_class_from_id(&self, _id: u32) -> Option<Self::FlagClass> { ... }
fn flag_group_from_id(&self, _id: u32) -> Option<Self::FlagGroup> { ... }
fn intrinsics(&self) -> Vec<Self::Intrinsic> { ... }
fn intrinsic_class(&self, _id: u32) -> BNIntrinsicClass { ... }
fn intrinsic_from_id(&self, _id: u32) -> Option<Self::Intrinsic> { ... }
fn can_assemble(&self) -> bool { ... }
fn assemble(&self, _code: &str, _addr: u64) -> Result<Vec<u8>, String> { ... }
fn is_never_branch_patch_available(&self, _data: &[u8], _addr: u64) -> bool { ... }
fn is_always_branch_patch_available(&self, _data: &[u8], _addr: u64) -> bool { ... }
fn is_invert_branch_patch_available(&self, _data: &[u8], _addr: u64) -> bool { ... }
fn is_skip_and_return_zero_patch_available(
&self,
_data: &[u8],
_addr: u64
) -> bool { ... }
fn is_skip_and_return_value_patch_available(
&self,
_data: &[u8],
_addr: u64
) -> bool { ... }
fn convert_to_nop(&self, _data: &mut [u8], _addr: u64) -> bool { ... }
fn always_branch(&self, _data: &mut [u8], _addr: u64) -> bool { ... }
fn invert_branch(&self, _data: &mut [u8], _addr: u64) -> bool { ... }
fn skip_and_return_value(
&self,
_data: &mut [u8],
_addr: u64,
_value: u64
) -> bool { ... }
}
Required Associated Types§
type Handle: Borrow<Self> + Clone
type RegisterInfo: RegisterInfo<RegType = Self::Register>
type Register: Register<InfoType = Self::RegisterInfo>
type RegisterStackInfo: RegisterStackInfo<RegType = Self::Register, RegInfoType = Self::RegisterInfo, RegStackType = Self::RegisterStack>
type RegisterStack: RegisterStack<InfoType = Self::RegisterStackInfo, RegType = Self::Register, RegInfoType = Self::RegisterInfo>
type Flag: Flag<FlagClass = Self::FlagClass>
type FlagWrite: FlagWrite<FlagType = Self::Flag, FlagClass = Self::FlagClass>
type FlagClass: FlagClass
type FlagGroup: FlagGroup<FlagType = Self::Flag, FlagClass = Self::FlagClass>
type Intrinsic: Intrinsic
Required Methods§
fn endianness(&self) -> Endianness
fn address_size(&self) -> usize
fn default_integer_size(&self) -> usize
fn instruction_alignment(&self) -> usize
fn max_instr_len(&self) -> usize
fn opcode_display_len(&self) -> usize
fn associated_arch_by_addr(&self, addr: &mut u64) -> CoreArchitecture
fn instruction_info(&self, data: &[u8], addr: u64) -> Option<InstructionInfo>
fn instruction_text( &self, data: &[u8], addr: u64 ) -> Option<(usize, Vec<InstructionTextToken>)>
fn instruction_llil( &self, data: &[u8], addr: u64, il: &mut Lifter<Self> ) -> Option<(usize, bool)>
fn registers_all(&self) -> Vec<Self::Register>
fn registers_full_width(&self) -> Vec<Self::Register>
fn stack_pointer_reg(&self) -> Option<Self::Register>
fn register_from_id(&self, id: u32) -> Option<Self::Register>
fn handle(&self) -> Self::Handle
Provided Methods§
sourcefn flag_write_llil<'a>(
&self,
flag: Self::Flag,
flag_write_type: Self::FlagWrite,
op: FlagWriteOp<Self::Register>,
il: &'a mut Lifter<Self>
) -> Option<LiftedExpr<'a, Self>>
fn flag_write_llil<'a>( &self, flag: Self::Flag, flag_write_type: Self::FlagWrite, op: FlagWriteOp<Self::Register>, il: &'a mut Lifter<Self> ) -> Option<LiftedExpr<'a, Self>>
Fallback flag value calculation path. This method is invoked when the core is unable to recover flag use semantics, and resorts to emitting instructions that explicitly set each observed flag to the value of an expression returned by this function.
This function MUST NOT append instructions that have side effects.
This function MUST NOT observe the values of other flags.
This function MUST return None
or an expression representing a boolean value.
sourcefn flags_required_for_flag_condition(
&self,
_condition: FlagCondition,
_class: Option<Self::FlagClass>
) -> Vec<Self::Flag>
fn flags_required_for_flag_condition( &self, _condition: FlagCondition, _class: Option<Self::FlagClass> ) -> Vec<Self::Flag>
Determines what flags need to be examined in order to attempt automatic recovery of the semantics of this flag use.
If automatic recovery is not possible, the flag_cond_llil
method will be invoked to give
this Architecture
implementation arbitrary control over the expression to be evaluated.
sourcefn flag_cond_llil<'a>(
&self,
cond: FlagCondition,
class: Option<Self::FlagClass>,
il: &'a mut Lifter<Self>
) -> Option<LiftedExpr<'a, Self>>
fn flag_cond_llil<'a>( &self, cond: FlagCondition, class: Option<Self::FlagClass>, il: &'a mut Lifter<Self> ) -> Option<LiftedExpr<'a, Self>>
This function MUST NOT append instructions that have side effects.
This function MUST NOT observe the values of flags not returned by
flags_required_for_flag_condition
.
This function MUST return None
or an expression representing a boolean value.
sourcefn flag_group_llil<'a>(
&self,
_group: Self::FlagGroup,
_il: &'a mut Lifter<Self>
) -> Option<LiftedExpr<'a, Self>>
fn flag_group_llil<'a>( &self, _group: Self::FlagGroup, _il: &'a mut Lifter<Self> ) -> Option<LiftedExpr<'a, Self>>
Performs fallback resolution when the core was unable to recover the semantics of a
LLIL_FLAG_GROUP
expression. This occurs when multiple instructions may have set the flags
at the flag group query, or when the FlagGroup::flag_conditions()
map doesn’t have an entry
for the FlagClass
associated with the FlagWrite
type of the expression that last set
the flags required by the FlagGroup
group
.
In this fallback path, the Architecture
must generate the boolean expression in terms of
the values of that flags returned by group
’s flags_required
method.
This function must return an expression representing a boolean (as in, size of 0
) value.
It is not allowed to add any instructions that can cause side effects.
This function must not observe the values of any flag not returned by group
’s
flags_required
method.