From 1c6f11277096534479c958b6d9fc5265d318ca2a Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Mon, 18 Sep 2017 23:25:08 -0400 Subject: Add basic floating point instructions --- mediumlevelilinstruction.h | 59 ++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 26 deletions(-) (limited to 'mediumlevelilinstruction.h') diff --git a/mediumlevelilinstruction.h b/mediumlevelilinstruction.h index 9a76cb6c..aa4600df 100644 --- a/mediumlevelilinstruction.h +++ b/mediumlevelilinstruction.h @@ -91,8 +91,6 @@ namespace BinaryNinja LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage, CarryExprMediumLevelOperandUsage, - HighExprMediumLevelOperandUsage, - LowExprMediumLevelOperandUsage, StackExprMediumLevelOperandUsage, ConditionExprMediumLevelOperandUsage, HighVariableMediumLevelOperandUsage, @@ -428,10 +426,6 @@ namespace BinaryNinja { return *(MediumLevelILTwoOperandWithCarryInstruction*)this; } - MediumLevelILDoublePrecisionInstruction& AsDoublePrecision() - { - return *(MediumLevelILDoublePrecisionInstruction*)this; - } template const MediumLevelILInstructionAccessor& As() const @@ -456,10 +450,6 @@ namespace BinaryNinja { return *(const MediumLevelILTwoOperandWithCarryInstruction*)this; } - const MediumLevelILDoublePrecisionInstruction& AsDoublePrecision() const - { - return *(const MediumLevelILDoublePrecisionInstruction*)this; - } }; struct MediumLevelILInstruction: public MediumLevelILInstructionBase @@ -485,8 +475,6 @@ namespace BinaryNinja template MediumLevelILInstruction GetLeftExpr() const { return As().GetLeftExpr(); } template MediumLevelILInstruction GetRightExpr() const { return As().GetRightExpr(); } template MediumLevelILInstruction GetCarryExpr() const { return As().GetCarryExpr(); } - template MediumLevelILInstruction GetHighExpr() const { return As().GetHighExpr(); } - template MediumLevelILInstruction GetLowExpr() const { return As().GetLowExpr(); } template MediumLevelILInstruction GetStackExpr() const { return As().GetStackExpr(); } template MediumLevelILInstruction GetConditionExpr() const { return As().GetConditionExpr(); } template Variable GetHighVariable() const { return As().GetHighVariable(); } @@ -537,8 +525,6 @@ namespace BinaryNinja MediumLevelILInstruction GetLeftExpr() const; MediumLevelILInstruction GetRightExpr() const; MediumLevelILInstruction GetCarryExpr() const; - MediumLevelILInstruction GetHighExpr() const; - MediumLevelILInstruction GetLowExpr() const; MediumLevelILInstruction GetStackExpr() const; MediumLevelILInstruction GetConditionExpr() const; Variable GetHighVariable() const; @@ -644,13 +630,6 @@ namespace BinaryNinja MediumLevelILInstruction GetCarryExpr() const { return GetRawOperandAsExpr(2); } }; - struct MediumLevelILDoublePrecisionInstruction: public MediumLevelILInstructionBase - { - MediumLevelILInstruction GetHighExpr() const { return GetRawOperandAsExpr(0); } - MediumLevelILInstruction GetLowExpr() const { return GetRawOperandAsExpr(1); } - MediumLevelILInstruction GetRightExpr() const { return GetRawOperandAsExpr(2); } - }; - // Implementations of each instruction to fetch the correct operand value for the valid operands, these // are derived from MediumLevelILInstructionBase so that invalid operand accessor functions will generate // a compiler error. @@ -773,6 +752,11 @@ namespace BinaryNinja Variable GetSourceVariable() const { return GetRawOperandAsVariable(0); } uint64_t GetOffset() const { return GetRawOperandAsInteger(1); } }; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILInstructionBase + { + Variable GetHighVariable() const { return GetRawOperandAsVariable(0); } + Variable GetLowVariable() const { return GetRawOperandAsVariable(1); } + }; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILInstructionBase { @@ -796,6 +780,13 @@ namespace BinaryNinja uint64_t GetOffset() const { return GetRawOperandAsInteger(2); } void SetSourceMemoryVersion(size_t version) { UpdateRawOperand(1, version); } }; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILInstructionBase + { + SSAVariable GetHighSSAVariable() const { return GetRawOperandAsSSAVariable(0); } + SSAVariable GetLowSSAVariable() const { return GetRawOperandAsSSAVariable(2); } + void SetHighSSAVersion(size_t version) { UpdateRawOperand(1, version); } + void SetLowSSAVersion(size_t version) { UpdateRawOperand(3, version); } + }; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILInstructionBase { @@ -953,6 +944,10 @@ namespace BinaryNinja template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; @@ -965,17 +960,23 @@ namespace BinaryNinja template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandInstruction {}; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandWithCarryInstruction {}; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandWithCarryInstruction {}; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandWithCarryInstruction {}; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILTwoOperandWithCarryInstruction {}; - template <> struct MediumLevelILInstructionAccessor: public MediumLevelILDoublePrecisionInstruction {}; - template <> struct MediumLevelILInstructionAccessor: public MediumLevelILDoublePrecisionInstruction {}; - template <> struct MediumLevelILInstructionAccessor: public MediumLevelILDoublePrecisionInstruction {}; - template <> struct MediumLevelILInstructionAccessor: public MediumLevelILDoublePrecisionInstruction {}; - template <> struct MediumLevelILInstructionAccessor: public MediumLevelILOneOperandInstruction {}; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILOneOperandInstruction {}; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILOneOperandInstruction {}; @@ -983,4 +984,10 @@ namespace BinaryNinja template <> struct MediumLevelILInstructionAccessor: public MediumLevelILOneOperandInstruction {}; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILOneOperandInstruction {}; template <> struct MediumLevelILInstructionAccessor: public MediumLevelILOneOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILOneOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILOneOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILOneOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILOneOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILOneOperandInstruction {}; + template <> struct MediumLevelILInstructionAccessor: public MediumLevelILOneOperandInstruction {}; } -- cgit v1.3.1