summaryrefslogtreecommitdiff
path: root/rust/src/llil/lifting.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2024-06-28 11:32:21 -0400
committermason <35282038+emesare@users.noreply.github.com>2024-07-01 12:35:51 +0000
commitc7d90297d41af6c178dbed4b8c389567aa4a4d06 (patch)
treebcebdf11d6fa2fac07e558bdece6a823566f2844 /rust/src/llil/lifting.rs
parent3765f2dce4addd02364af6fb2973ff8eb47a7cd9 (diff)
Add LLIL_REG_SPLIT to rust api
Diffstat (limited to 'rust/src/llil/lifting.rs')
-rw-r--r--rust/src/llil/lifting.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/rust/src/llil/lifting.rs b/rust/src/llil/lifting.rs
index daf95ac3..e6226070 100644
--- a/rust/src/llil/lifting.rs
+++ b/rust/src/llil/lifting.rs
@@ -1016,6 +1016,43 @@ where
Expression::new(self, expr_idx)
}
+ pub fn reg_split<H: Into<Register<A::Register>>, L: Into<Register<A::Register>>>(
+ &self,
+ size: usize,
+ hi_reg: H,
+ lo_reg: L,
+ ) -> Expression<A, Mutable, NonSSA<LiftedNonSSA>, ValueExpr> {
+ use binaryninjacore_sys::BNLowLevelILAddExpr;
+ use binaryninjacore_sys::BNLowLevelILOperation::LLIL_REG_SPLIT;
+
+ // TODO verify valid id
+ let hi_reg = match hi_reg.into() {
+ Register::ArchReg(r) => r.id(),
+ Register::Temp(r) => 0x8000_0000 | r,
+ };
+
+ // TODO verify valid id
+ let lo_reg = match lo_reg.into() {
+ Register::ArchReg(r) => r.id(),
+ Register::Temp(r) => 0x8000_0000 | r,
+ };
+
+ let expr_idx = unsafe {
+ BNLowLevelILAddExpr(
+ self.handle,
+ LLIL_REG_SPLIT,
+ size,
+ 0,
+ hi_reg as u64,
+ lo_reg as u64,
+ 0,
+ 0,
+ )
+ };
+
+ Expression::new(self, expr_idx)
+ }
+
pub fn set_reg<'a, R, E>(
&'a self,
size: usize,