summaryrefslogtreecommitdiff
path: root/rust/src/high_level_il
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2025-12-23 13:12:02 -0700
committerRusty Wagner <rusty.wagner@gmail.com>2026-05-22 16:30:56 -0400
commit8d621c51b2797fda7b1dc22243dde611cfc04f68 (patch)
treeba5e6a90e644d21d13e75dabcbd0cc747444443a /rust/src/high_level_il
parent08e34ac325743085911f96b62c81d9a1f2127806 (diff)
Refactor calling conventions to support correct representation of structures
Diffstat (limited to 'rust/src/high_level_il')
-rw-r--r--rust/src/high_level_il/instruction.rs10
-rw-r--r--rust/src/high_level_il/lift.rs14
2 files changed, 20 insertions, 4 deletions
diff --git a/rust/src/high_level_il/instruction.rs b/rust/src/high_level_il/instruction.rs
index 80be2a16..98839cae 100644
--- a/rust/src/high_level_il/instruction.rs
+++ b/rust/src/high_level_il/instruction.rs
@@ -400,6 +400,12 @@ impl HighLevelILInstruction {
HLIL_ADDRESS_OF => Op::AddressOf(UnaryOp {
src: HighLevelExpressionIndex::from(op.operands[0]),
}),
+ HLIL_PASS_BY_REF => Op::PassByRef(UnaryOp {
+ src: HighLevelExpressionIndex::from(op.operands[0]),
+ }),
+ HLIL_RETURN_BY_REF => Op::ReturnByRef(UnaryOp {
+ src: HighLevelExpressionIndex::from(op.operands[0]),
+ }),
HLIL_NEG => Op::Neg(UnaryOp {
src: HighLevelExpressionIndex::from(op.operands[0]),
}),
@@ -784,6 +790,8 @@ impl HighLevelILInstruction {
Deref(op) => Lifted::Deref(self.lift_unary_op(op)),
AddressOf(op) => Lifted::AddressOf(self.lift_unary_op(op)),
+ PassByRef(op) => Lifted::PassByRef(self.lift_unary_op(op)),
+ ReturnByRef(op) => Lifted::ReturnByRef(self.lift_unary_op(op)),
Neg(op) => Lifted::Neg(self.lift_unary_op(op)),
Not(op) => Lifted::Not(self.lift_unary_op(op)),
Sx(op) => Lifted::Sx(self.lift_unary_op(op)),
@@ -1161,6 +1169,8 @@ pub enum HighLevelILInstructionKind {
ConstData(ConstData),
Deref(UnaryOp),
AddressOf(UnaryOp),
+ PassByRef(UnaryOp),
+ ReturnByRef(UnaryOp),
Neg(UnaryOp),
Not(UnaryOp),
Sx(UnaryOp),
diff --git a/rust/src/high_level_il/lift.rs b/rust/src/high_level_il/lift.rs
index ab04f44b..e2ce3686 100644
--- a/rust/src/high_level_il/lift.rs
+++ b/rust/src/high_level_il/lift.rs
@@ -112,6 +112,8 @@ pub enum HighLevelILLiftedInstructionKind {
ConstData(LiftedConstData),
Deref(LiftedUnaryOp),
AddressOf(LiftedUnaryOp),
+ PassByRef(LiftedUnaryOp),
+ ReturnByRef(LiftedUnaryOp),
Neg(LiftedUnaryOp),
Not(LiftedUnaryOp),
Sx(LiftedUnaryOp),
@@ -240,6 +242,8 @@ impl HighLevelILLiftedInstruction {
ConstData(_) => "ConstData",
Deref(_) => "Deref",
AddressOf(_) => "AddressOf",
+ PassByRef(_) => "PassByRef",
+ ReturnByRef(_) => "ReturnByRef",
Neg(_) => "Neg",
Not(_) => "Not",
Sx(_) => "Sx",
@@ -360,10 +364,12 @@ impl HighLevelILLiftedInstruction {
"constant_data",
Operand::ConstantData(op.constant_data.clone()),
)],
- Deref(op) | AddressOf(op) | Neg(op) | Not(op) | Sx(op) | Zx(op) | LowPart(op)
- | BoolToInt(op) | UnimplMem(op) | Fsqrt(op) | Fneg(op) | Fabs(op) | FloatToInt(op)
- | IntToFloat(op) | FloatConv(op) | RoundToInt(op) | Floor(op) | Ceil(op)
- | Ftrunc(op) => vec![("src", Operand::Expr(*op.src.clone()))],
+ Deref(op) | AddressOf(op) | PassByRef(op) | ReturnByRef(op) | Neg(op) | Not(op)
+ | Sx(op) | Zx(op) | LowPart(op) | BoolToInt(op) | UnimplMem(op) | Fsqrt(op)
+ | Fneg(op) | Fabs(op) | FloatToInt(op) | IntToFloat(op) | FloatConv(op)
+ | RoundToInt(op) | Floor(op) | Ceil(op) | Ftrunc(op) => {
+ vec![("src", Operand::Expr(*op.src.clone()))]
+ }
DerefFieldSsa(op) => vec![
("src", Operand::Expr(*op.src.clone())),
("src_memory", Operand::Int(op.src_memory)),