summaryrefslogtreecommitdiff
path: root/mediumlevelilinstruction.cpp
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2017-10-03 23:07:48 -0400
committerRusty Wagner <rusty@vector35.com>2017-10-06 17:28:35 -0400
commit95a7be141a07a20b8465981b01116fcafb6b5f41 (patch)
treee64cf2b30fe37eedf67d8d6111f240295992b020 /mediumlevelilinstruction.cpp
parent1c6f11277096534479c958b6d9fc5265d318ca2a (diff)
Adding support for register stacks in IL (for x87)
Diffstat (limited to 'mediumlevelilinstruction.cpp')
-rw-r--r--mediumlevelilinstruction.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/mediumlevelilinstruction.cpp b/mediumlevelilinstruction.cpp
index b0e607b2..c3b4014f 100644
--- a/mediumlevelilinstruction.cpp
+++ b/mediumlevelilinstruction.cpp
@@ -149,6 +149,7 @@ unordered_map<BNMediumLevelILOperation, vector<MediumLevelILOperandUsage>>
{MLIL_MEM_PHI, {DestMemoryVersionMediumLevelOperandUsage, SourceMemoryVersionsMediumLevelOperandUsage}},
{MLIL_CONST, {ConstantMediumLevelOperandUsage}},
{MLIL_CONST_PTR, {ConstantMediumLevelOperandUsage}},
+ {MLIL_FLOAT_CONST, {ConstantMediumLevelOperandUsage}},
{MLIL_IMPORT, {ConstantMediumLevelOperandUsage}},
{MLIL_ADD, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
{MLIL_SUB, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
@@ -1598,6 +1599,8 @@ ExprId MediumLevelILInstruction::CopyTo(MediumLevelILFunction* dest,
return dest->Const(size, GetConstant<MLIL_CONST>(), *this);
case MLIL_CONST_PTR:
return dest->ConstPointer(size, GetConstant<MLIL_CONST_PTR>(), *this);
+ case MLIL_FLOAT_CONST:
+ return dest->FloatConstRaw(size, GetConstant<MLIL_FLOAT_CONST>(), *this);
case MLIL_IMPORT:
return dest->ImportedAddress(size, GetConstant<MLIL_IMPORT>(), *this);
case MLIL_BP:
@@ -2131,6 +2134,36 @@ ExprId MediumLevelILFunction::ConstPointer(size_t size, uint64_t val, const ILSo
}
+ExprId MediumLevelILFunction::FloatConstRaw(size_t size, uint64_t val, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FLOAT_CONST, loc, size, val);
+}
+
+
+ExprId MediumLevelILFunction::FloatConstSingle(float val, const ILSourceLocation& loc)
+{
+ union
+ {
+ float f;
+ uint32_t i;
+ } bits;
+ bits.f = val;
+ return AddExprWithLocation(MLIL_FLOAT_CONST, loc, 4, bits.i);
+}
+
+
+ExprId MediumLevelILFunction::FloatConstDouble(double val, const ILSourceLocation& loc)
+{
+ union
+ {
+ double f;
+ uint64_t i;
+ } bits;
+ bits.f = val;
+ return AddExprWithLocation(MLIL_FLOAT_CONST, loc, 8, bits.i);
+}
+
+
ExprId MediumLevelILFunction::ImportedAddress(size_t size, uint64_t val, const ILSourceLocation& loc)
{
return AddExprWithLocation(MLIL_IMPORT, loc, size, val);