diff options
| author | Brian Potchik <brian@vector35.com> | 2023-02-04 15:23:52 -0500 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2023-02-04 15:23:52 -0500 |
| commit | 1a7d06b3b8044ccdee4e3ff0883a33bf8cce487f (patch) | |
| tree | 6779d6b368acfcad57474e0fd12c1ae4158f5c38 /highlevelilinstruction.h | |
| parent | 4005984260466439560545040850557922003325 (diff) | |
Initial support for constant data expressions.
Diffstat (limited to 'highlevelilinstruction.h')
| -rw-r--r-- | highlevelilinstruction.h | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/highlevelilinstruction.h b/highlevelilinstruction.h index 7ac97d2d..19303bdc 100644 --- a/highlevelilinstruction.h +++ b/highlevelilinstruction.h @@ -48,6 +48,7 @@ namespace BinaryNinja struct HighLevelILInstruction; struct HighLevelILConstantInstruction; + struct HighLevelILConstantDataInstruction; struct HighLevelILOneOperandInstruction; struct HighLevelILTwoOperandInstruction; struct HighLevelILTwoOperandWithCarryInstruction; @@ -62,6 +63,7 @@ namespace BinaryNinja enum HighLevelILOperandType { IntegerHighLevelOperand, + ConstantDataHighLevelOperand, IndexHighLevelOperand, IntrinsicHighLevelOperand, ExprHighLevelOperand, @@ -100,6 +102,7 @@ namespace BinaryNinja OffsetHighLevelOperandUsage, MemberIndexHighLevelOperandUsage, ConstantHighLevelOperandUsage, + ConstantDataHighLevelOperandUsage, VectorHighLevelOperandUsage, IntrinsicHighLevelOperandUsage, TargetHighLevelOperandUsage, @@ -336,6 +339,7 @@ namespace BinaryNinja HighLevelILOperandList GetOperands() const; uint64_t GetRawOperandAsInteger(size_t operand) const; + ConstantData GetRawOperandAsConstantData(size_t operand) const; size_t GetRawOperandAsIndex(size_t operand) const; HighLevelILInstruction GetRawOperandAsExpr(size_t operand) const; Variable GetRawOperandAsVariable(size_t operand) const; @@ -408,6 +412,10 @@ namespace BinaryNinja { return *(const HighLevelILConstantInstruction*)this; } + const HighLevelILConstantDataInstruction& AsConstantData() const + { + return *(const HighLevelILConstantDataInstruction*)this; + } const HighLevelILOneOperandInstruction& AsOneOperand() const { return *(const HighLevelILOneOperandInstruction*)this; @@ -559,6 +567,11 @@ namespace BinaryNinja return As<N>().GetConstant(); } template <BNHighLevelILOperation N> + ConstantData GetConstantData() const + { + return As<N>().GetConstantData(); + } + template <BNHighLevelILOperation N> int64_t GetVector() const { return As<N>().GetVector(); @@ -732,6 +745,7 @@ namespace BinaryNinja uint64_t GetOffset() const; size_t GetMemberIndex() const; int64_t GetConstant() const; + ConstantData GetConstantData() const; int64_t GetVector() const; uint32_t GetIntrinsic() const; uint64_t GetTarget() const; @@ -764,6 +778,7 @@ namespace BinaryNinja HighLevelILOperandUsage GetUsage() const { return m_usage; } uint64_t GetInteger() const; + ConstantData GetConstantData() const; size_t GetIndex() const; uint32_t GetIntrinsic() const; HighLevelILInstruction GetExpr() const; @@ -824,6 +839,14 @@ namespace BinaryNinja /*! \ingroup highlevelil */ + struct HighLevelILConstantDataInstruction : public HighLevelILInstructionBase + { + ConstantData GetConstantData() const { return GetRawOperandAsConstantData(0); } + }; + + /*! + \ingroup highlevelil + */ struct HighLevelILOneOperandInstruction : public HighLevelILInstructionBase { HighLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(0); } @@ -1169,9 +1192,6 @@ namespace BinaryNinja struct HighLevelILInstructionAccessor<HLIL_CONST> : public HighLevelILConstantInstruction {}; template <> - struct HighLevelILInstructionAccessor<HLIL_CONST_DATA> : public HighLevelILConstantInstruction - {}; - template <> struct HighLevelILInstructionAccessor<HLIL_CONST_PTR> : public HighLevelILConstantInstruction {}; template <> @@ -1180,6 +1200,9 @@ namespace BinaryNinja template <> struct HighLevelILInstructionAccessor<HLIL_IMPORT> : public HighLevelILConstantInstruction {}; + template <> + struct HighLevelILInstructionAccessor<HLIL_CONST_DATA> : public HighLevelILConstantDataInstruction + {}; template <> struct HighLevelILInstructionAccessor<HLIL_ADD> : public HighLevelILTwoOperandInstruction |
