summaryrefslogtreecommitdiff
path: root/rust/src/architecture.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-05-10 19:24:35 -0400
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-12 17:45:24 -0400
commit7e32ee8b629e3e4f8d061cbe0729ff961b3502d7 (patch)
treeb33eedcd9afb5422aefd1a42e95f4a9ab2e7cca0 /rust/src/architecture.rs
parent4180c31fda63b6ccb9ce4ee543031fe4a5060d5f (diff)
[Rust] Remove `NonSSAVariant` bound from `LowLevelILFunction`
We don't do enough with the lifted il != non lifted il to justify the bound. This makes modifying IL much less work as the historical lifted il bound is gone.
Diffstat (limited to 'rust/src/architecture.rs')
-rw-r--r--rust/src/architecture.rs50
1 files changed, 27 insertions, 23 deletions
diff --git a/rust/src/architecture.rs b/rust/src/architecture.rs
index 211446d1..41150840 100644
--- a/rust/src/architecture.rs
+++ b/rust/src/architecture.rs
@@ -23,7 +23,6 @@ use crate::{
calling_convention::CoreCallingConvention,
data_buffer::DataBuffer,
disassembly::InstructionTextToken,
- low_level_il::{MutableLiftedILExpr, MutableLiftedILFunction},
platform::Platform,
rc::*,
relocation::CoreRelocationHandler,
@@ -50,6 +49,7 @@ use crate::low_level_il::expression::ValueExpr;
use crate::low_level_il::lifting::{
get_default_flag_cond_llil, get_default_flag_write_llil, LowLevelILFlagWriteOp,
};
+use crate::low_level_il::{LowLevelILMutableExpression, LowLevelILMutableFunction};
pub use binaryninjacore_sys::BNFlagRole as FlagRole;
pub use binaryninjacore_sys::BNImplicitRegisterExtend as ImplicitRegisterExtend;
pub use binaryninjacore_sys::BNLowLevelILFlagCondition as FlagCondition;
@@ -467,7 +467,7 @@ pub trait Architecture: 'static + Sized + AsRef<CoreArchitecture> {
&self,
data: &[u8],
addr: u64,
- il: &MutableLiftedILFunction,
+ il: &LowLevelILMutableFunction,
) -> Option<(usize, bool)>;
/// Fallback flag value calculation path. This method is invoked when the core is unable to
@@ -484,8 +484,8 @@ pub trait Architecture: 'static + Sized + AsRef<CoreArchitecture> {
flag: Self::Flag,
flag_write_type: Self::FlagWrite,
op: LowLevelILFlagWriteOp<Self::Register>,
- il: &'a MutableLiftedILFunction,
- ) -> Option<MutableLiftedILExpr<'a, ValueExpr>> {
+ il: &'a LowLevelILMutableFunction,
+ ) -> Option<LowLevelILMutableExpression<'a, ValueExpr>> {
let role = flag.role(flag_write_type.class());
Some(get_default_flag_write_llil(self, role, op, il))
}
@@ -513,8 +513,8 @@ pub trait Architecture: 'static + Sized + AsRef<CoreArchitecture> {
&self,
cond: FlagCondition,
class: Option<Self::FlagClass>,
- il: &'a MutableLiftedILFunction,
- ) -> Option<MutableLiftedILExpr<'a, ValueExpr>> {
+ il: &'a LowLevelILMutableFunction,
+ ) -> Option<LowLevelILMutableExpression<'a, ValueExpr>> {
Some(get_default_flag_cond_llil(self, cond, class, il))
}
@@ -535,8 +535,8 @@ pub trait Architecture: 'static + Sized + AsRef<CoreArchitecture> {
fn flag_group_llil<'a>(
&self,
_group: Self::FlagGroup,
- _il: &'a MutableLiftedILFunction,
- ) -> Option<MutableLiftedILExpr<'a, ValueExpr>> {
+ _il: &'a LowLevelILMutableFunction,
+ ) -> Option<LowLevelILMutableExpression<'a, ValueExpr>> {
None
}
@@ -1513,7 +1513,7 @@ impl Architecture for CoreArchitecture {
&self,
data: &[u8],
addr: u64,
- il: &MutableLiftedILFunction,
+ il: &LowLevelILMutableFunction,
) -> Option<(usize, bool)> {
let mut size = data.len();
let success = unsafe {
@@ -1538,8 +1538,8 @@ impl Architecture for CoreArchitecture {
_flag: Self::Flag,
_flag_write: Self::FlagWrite,
_op: LowLevelILFlagWriteOp<Self::Register>,
- _il: &'a MutableLiftedILFunction,
- ) -> Option<MutableLiftedILExpr<'a, ValueExpr>> {
+ _il: &'a LowLevelILMutableFunction,
+ ) -> Option<LowLevelILMutableExpression<'a, ValueExpr>> {
None
}
@@ -1575,16 +1575,16 @@ impl Architecture for CoreArchitecture {
&self,
_cond: FlagCondition,
_class: Option<Self::FlagClass>,
- _il: &'a MutableLiftedILFunction,
- ) -> Option<MutableLiftedILExpr<'a, ValueExpr>> {
+ _il: &'a LowLevelILMutableFunction,
+ ) -> Option<LowLevelILMutableExpression<'a, ValueExpr>> {
None
}
fn flag_group_llil<'a>(
&self,
_group: Self::FlagGroup,
- _il: &'a MutableLiftedILFunction,
- ) -> Option<MutableLiftedILExpr<'a, ValueExpr>> {
+ _il: &'a LowLevelILMutableFunction,
+ ) -> Option<LowLevelILMutableExpression<'a, ValueExpr>> {
None
}
@@ -2224,8 +2224,9 @@ where
{
let custom_arch = unsafe { &*(ctxt as *mut A) };
let data = unsafe { std::slice::from_raw_parts(data, *len) };
- let lifter =
- unsafe { MutableLiftedILFunction::from_raw_with_arch(il, Some(*custom_arch.as_ref())) };
+ let lifter = unsafe {
+ LowLevelILMutableFunction::from_raw_with_arch(il, Some(*custom_arch.as_ref()))
+ };
match custom_arch.instruction_llil(data, addr, &lifter) {
Some((res_len, res_value)) => {
@@ -2611,8 +2612,9 @@ where
let flag_write = custom_arch.flag_write_from_id(FlagWriteId(flag_write));
let flag = custom_arch.flag_from_id(FlagId(flag));
let operands = unsafe { std::slice::from_raw_parts(operands_raw, operand_count) };
- let lifter =
- unsafe { MutableLiftedILFunction::from_raw_with_arch(il, Some(*custom_arch.as_ref())) };
+ let lifter = unsafe {
+ LowLevelILMutableFunction::from_raw_with_arch(il, Some(*custom_arch.as_ref()))
+ };
if let (Some(flag_write), Some(flag)) = (flag_write, flag) {
if let Some(op) = LowLevelILFlagWriteOp::from_op(custom_arch, size, op, operands) {
@@ -2660,8 +2662,9 @@ where
let custom_arch = unsafe { &*(ctxt as *mut A) };
let class = custom_arch.flag_class_from_id(FlagClassId(class));
- let lifter =
- unsafe { MutableLiftedILFunction::from_raw_with_arch(il, Some(*custom_arch.as_ref())) };
+ let lifter = unsafe {
+ LowLevelILMutableFunction::from_raw_with_arch(il, Some(*custom_arch.as_ref()))
+ };
if let Some(expr) = custom_arch.flag_cond_llil(cond, class, &lifter) {
// TODO verify that returned expr is a bool value
return expr.index.0;
@@ -2679,8 +2682,9 @@ where
A: 'static + Architecture<Handle = CustomArchitectureHandle<A>> + Send + Sync,
{
let custom_arch = unsafe { &*(ctxt as *mut A) };
- let lifter =
- unsafe { MutableLiftedILFunction::from_raw_with_arch(il, Some(*custom_arch.as_ref())) };
+ let lifter = unsafe {
+ LowLevelILMutableFunction::from_raw_with_arch(il, Some(*custom_arch.as_ref()))
+ };
if let Some(group) = custom_arch.flag_group_from_id(FlagGroupId(group)) {
if let Some(expr) = custom_arch.flag_group_llil(group, &lifter) {