diff options
| author | Michael Krasnitski <michael.krasnitski@gmail.com> | 2024-02-08 19:50:00 -0500 |
|---|---|---|
| committer | Kyle Martin <krm504@nyu.edu> | 2024-03-18 17:46:37 -0400 |
| commit | f535df40f978d221547b45650b75aa1089e197ce (patch) | |
| tree | a323638c4533932a9b72a1df34e10501085621fc /rust/src | |
| parent | 32556598d433ffd03b5b3c9735a813ab948f30aa (diff) | |
Rename `mlil::operation::ConstantData` to `ConstData` to mirror HLIL
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/mlil/instruction.rs | 19 | ||||
| -rw-r--r-- | rust/src/mlil/lift.rs | 6 | ||||
| -rw-r--r-- | rust/src/mlil/operation.rs | 19 |
3 files changed, 14 insertions, 30 deletions
diff --git a/rust/src/mlil/instruction.rs b/rust/src/mlil/instruction.rs index 816065a5..7b182010 100644 --- a/rust/src/mlil/instruction.rs +++ b/rust/src/mlil/instruction.rs @@ -2,7 +2,7 @@ use binaryninjacore_sys::BNGetMediumLevelILByIndex; use binaryninjacore_sys::BNMediumLevelILOperation; use crate::rc::Ref; -use crate::types::ILIntrinsic; +use crate::types::{ConstantData, ILIntrinsic, RegisterValue, RegisterValueType}; use super::lift::*; use super::operation::*; @@ -28,7 +28,7 @@ pub enum MediumLevelILInstructionKind { ConstPtr(Constant), Import(Constant), ExternPtr(ExternPtr), - ConstData(ConstantData), + ConstData(ConstData), Jump(Jump), RetHint(Jump), StoreSsa(StoreSsa), @@ -192,7 +192,7 @@ impl MediumLevelILInstruction { constant: op.operands[0], offset: op.operands[1], }), - MLIL_CONST_DATA => Op::ConstData(ConstantData { + MLIL_CONST_DATA => Op::ConstData(ConstData { constant_data_kind: op.operands[0] as u32, constant_data_value: op.operands[1] as i64, size: op.size, @@ -733,11 +733,14 @@ impl MediumLevelILInstruction { ExternPtr(op) => Lifted::ExternPtr(op), ConstData(op) => Lifted::ConstData(LiftedConstantData { - constant_data: get_constant_data( - &self.function, - op.constant_data_kind, - op.constant_data_value, - op.size, + constant_data: ConstantData::new( + self.function.get_function(), + RegisterValue { + state: RegisterValueType::from_raw_value(op.constant_data_kind).unwrap(), + value: op.constant_data_value, + offset: 0, + size: op.size, + }, ), }), Jump(op) => Lifted::Jump(LiftedJump { diff --git a/rust/src/mlil/lift.rs b/rust/src/mlil/lift.rs index 0cf669bf..15caad46 100644 --- a/rust/src/mlil/lift.rs +++ b/rust/src/mlil/lift.rs @@ -1,16 +1,14 @@ use std::collections::HashMap; use crate::rc::Ref; -use crate::types; -use crate::types::ILIntrinsic; -use crate::types::{SSAVariable, Variable}; +use crate::types::{ConstantData, ILIntrinsic, SSAVariable, Variable}; use super::operation::*; use super::MediumLevelILFunction; #[derive(Clone)] pub enum MediumLevelILLiftedOperand { - ConstantData(types::ConstantData), + ConstantData(ConstantData), Intrinsic(ILIntrinsic), Expr(MediumLevelILLiftedInstruction), ExprList(Vec<MediumLevelILLiftedInstruction>), diff --git a/rust/src/mlil/operation.rs b/rust/src/mlil/operation.rs index 9b3a4a70..319ba34b 100644 --- a/rust/src/mlil/operation.rs +++ b/rust/src/mlil/operation.rs @@ -192,23 +192,6 @@ pub(super) fn get_float(value: u64, size: usize) -> f64 { } } -pub(super) fn get_constant_data( - function: &MediumLevelILFunction, - state: u32, - value: i64, - size: usize, -) -> types::ConstantData { - types::ConstantData::new( - function.get_function(), - RegisterValue::new( - RegisterValueType::from_raw_value(state).unwrap(), - value, - 0, - size, - ), - ) -} - fn get_raw_operation(function: &MediumLevelILFunction, idx: usize) -> BNMediumLevelILInstruction { unsafe { BNGetMediumLevelILByIndex(function.handle, idx) } } @@ -283,7 +266,7 @@ pub struct ExternPtr { // CONST_DATA #[derive(Copy, Clone)] -pub struct ConstantData { +pub struct ConstData { pub constant_data_kind: u32, pub constant_data_value: i64, pub size: usize, |
