From 8d621c51b2797fda7b1dc22243dde611cfc04f68 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Tue, 23 Dec 2025 13:12:02 -0700 Subject: Refactor calling conventions to support correct representation of structures --- mediumlevelilinstruction.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'mediumlevelilinstruction.h') diff --git a/mediumlevelilinstruction.h b/mediumlevelilinstruction.h index c7663269..3abe363e 100644 --- a/mediumlevelilinstruction.h +++ b/mediumlevelilinstruction.h @@ -1237,6 +1237,32 @@ namespace BinaryNinja void SetDestSSAVersion(size_t version) { UpdateRawOperand(1, version); } }; template <> + struct MediumLevelILInstructionAccessor : public MediumLevelILInstructionBase + { + SSAVariable GetDestSSAVariable() const { return GetRawOperandAsSSAVariable(0); } + SSAVariable GetSourceSSAVariable() const { return GetRawOperandAsPartialSSAVariableSource(0); } + uint64_t GetOffset() const { return GetRawOperandAsInteger(3); } + void SetDestSSAVersion(size_t version) { UpdateRawOperand(1, version); } + void SetSourceSSAVersion(size_t version) { UpdateRawOperand(2, version); } + }; + template <> + struct MediumLevelILInstructionAccessor : public MediumLevelILInstructionBase + { + SSAVariable GetDestSSAVariable() const { return GetRawOperandAsSSAVariable(0); } + SSAVariable GetSourceSSAVariable() const { return GetRawOperandAsPartialSSAVariableSource(0); } + void SetDestMemoryVersion(size_t version) { UpdateRawOperand(1, version); } + void SetSourceMemoryVersion(size_t version) { UpdateRawOperand(2, version); } + }; + template <> + struct MediumLevelILInstructionAccessor : public MediumLevelILInstructionBase + { + SSAVariable GetDestSSAVariable() const { return GetRawOperandAsSSAVariable(0); } + SSAVariable GetSourceSSAVariable() const { return GetRawOperandAsPartialSSAVariableSource(0); } + uint64_t GetOffset() const { return GetRawOperandAsInteger(3); } + void SetDestMemoryVersion(size_t version) { UpdateRawOperand(1, version); } + void SetSourceMemoryVersion(size_t version) { UpdateRawOperand(2, version); } + }; + template <> struct MediumLevelILInstructionAccessor : public MediumLevelILInstructionBase { SSAVariable GetSourceSSAVariable() const { return GetRawOperandAsSSAVariable(0); } @@ -1355,6 +1381,17 @@ namespace BinaryNinja { Variable GetDestVariable() const { return GetRawOperandAsVariable(0); } }; + template <> + struct MediumLevelILInstructionAccessor : public MediumLevelILInstructionBase + { + Variable GetDestVariable() const { return GetRawOperandAsVariable(0); } + uint64_t GetOffset() const { return GetRawOperandAsInteger(1); } + }; + template <> + struct MediumLevelILInstructionAccessor : public MediumLevelILInstructionBase + { + MediumLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(0); } + }; template <> struct MediumLevelILInstructionAccessor : public MediumLevelILCallSSAInstruction @@ -1554,6 +1591,13 @@ namespace BinaryNinja int64_t GetOffset() const { return GetRawOperandAsInteger(1); } }; + template <> + struct MediumLevelILInstructionAccessor : public MediumLevelILInstructionBase + { + MediumLevelILInstructionList GetSourceExprs() const { return GetRawOperandAsExprList(0); } + void SetSourceExprs(const _STD_VECTOR& exprs) { UpdateRawOperandAsExprList(0, exprs); } + }; + template <> struct MediumLevelILInstructionAccessor : public MediumLevelILInstructionBase {}; @@ -1786,6 +1830,12 @@ namespace BinaryNinja template <> struct MediumLevelILInstructionAccessor : public MediumLevelILOneOperandInstruction {}; + template <> + struct MediumLevelILInstructionAccessor : public MediumLevelILOneOperandInstruction + {}; + template <> + struct MediumLevelILInstructionAccessor : public MediumLevelILOneOperandInstruction + {}; #undef _STD_VECTOR #undef _STD_SET -- cgit v1.3.1